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 authored and adchia committed Aug 31, 2022
1 parent 1ee39fe commit 0e13573
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
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 0e13573

Please sign in to comment.