Skip to content

Commit

Permalink
Merge pull request #4 from atlanhq/gov-1081
Browse files Browse the repository at this point in the history
fix databricks datatype cast and support for int type decimal
  • Loading branch information
bichitra95 authored Aug 2, 2023
2 parents c822e26 + 21cabc7 commit 848df0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions soda/spark/soda/data_sources/spark_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ class SparkDataSource(SparkSQLBase):

def __init__(self, logs: Logs, data_source_name: str, data_source_properties: dict):
super().__init__(logs, data_source_name, data_source_properties)
self.NUMERIC_TYPES_FOR_PROFILING = ["integer", "int", "double", "float", "decimal"]

self.method = data_source_properties.get("method", "hive")
self.host = data_source_properties.get("host", "localhost")
Expand Down Expand Up @@ -474,3 +475,6 @@ def connect(self):
self.connection = connection
except Exception as e:
raise DataSourceConnectionError(self.type, e)

def cast_to_text(self, expr: str) -> str:
return f"CAST({expr} AS VARCHAR(100))"

0 comments on commit 848df0b

Please sign in to comment.