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

Disable incorrect character pushdown in PostgreSQL #7145

Conversation

findepi
Copy link
Member

@findepi findepi commented Mar 3, 2021

Extracted from #6874

Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM

@findepi findepi force-pushed the findepi/disable-incorrect-character-pushdown-in-postgresql-eaa946 branch from 7a12107 to b19a21a Compare March 4, 2021 08:41
@findepi
Copy link
Member Author

findepi commented Mar 4, 2021

Turns out postgresql supports varchars and chars longer than Trino, so brought back the logic for this.

@findepi findepi force-pushed the findepi/disable-incorrect-character-pushdown-in-postgresql-eaa946 branch from b19a21a to 36f2403 Compare March 4, 2021 08:43
@findepi
Copy link
Member Author

findepi commented Mar 4, 2021

Had to rebase onto master, to rebase #6874, to resolve conflict, to have test run.
Sorry.

private static ColumnMapping charColumnMapping(int charLength)
{
if (charLength > CharType.MAX_LENGTH) {
return varcharColumnMapping(charLength);
Copy link
Member

@hashhar hashhar Mar 4, 2021

Choose a reason for hiding this comment

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

Does this still preserve the char semantics of padding values?

There should be a test.

Copy link
Member Author

Choose a reason for hiding this comment

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

there is a test

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 catch. it doesn't correctly pad on write path and during predicate pushdown (this may or may not be relevant, depending on remote's coercions, need checking)

it's pre-existing behavior though and applies to other connectors as well, see io.trino.plugin.jdbc.StandardColumnMappings#defaultCharColumnMapping

do you want to file an issue for this?

Copy link
Member

Choose a reason for hiding this comment

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

#7152 - the title could be better though.

@findepi findepi force-pushed the findepi/disable-incorrect-character-pushdown-in-postgresql-eaa946 branch from 36f2403 to dca8321 Compare March 4, 2021 10:26
@findepi
Copy link
Member Author

findepi commented Mar 4, 2021

CI #5758 and some legit stuff

@findepi findepi force-pushed the findepi/disable-incorrect-character-pushdown-in-postgresql-eaa946 branch from dca8321 to 514272e Compare March 4, 2021 16:14

if (domain.isOnlyNull() ||
// PostgreSQL is case sensitive by default
domain.getValues().isDiscreteSet()) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd put these two conditions on one line, with the comment inside the if block.

Maybe also add a bit more to the comment explaining how isDiscreteSet is related to case sensitivity. The comment doesn't really clarify much right now. (Ideally, I think CASE_INSENSITIVE_CHARACTER_PUSHDOWN would have a more detailed explanation of how that works, and then we could reference it here.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I put the comment in between so it unambiguous what it refers to

point take on the issue how discrete sets translate to actual predicates, and indeed it applies to CASE_INSENSITIVE_CHARACTER_PUSHDOWN

@findepi findepi added this to the 353 milestone Mar 5, 2021
@findepi findepi merged commit dead88f into trinodb:master Mar 5, 2021
@findepi findepi deleted the findepi/disable-incorrect-character-pushdown-in-postgresql-eaa946 branch March 5, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants