-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Handle binary varying type for newer redshift driver #25488
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
Handle binary varying type for newer redshift driver #25488
Conversation
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.
Changes LGTM.
Please update the commit message with -
Handle binary varying type introduced in newer Redshift drivers
bddbdc8
to
bdad685
Compare
@tdcmeehan can you please review and the merge this PR? |
{ | ||
String typeName = typeHandle.getJdbcTypeName(); | ||
|
||
if (typeName.equalsIgnoreCase("binary varying")) { |
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 you add a comment explaining that this is dependent on the version of the driver, as is included in this PR?
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.
@tdcmeehan 1 line comment added.
or do you want me to add comment in Javadoc-style format
/**
* Maps Redshift VARBYTE columns to Presto VARBINARY.
* <p>
* Redshift JDBC driver version ≥ 2.1.0.32 reports VARBYTE as JDBC type 1111 (Types.OTHER)
* with type name "binary varying", whereas older versions (e.g., 2.1.0.28) report it
* as type -4 (Types.LONGVARBINARY) with type name "varbyte".
* This mapping ensures compatibility with newer driver versions.
*/
f314b4f
to
7e0ae2d
Compare
7e0ae2d
to
e036ddc
Compare
Description
Newer redshift drivers uses Types.OTHER (1111) to represent VARBYTE and describes it as "
binary varying
"Motivation and Context
create table redshift.test.redtest4 (varbincolumn varbinary);
The Redshift JDBC driver returns the JDBC type for VARBYTE columns as:
JdbcTypeHandle{jdbcType=1111, jdbcTypeName=binary varying, columnSize=2147483647, decimalDigits=0}
This type is not recognized by Presto's default jdbcTypeToPrestoType() mapping,
resulting in the column being ignored as unsupported during DESCRIBE or INSERT queries
DESCRIBE redshift.test.redtest1; output is:
SHOW CREATE TABLE redshift.test.redtest1; output is:
INSERT query output is:
Impact
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.