Skip to content

Commit 7a34eaf

Browse files
committed
add tests
Signed-off-by: HaoXuAI <[email protected]>
1 parent afa1444 commit 7a34eaf

File tree

4 files changed

+902
-23
lines changed

4 files changed

+902
-23
lines changed

sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def from_proto(data_source: DataSourceProto) -> Any:
163163
query=spark_options.query,
164164
path=spark_options.path,
165165
file_format=spark_options.file_format,
166+
table_format=spark_options.table_format,
166167
date_partition_column_format=spark_options.date_partition_column_format,
167168
date_partition_column=data_source.date_partition_column,
168169
timestamp_field=data_source.timestamp_field,
@@ -369,15 +370,20 @@ def from_proto(cls, spark_options_proto: DataSourceProto.SparkOptions):
369370
Returns:
370371
Returns a SparkOptions object based on the spark_options protobuf
371372
"""
373+
# Parse table_format if present
374+
table_format = None
375+
if spark_options_proto.table_format:
376+
table_format = table_format_from_dict(
377+
json.loads(spark_options_proto.table_format)
378+
)
379+
372380
spark_options = cls(
373381
table=spark_options_proto.table,
374382
query=spark_options_proto.query,
375383
path=spark_options_proto.path,
376384
file_format=spark_options_proto.file_format,
377385
date_partition_column_format=spark_options_proto.date_partition_column_format,
378-
table_format=table_format_from_dict(
379-
json.loads(spark_options_proto.table_format)
380-
),
386+
table_format=table_format,
381387
)
382388

383389
return spark_options

0 commit comments

Comments
 (0)