Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ def _get_create_table_query(
Create table query.

"""
columns.extend(PARTITION_BY)

parsed_columns = []
for col in columns:
parsed_columns.append(f"{col['column_name']} {col['type']}")
Expand All @@ -112,9 +110,10 @@ def _get_create_table_query(
return (
f"CREATE TABLE IF NOT EXISTS "
f"{self.database}.{table_name} ({parsed_columns}) "
f"PARTITIONED BY ({PARTITION_BY[0]['column_name']}, "
f"{PARTITION_BY[1]['column_name']}, "
f"{PARTITION_BY[2]['column_name']});"
f"PARTITIONED BY ("
f"{PARTITION_BY[0]['column_name']} {PARTITION_BY[0]['type']}, "
f"{PARTITION_BY[1]['column_name']} {PARTITION_BY[1]['type']}, "
f"{PARTITION_BY[2]['column_name']} {PARTITION_BY[2]['type']});"
)

def _get_alter_table_drop_query(self, columns: List[Diff], table_name: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ def test_create_table_query(self, fs_schema):

expected_query = [
"CREATE TABLE IF NOT EXISTS test.table_name "
"(id LongType, timestamp TimestampType, new_feature FloatType, "
"feature1__avg_over_1_week_rolling_windows FloatType, year INT, "
"month INT, day INT) PARTITIONED BY (year, month, day);"
"(id LongType, timestamp TimestampType, new_feature FloatType) "
"PARTITIONED BY (year INT, month INT, day INT);"
]

query = metastore_migration.create_query(fs_schema, "table_name")
Expand Down