Skip to content

Commit 3a7e2ca

Browse files
committed
feat(convert): run JOIN without ON as a cross join and name more unaliased columns
JOIN, INNER JOIN, LEFT JOIN and FULL JOIN without ON convert to CROSS JOIN, as Snowflake runs them: no rows when either side is empty. A later RIGHT or FULL JOIN with ON applies to the whole join so far, as recorded. RIGHT JOIN without ON, and one before a FULL JOIN with USING, are unrecorded and stay refused. Unaliased SUBSTR, FLOOR, CEIL, NULLIF, TO_DATE and MONTH calls, empty text, $n positions and a one-key VARIANT path take the names Snowflake records for them. Pins evidence 3ee67fc2 and re-records the translation results, SQL sizes, the syntax baseline and marks, and the corpora.
1 parent c3a5599 commit 3a7e2ca

17 files changed

Lines changed: 9830 additions & 211 deletions

File tree

‎corpora/basics/queries.toml‎

Lines changed: 152 additions & 76 deletions
Large diffs are not rendered by default.

‎corpora/everyday/queries.toml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,8 +2138,8 @@ expect_repository = "refused SQ0002 fn:WIDTH_BUCKET at 7..39"
21382138
[[query]]
21392139
category = "semi_structured"
21402140
sql = '''SELECT payload:page FROM events'''
2141-
expect = "refused SQ0009 syntax:unaliased_output_name at 7..14"
2142-
expect_repository = "refused SQ0009 syntax:unaliased_output_name at 7..14"
2141+
expect = "translated"
2142+
expect_repository = "translated"
21432143

21442144
[[query]]
21452145
category = "semi_structured"
@@ -2713,8 +2713,8 @@ expect_repository = "refused SQ0002 fn:CURRENT_WAREHOUSE at 7..26"
27132713
[[query]]
27142714
category = "misc"
27152715
sql = '''SELECT $1 FROM orders'''
2716-
expect = "refused SQ0009 syntax:unaliased_output_name at 7..9"
2717-
expect_repository = "refused SQ0009 syntax:unaliased_output_name at 7..9"
2716+
expect = "translated"
2717+
expect_repository = "translated"
27182718

27192719
[[query]]
27202720
category = "misc"
@@ -2957,8 +2957,8 @@ expect_repository = "parse SQ0001 at 17..18"
29572957
[[query]]
29582958
category = "invalid_syntax"
29592959
sql = '''SELECT order_id FROM orders o JOIN customers c'''
2960-
expect = "refused SQ0002 join:inner at 30..46"
2961-
expect_repository = "refused SQ0002 join:inner at 30..46"
2960+
expect = "translated"
2961+
expect_repository = "translated"
29622962
snowflake = "compiles"
29632963

29642964
[[query]]

‎coverage/sql-size/baseline.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6295,6 +6295,11 @@
62956295
"relational/connect_by.toml#connect_by_start_with_value": 2385,
62966296
"relational/connect_by.toml#connect_by_start_with_value_aliased": 2265,
62976297
"relational/connect_by.toml#connect_by_tree": 2694,
6298+
"relational/cross_join_then_outer_join.toml#cross_join_then_full_join_on": 1177,
6299+
"relational/cross_join_then_outer_join.toml#cross_join_then_full_join_on_empty_middle": 939,
6300+
"relational/cross_join_then_outer_join.toml#cross_join_then_full_join_on_first_table": 1177,
6301+
"relational/cross_join_then_outer_join.toml#cross_join_then_right_join_on": 1178,
6302+
"relational/cross_join_then_outer_join.toml#join_without_on_then_full_join_on": 1177,
62986303
"relational/fixture_shapes.toml#not_in_subquery_of_literal_rows_in_case": 1076,
62996304
"relational/fixture_shapes.toml#null_cast_to_semi_structured": 1773,
63006305
"relational/fixture_shapes.toml#union_all_null_columns": 630,
@@ -6335,6 +6340,15 @@
63356340
"relational/join_using_kinds.toml#join_using_widths_left_e_first": 1070,
63366341
"relational/join_using_kinds.toml#union_null_column": 659,
63376342
"relational/join_using_kinds.toml#union_null_column_typed_branch": 594,
6343+
"relational/join_without_on.toml#full_join_without_on": 1135,
6344+
"relational/join_without_on.toml#full_join_without_on_empty_left": 1135,
6345+
"relational/join_without_on.toml#full_join_without_on_empty_right": 1135,
6346+
"relational/join_without_on.toml#inner_join_without_on": 1135,
6347+
"relational/join_without_on.toml#join_without_on": 1135,
6348+
"relational/join_without_on.toml#join_without_on_empty_right": 1135,
6349+
"relational/join_without_on.toml#join_without_on_filtered": 1161,
6350+
"relational/join_without_on.toml#left_join_without_on": 1135,
6351+
"relational/join_without_on.toml#left_join_without_on_empty_right": 1135,
63386352
"relational/joins.toml#cross_join": 1177,
63396353
"relational/joins.toml#full_join": 1157,
63406354
"relational/joins.toml#implicit_join": 1151,
@@ -6390,6 +6404,12 @@
63906404
"relational/typed_timestamp_literals.toml#typed_literal_date": 406,
63916405
"relational/typed_timestamp_literals.toml#typed_literal_timestamp": 176,
63926406
"relational/typed_timestamp_literals.toml#typed_literal_timestamp_over_no_rows": 222,
6407+
"relational/unaliased_demo_shapes.toml#demo_empty_string": 1568,
6408+
"relational/unaliased_demo_shapes.toml#demo_functions": 2586,
6409+
"relational/unaliased_demo_shapes.toml#demo_functions_empty": 2598,
6410+
"relational/unaliased_demo_shapes.toml#demo_functions_mixed_case": 2586,
6411+
"relational/unaliased_demo_shapes.toml#demo_positional": 1582,
6412+
"relational/unaliased_demo_shapes.toml#demo_variant_path": 1762,
63936413
"relational/unaliased_expression_names.toml#unaliased_aggregate_expressions": 1230,
63946414
"relational/unaliased_expression_names.toml#unaliased_expression_aggregates_with_duplicates": 940,
63956415
"relational/unaliased_expression_names.toml#unaliased_expressions_over_no_rows": 535,

‎coverage/syntax/baseline.json‎

Lines changed: 9091 additions & 95 deletions
Large diffs are not rendered by default.

‎coverage/syntax/marks/classes.jsonl‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{"case_id":"sf.classes.anomaly-detection.commands.create-anomaly-detection.kbc0e2ad80abc","mark":"settled accept","obligations":["sf.classes.anomaly-detection.commands.create-anomaly-detection.o043"],"sql_sha256":"bc0e2ad80abcca62003ce0048cf4cf2b996aa9c395c6a261521351cdf81e0a2b"}
12
{"case_id":"sf.classes.anomaly-detection.commands.show-anomaly-detection.k73106cdc1364","mark":"settled accept","obligations":["sf.classes.anomaly-detection.commands.show-anomaly-detection.o032"],"sql_sha256":"73106cdc1364e878a1c8626e09eb24206b208215e6fe4e283580f5b18bfeed8e"}
23
{"case_id":"sf.classes.anomaly-insights.methods.add-notification-integration.kcfda0a6caf5d","mark":"settled accept","obligations":["sf.classes.anomaly-insights.methods.add-notification-integration.o013"],"sql_sha256":"cfda0a6caf5d8b9244b41e162d18624db804fcbe47b3db0be7e63a4c88d40a3e"}
34
{"case_id":"sf.classes.anomaly-insights.methods.adhoc-calculate-anomalies-from-config.k5de941c6b40d","mark":"settled accept","obligations":["sf.classes.anomaly-insights.methods.adhoc-calculate-anomalies-from-config.o015"],"sql_sha256":"5de941c6b40d7a2d31f3610a512023e162dc4d1880093bd73ceb70a4c085e372"}
@@ -25,13 +26,24 @@
2526
{"case_id":"sf.classes.anomaly-insights.methods.set-monitor-notification-emails.kdbce8f4bbea7","mark":"settled accept","obligations":["sf.classes.anomaly-insights.methods.set-monitor-notification-emails.o010"],"sql_sha256":"dbce8f4bbea770e41e7ea1c1d7068b1d546ae73d62d915177d10380f6a66eee9"}
2627
{"case_id":"sf.classes.anomaly-insights.methods.set-org-notification-emails.k6798eddd367f","mark":"settled accept","obligations":["sf.classes.anomaly-insights.methods.set-org-notification-emails.o007"],"sql_sha256":"6798eddd367f7a17ca1868038203b9abcd250ad313710ce329287ae27cef6d2e"}
2728
{"case_id":"sf.classes.anomaly-insights.methods.update-monitor-config.k5c86aa65019f","mark":"settled accept","obligations":["sf.classes.anomaly-insights.methods.update-monitor-config.o012"],"sql_sha256":"5c86aa65019f492a9a4459f50d824b25a5440417afb0eb4713695460e8b20ebf"}
29+
{"case_id":"sf.classes.budget.commands.alter-budget.set-comment.kaca99a4387af","mark":"settled accept","obligations":["sf.classes.budget.commands.alter-budget.set-comment.o009"],"sql_sha256":"aca99a4387af28b88cda78ad3a4f7f12e84e6d1f9bda4800951afb6dac245031"}
30+
{"case_id":"sf.classes.budget.commands.alter-budget.set-tag.k9bd2621be951","mark":"settled accept","obligations":["sf.classes.budget.commands.alter-budget.set-tag.o012"],"sql_sha256":"9bd2621be95162ad0062c7504777bb7021d3ef34f542098b3fc448709c0f357e"}
31+
{"case_id":"sf.classes.budget.commands.alter-budget.unset-comment.k0e10f3e2c967","mark":"settled reject","obligations":["sf.classes.budget.commands.alter-budget.unset-comment.o012"],"sql_sha256":"0e10f3e2c96776167bd79a4a83368432cf172fbd90c0d067b154bb5b5bf41b71"}
32+
{"case_id":"sf.classes.budget.commands.create-budget.ka20a3f01ed31","mark":"settled accept","obligations":["sf.classes.budget.commands.create-budget.o015"],"sql_sha256":"a20a3f01ed318365abe6401bd8b3673492d0c9bae61ed282af91354e6dda5ee4"}
2833
{"case_id":"sf.classes.budget.commands.show-budget.kc05b4d2bce5d","mark":"settled reject","obligations":["sf.classes.budget.commands.show-budget.o031"],"sql_sha256":"c05b4d2bce5d0bac927076bbe8e299472809fbc26deb1bbd4330a7f2be902d19"}
2934
{"case_id":"sf.classes.budget.commands.show-budget.kde576a2debe6","mark":"settled accept","obligations":["sf.classes.budget.commands.show-budget.o041"],"sql_sha256":"de576a2debe69b3aceaf68c7388d9d5bf083945fd9a294430edf4401b4ca5ace"}
3035
{"case_id":"sf.classes.budget.methods.set-email-notifications.k63bb65d6e4f9","mark":"settled reject","obligations":["sf.classes.budget.methods.set-email-notifications.o016"],"sql_sha256":"63bb65d6e4f9c5948d72405fc415c96d7ed994c75961a1a720d3f83083fe8081"}
3136
{"case_id":"sf.classes.classification-profile.commands.show-classification-profile.kf2ec7c5dfc03","mark":"settled accept","obligations":["sf.classes.classification-profile.commands.show-classification-profile.o030"],"sql_sha256":"f2ec7c5dfc034a698e6ec295513b4af7fdc8ac6b0cdbf8eca73c6e3b9a95f867"}
3237
{"case_id":"sf.classes.classification-profile.methods.describe.ke3b4c5082645","mark":"settled accept","obligations":["sf.classes.classification-profile.methods.describe.o010"],"sql_sha256":"e3b4c508264506d8364a8ba7e1d81ab44ac40f65acef459d34e7bf575cc5d10e"}
38+
{"case_id":"sf.classes.classification.commands.alter-classification.rename-to.k9d8e791cc5b6","mark":"settled accept","obligations":["sf.classes.classification.commands.alter-classification.rename-to.o009"],"sql_sha256":"9d8e791cc5b6cc70ad59b6f3d27ea6e015305fe0ab56bd3ca00fe770e0423345"}
39+
{"case_id":"sf.classes.classification.commands.alter-classification.set-comment.kbd6837cffdda","mark":"settled accept","obligations":["sf.classes.classification.commands.alter-classification.set-comment.o009"],"sql_sha256":"bd6837cffdda8a3ed577522fa5c0f5fa31e112f75315ceb36e145520b09758ee"}
40+
{"case_id":"sf.classes.classification.commands.alter-classification.set-tag.k7c8379a1e42f","mark":"settled accept","obligations":["sf.classes.classification.commands.alter-classification.set-tag.o012"],"sql_sha256":"7c8379a1e42fb976770dab835b0307e572e1e805bec1db06ab9e629fcc196fd4"}
41+
{"case_id":"sf.classes.classification.commands.alter-classification.unset-comment.k890af4c2bb0c","mark":"settled reject","obligations":["sf.classes.classification.commands.alter-classification.unset-comment.o012"],"sql_sha256":"890af4c2bb0c16a59a7acd52d0b3e474a5b501de80ecc9c96fd745b70730b33a"}
42+
{"case_id":"sf.classes.classification.commands.create-classification.k8312b697499e","mark":"settled accept","obligations":["sf.classes.classification.commands.create-classification.o034"],"sql_sha256":"8312b697499e52c6c882fbf7b4d07711f59ad27bd82cbdb0076cfabae0a15a17"}
3343
{"case_id":"sf.classes.classification.commands.show-classification.k0898c874746b","mark":"settled accept","obligations":["sf.classes.classification.commands.show-classification.o032"],"sql_sha256":"0898c874746b27ecaf71d4a81254370fb9ebb63d9e5a8ff8d667c65882f37269"}
3444
{"case_id":"sf.classes.custom-classifier.commands.show-custom-classifiers.k17b638449d03","mark":"settled accept","obligations":["sf.classes.custom-classifier.commands.show-custom-classifiers.o032"],"sql_sha256":"17b638449d03b8666159c1ab44637ef9f8962e4b442bcde6add8528255e13824"}
3545
{"case_id":"sf.classes.custom-classifier.methods.list.k47bd3252e9ba","mark":"settled accept","obligations":["sf.classes.custom-classifier.methods.list.o007"],"sql_sha256":"47bd3252e9ba0c7b64b0cfef417b4fbc91e9bd8bf09a02b90721eb66a30c1b2f"}
46+
{"case_id":"sf.classes.forecast.commands.create-forecast.forecast-input-data-timestamp-colname-target-colname.kbd118d5ca31d","mark":"settled accept","obligations":["sf.classes.forecast.commands.create-forecast.forecast-input-data-timestamp-colname-target-colname.o042"],"sql_sha256":"bd118d5ca31ddb131cdcb9b038d6b4c895061d96ca38374c0d75aaa806f4429f"}
3647
{"case_id":"sf.classes.forecast.commands.show-forecast.k65d91d78b0f7","mark":"settled accept","obligations":["sf.classes.forecast.commands.show-forecast.o032"],"sql_sha256":"65d91d78b0f7277f824b2df85c22e88057ff4a0776677b4a8202735544dfd03f"}
48+
{"case_id":"sf.classes.top-insights.commands.create-top-insights.k7a9646b997cb","mark":"settled accept","obligations":["sf.classes.top-insights.commands.create-top-insights.o025"],"sql_sha256":"7a9646b997cbc15a37095f6c1855100157e388f6dcd61101e0d8ef9c544a5d1e"}
3749
{"case_id":"sf.classes.top-insights.commands.show-top-insights.ka7e896085944","mark":"settled accept","obligations":["sf.classes.top-insights.commands.show-top-insights.o032"],"sql_sha256":"a7e896085944372abb22fc2876806b766951b7cd621ae7c26a1a6ef32e1fe73c"}

0 commit comments

Comments
 (0)