Skip to content

fix: spark temp tables#1656

Merged
eakmanrq merged 1 commit intomainfrom
eakmanrq/fix_spark_temp_table
Nov 2, 2023
Merged

fix: spark temp tables#1656
eakmanrq merged 1 commit intomainfrom
eakmanrq/fix_spark_temp_table

Conversation

@eakmanrq
Copy link
Contributor

@eakmanrq eakmanrq commented Nov 2, 2023

It appears when writing local files with spark it does not like a table that starts with double underscore. So I updated temp table for spark to remove it.

Also re-organized things a bit to remove the pattern where we got a query from source query and then made a source query again.

@eakmanrq eakmanrq requested review from izeigerman and treysp November 2, 2023 20:43
@eakmanrq eakmanrq force-pushed the eakmanrq/fix_spark_temp_table branch from e1b112b to 96e2d2d Compare November 2, 2023 20:51
def replace_table(
node: exp.Expression, curr_table: exp.Table, new_table: exp.Table
) -> exp.Expression:
if isinstance(node, exp.Table) and quote_identifiers(node) == quote_identifiers(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@treysp FYI I think this was another bug outside of the spark issue. node == curr_table could say that two tables don't match if one doesn't have quotes and the other does. So we quote them both now when comparing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - thanks

@eakmanrq eakmanrq merged commit 0ad0fd3 into main Nov 2, 2023
@eakmanrq eakmanrq deleted the eakmanrq/fix_spark_temp_table branch November 2, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants