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

Add support for Postgres LIKE operators #8894

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Jan 17, 2024

Which issue does this PR close?

Closes #8893.

Rationale for this change

Add support for Postgres ~~, ~~*, !~~, !~~* like-pattern operators, in analogy with the regex-matching operators ~, ~*, !~, !~*.

What changes are included in this PR?

Extend the Operator enum with the new variants, and wire-up evaluation for them.

Are these changes tested?

Yes.

Are there any user-facing changes?

New operators available to be used in querying.

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt) substrait labels Jan 17, 2024
@gruuya gruuya marked this pull request as draft January 17, 2024 11:01
@gruuya
Copy link
Contributor Author

gruuya commented Jan 17, 2024

DRAFT as it's dependent on apache/datafusion-sqlparser-rs#1096 getting merged first.

UPDATE: ready for review since the sqlparser PR got merged.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @gruuya -- this looks great to me. I don't think we should merge this PR with a hard coded pin to the sqlparser repository, but as I mentioned I should have a real release of sqlparser shortly

Cargo.toml Outdated
@@ -70,7 +70,7 @@ parquet = { version = "50.0.0", default-features = false, features = ["arrow", "
rand = "0.8"
rstest = "0.18.0"
serde_json = "1"
sqlparser = { version = "0.41.0", features = ["visitor"] }
sqlparser = { git = "https://github.com/sqlparser-rs/sqlparser-rs", rev = "c7d2903c6d1d1a98e6e6203c5cfd54acb9aeca16", features = ["visitor"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to wait for sqlparser to be released -- see apache/datafusion-sqlparser-rs#1074 prior to merging this. However I plan to work on releasing sqlparser later today so I think we should be good shortly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that was quick!

I've merged the latest main into this branch now, let me know if there's anything else to do.

@@ -263,6 +263,58 @@ Not Regex Case-Insensitive Match
+---------------------------------------------------+
```

### `~~`
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@alamb
Copy link
Contributor

alamb commented Jan 25, 2024

#9000 has the sqlparser upgrade

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks again @gruuya

@alamb alamb merged commit bd38142 into apache:main Jan 26, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions physical-expr Physical Expressions sql SQL Planner sqllogictest SQL Logic Tests (.slt) substrait
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Postgres LIKE operators
2 participants