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

Use ToSQLString() in ConstantFilter for escaped filter output #11797

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

rcurtin
Copy link
Contributor

@rcurtin rcurtin commented Apr 23, 2024

This is a (very simple) PR to address #11729.

Output after the change:

D explain select s from t where s = 'hello';

┌─────────────────────────────┐
│┌───────────────────────────┐│
││       Physical Plan       ││
│└───────────────────────────┘│
└─────────────────────────────┘
┌───────────────────────────┐
│         SEQ_SCAN          │
│   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
│             t             │
│   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
│             s             │
│   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
│Filters: s='hello' AND s IS│
│          NOT NULL         │
│   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
│           EC: 1           │
└───────────────────────────┘

(Previously, the output was Filters: s=hello AND s IS NOT NULL)

I don't have the internal knowledge of DuckDB to say whether or not anything is built on top of the assumption that ConstantFilter does not escape string/timestamp constants (or other types), but it at least seems safe to me. Someone much more knowledgeable will have to say.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft April 23, 2024 17:15
@rcurtin rcurtin marked this pull request as ready for review April 23, 2024 19:10
@Mytherin
Copy link
Collaborator

Thanks! Looks like there are still some CI failures remaining, could you have a look?

@duckdb-draftbot duckdb-draftbot marked this pull request as draft April 25, 2024 13:43
@rcurtin
Copy link
Contributor Author

rcurtin commented Apr 25, 2024

Thanks @Mytherin, I think I have it sorted now. Sorry for the slow response, I wasn't able to get back to this yesterday. (I think I hit 'ready for review' to fire off the CI jobs? Let's see what happens...)

@rcurtin rcurtin marked this pull request as ready for review April 25, 2024 13:43
@duckdb-draftbot duckdb-draftbot marked this pull request as draft April 26, 2024 14:17
@rcurtin rcurtin marked this pull request as ready for review April 29, 2024 02:36
@Mytherin Mytherin merged commit 2a594c7 into duckdb:main Apr 29, 2024
47 checks passed
@Mytherin
Copy link
Collaborator

Thanks!

@rcurtin rcurtin deleted the constant-sql-string branch April 29, 2024 12:54
github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request May 5, 2024
Merge pull request duckdb/duckdb#11797 from rcurtin/constant-sql-string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants