Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: change IGNORE COLUMNS MySQL option to EXCLUDE COLUMNS #29438

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

benesch
Copy link
Member

@benesch benesch commented Sep 8, 2024

We want to align this option with the forthcoming analogous option for sinks (#27758). In the context of sinks, "EXCLUDE" reads better than "IGNORE", because the columns aren't wholly ignored. Rather, they're allowed to be referenced in the PARTITION BY expression and the HEADERS option--they're just excluded from the final value.

EXCLUDE also nicely aligns with the SELECT ... EXCLUDE syntax that was recently added to DuckDB and Snowflake.

For backwards compatibility, the IGNORE COLUMNS option for the MySQL source continues to be accepted as an alias for EXCLUDE COLUMNS.

Motivation

  • This PR refactors existing code.

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@benesch benesch requested a review from rjobanp September 8, 2024 17:14
@benesch benesch requested review from a team as code owners September 8, 2024 17:14
@benesch benesch requested a review from ParkMyCar September 8, 2024 17:14
Comment on lines 234 to +235
( ( ',' 'IGNORE COLUMNS' ('(' (column_name) ( ( ',' column_name ) )* ')')? ')' )? )
( ( ',' 'EXCLUDE COLUMNS' ('(' (column_name) ( ( ',' column_name ) )* ')')? ')' )? )
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
( ( ',' 'IGNORE COLUMNS' ('(' (column_name) ( ( ',' column_name ) )* ')')? ')' )? )
( ( ',' 'EXCLUDE COLUMNS' ('(' (column_name) ( ( ',' column_name ) )* ')')? ')' )? )
( ( ',' ('IGNORE COLUMNS' | 'EXCLUDE COLUMNS' ) ('(' (column_name) ( ( ',' column_name ) )* ')')? ')' )? )

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah sorry, I missed this suggestion. Going to merge this while CI is green, but I'll circle back on this next Thursday when I remove the IGNORE COLUMNS from the syntax diagram entirely.

Copy link
Contributor

@morsapaes morsapaes left a comment

Choose a reason for hiding this comment

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

Left a minor suggestion for the railroad diagram, but syntax and documentation changes look good to me.

src/sql-parser/src/parser.rs Outdated Show resolved Hide resolved
src/sql-parser/src/parser.rs Outdated Show resolved Hide resolved
@@ -37,14 +37,14 @@ contains: unsupported type

Copy link
Contributor

Choose a reason for hiding this comment

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

change the filename?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good eye, done.

Copy link
Member

@ParkMyCar ParkMyCar left a comment

Choose a reason for hiding this comment

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

LGTM from an Adapter and SQL council perspective

@benesch benesch force-pushed the mysql-exclude-columns branch from ce5bdd7 to c948839 Compare September 9, 2024 20:44
We want to align this option with the forthcoming analogous option for
sinks (#27758). In the context of sinks, "EXCLUDE" reads better than
"IGNORE", because the columns aren't wholly ignored. Rather, they're
allowed to be referenced in the PARTITION BY expression and the HEADERS
option--they're just *excluded* from the final value.

EXCLUDE also nicely aligns with the `SELECT ... EXCLUDE` syntax that was
recently added to DuckDB and Snowflake.

For backwards compatibility, the `IGNORE COLUMNS` option for the MySQL
source continues to be accepted as an alias for `EXCLUDE COLUMNS`.
@benesch benesch force-pushed the mysql-exclude-columns branch from c948839 to 1bf4874 Compare September 10, 2024 03:21
@benesch benesch merged commit a626e50 into MaterializeInc:main Sep 10, 2024
85 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants