Skip to content

Commit

Permalink
fixing biging/long unconsistent datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
francescomucio authored and Francesco Mucio committed May 14, 2022
1 parent 5ff1c42 commit 26c9d42
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dbt/adapters/spark/column.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Any, Dict, Optional, TypeVar, Union
from typing import Any, ClassVar, Dict, Optional, TypeVar, Union

from dbt.adapters.base.column import Column
from dbt.dataclass_schema import dbtClassMixin
Expand All @@ -18,9 +18,13 @@ class SparkColumn(dbtClassMixin, Column):
table_stats: Optional[Dict[str, Any]] = None
column_index: Optional[int] = None

TYPE_LABELS: ClassVar[Dict[str, str]] = {
"LONG": "BIGINT",
}

@classmethod
def translate_type(cls, dtype: str) -> str:
return dtype
return super().translate_type(dtype).lower()

def can_expand_to(self: Self, other_column: Self) -> bool:
"""returns True if both columns are strings"""
Expand All @@ -35,10 +39,10 @@ def quoted(self) -> str:

@property
def data_type(self) -> str:
return self.dtype
return self.translate_type(self.dtype)

def __repr__(self) -> str:
return "<SparkColumn {} ({})>".format(self.name, self.data_type)
return "<SparkColumn {} ({})>".format(self.name, self.translate_type(self.data_type))

@staticmethod
def convert_table_stats(raw_stats: Optional[str]) -> Dict[str, Any]:
Expand Down

0 comments on commit 26c9d42

Please sign in to comment.