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

Let jdbc-based connectors control how data should be written and predicates pushed down #109

Merged
merged 7 commits into from
Feb 9, 2019

Conversation

findepi
Copy link
Member

@findepi findepi commented Jan 30, 2019

Today, a jdbc-based connector controls how data should be read from a ResultSet via ReadMapping definitions. However, writing is hard-coded in JdbcPageSink#appendColumn.
This expands the ReadMapping concept into ColumnMapping which controls both reading and pushdown.
This also introduces separate WriteMapping concept which is used for writing (currently both CTAS and INSERT)

Ref prestodb/presto#12151

@cla-bot cla-bot bot added the cla-signed label Jan 30, 2019
@findepi findepi force-pushed the findepi/jdbc-column-mapping branch 2 times, most recently from 5e41192 to 815a02a Compare January 30, 2019 15:35
return ColumnMapping.longMapping(decimalType,
(resultSet, columnIndex) -> encodeShortScaledValue(resultSet.getBigDecimal(columnIndex), scale),
shortDecimalWriteFunction(decimalType))
.withPredicatePushdownFilter(domain -> false); // TODO enable
Copy link
Member Author

Choose a reason for hiding this comment

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

Decimal predicate pushdown was not allowed in io.prestosql.plugin.jdbc.QueryBuilder#isAcceptedType and this is why it's retained as not allowed in this refactoring.

decimalType,
(resultSet, columnIndex) -> encodeScaledValue(resultSet.getBigDecimal(columnIndex), scale),
longDecimalWriteFunction(decimalType))
.withPredicatePushdownFilter(domain -> false); // TODO enable
Copy link
Member Author

Choose a reason for hiding this comment

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

Decimal predicate pushdown was not allowed in io.prestosql.plugin.jdbc.QueryBuilder#isAcceptedType and this is why it's retained as not allowed in this refactoring.

@findepi findepi requested a review from electrum January 30, 2019 15:37
private final Type type;
private final ReadFunction readFunction;
private final WriteFunction writeFunction;
private final Predicate<Domain> predicatePushdownFilter;
Copy link
Member Author

Choose a reason for hiding this comment

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

cc @ilfrin

@findepi findepi force-pushed the findepi/jdbc-column-mapping branch 2 times, most recently from 2e378c9 to 567c293 Compare January 31, 2019 13:24
@findepi findepi force-pushed the findepi/jdbc-column-mapping branch from 567c293 to e7f702f Compare February 4, 2019 17:42
@findepi findepi force-pushed the findepi/jdbc-column-mapping branch 2 times, most recently from 21880a1 to b5f2789 Compare February 5, 2019 14:53
@findepi
Copy link
Member Author

findepi commented Feb 5, 2019

@sopel39 AC

Copy link
Member

@electrum electrum left a comment

Choose a reason for hiding this comment

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

I didn't do a complete review but looks good to me

Copy link
Member Author

@findepi findepi left a comment

Choose a reason for hiding this comment

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

Thanks @electrum for the review.

@findepi findepi force-pushed the findepi/jdbc-column-mapping branch from b5f2789 to 3c9c460 Compare February 8, 2019 15:59
@findepi findepi force-pushed the findepi/jdbc-column-mapping branch from 2620bff to b5fa79a Compare February 8, 2019 15:59
@findepi findepi merged commit 2c35ebb into trinodb:master Feb 9, 2019
@findepi findepi mentioned this pull request Feb 9, 2019
6 tasks
@findepi findepi deleted the findepi/jdbc-column-mapping branch February 9, 2019 19:55
@electrum electrum added this to the 303 milestone Feb 14, 2019
rice668 pushed a commit to rice668/trino that referenced this pull request Jan 31, 2023
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.

3 participants