-
Notifications
You must be signed in to change notification settings - Fork 3k
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 varchar/char cast pushdown support in Redshift #23490
Add varchar/char cast pushdown support in Redshift #23490
Conversation
plugin/trino-redshift/src/main/java/io/trino/plugin/redshift/ImplementStringLpadFunction.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed
plugin/trino-redshift/src/test/java/io/trino/plugin/redshift/BaseRedshiftCastPushdownTest.java
Outdated
Show resolved
Hide resolved
|
||
new CastTestCase("c_timestamp", "date", Optional.of("c_date")), | ||
new CastTestCase("c_timestamp", "time", Optional.of("c_time")), | ||
new CastTestCase("c_date", "timestamp", Optional.of("c_timestamp"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some unsupported CASTs to varchar will land here, too, e.g.:
CAST(c_decimal_10_2 AS varchar(50))
plugin/trino-redshift/src/test/java/io/trino/plugin/redshift/TestRedshiftConnectorTest.java
Outdated
Show resolved
Hide resolved
3c50921
to
189caa3
Compare
/test-with-secrets sha=189caa3c735043a9f55c4b81b86ccb0e85217e62 |
The CI workflow run with tests that require additional secrets finished as failure: https://github.com/trinodb/trino/actions/runs/10968233148 |
@@ -0,0 +1,97 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain the motivation to support lpad
function pusdhown in PR description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mayankvadariya can we rebase the PR with master and cherry-pick the latest changes #22951
plugin/trino-redshift/src/test/java/io/trino/plugin/redshift/BaseRedshiftCastPushdownTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-redshift/src/test/java/io/trino/plugin/redshift/BaseRedshiftCastPushdownTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-redshift/src/test/java/io/trino/plugin/redshift/BaseRedshiftCastPushdownTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-redshift/src/main/java/io/trino/plugin/redshift/ImplementRedshiftLpad.java
Outdated
Show resolved
Hide resolved
plugin/trino-redshift/src/main/java/io/trino/plugin/redshift/ImplementRedshiftLpad.java
Outdated
Show resolved
Hide resolved
plugin/trino-redshift/src/test/java/io/trino/plugin/redshift/TestRedshiftConnectorTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-redshift/src/main/java/io/trino/plugin/redshift/ImplementRedshiftLpad.java
Outdated
Show resolved
Hide resolved
2e202ed
to
41ba30e
Compare
private static boolean supportedSourceTypeToCastToCharType(JdbcTypeHandle sourceType) | ||
{ | ||
// varchar -> char is unsupported as varchar supports UNICODE characters but char doesn't. | ||
return switch (sourceType.jdbcType()) { | ||
case CHAR -> true; | ||
default -> false; | ||
}; | ||
} | ||
|
||
private static boolean supportedSourceTypeToCastToVarcharType(JdbcTypeHandle sourceType) | ||
{ | ||
return switch (sourceType.jdbcType()) { | ||
case CHAR, VARCHAR -> true; | ||
default -> false; | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we inline it?
|
||
new CastTestCase("c_varchar_unicode", "varchar(50)", Optional.of("c_varchar_50")), | ||
new CastTestCase("c_nvarchar_unicode", "varchar(50)", Optional.of("c_varchar_50")), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add test case for cast to varchar
(unbounded varchar)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
41ba30e
to
ce58985
Compare
#22951 is merged today. Could you rebase on master to resolve conflicts? |
ce58985
to
77aca72
Compare
By mistake I closed this PR. Created #23808 as a replacement. |
Description
This PR adds support for cast projection pushdown for the Redshift connector for char/varchar types.
Additionally, enforces case-sensitive comparison by using Redshift COLLATE function https://docs.aws.amazon.com/redshift/latest/dg/r_COLLATE.html
This PR depends on #22951
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: