Skip to content

Commit

Permalink
fix: Handle complex Spark data types in SparkSource (#3154)
Browse files Browse the repository at this point in the history
* Make sure data types are strings

Signed-off-by: Petra Rebernjak <petra@noom.com>

* Lint

Signed-off-by: Petra Rebernjak <petra@noom.com>

Signed-off-by: Petra Rebernjak <petra@noom.com>
  • Loading branch information
rebstastic committed Aug 30, 2022
1 parent e4c8980 commit 5ddb83b
Showing 1 changed file with 1 addition and 4 deletions.
Expand Up @@ -159,10 +159,7 @@ def get_table_column_names_and_types(
store_config=config.offline_store
)
df = spark_session.sql(f"SELECT * FROM {self.get_table_query_string()}")
return (
(fields["name"], fields["type"])
for fields in df.schema.jsonValue()["fields"]
)
return ((field.name, field.dataType.simpleString()) for field in df.schema)

def get_table_query_string(self) -> str:
"""Returns a string that can directly be used to reference this table in SQL"""
Expand Down

0 comments on commit 5ddb83b

Please sign in to comment.