-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Conversation
5e41192
to
815a02a
Compare
return ColumnMapping.longMapping(decimalType, | ||
(resultSet, columnIndex) -> encodeShortScaledValue(resultSet.getBigDecimal(columnIndex), scale), | ||
shortDecimalWriteFunction(decimalType)) | ||
.withPredicatePushdownFilter(domain -> false); // TODO enable |
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.
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 |
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.
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.
private final Type type; | ||
private final ReadFunction readFunction; | ||
private final WriteFunction writeFunction; | ||
private final Predicate<Domain> predicatePushdownFilter; |
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.
cc @ilfrin
2e378c9
to
567c293
Compare
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/BooleanWriteFunction.java
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/WriteMapping.java
Show resolved
Hide resolved
567c293
to
e7f702f
Compare
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/ColumnMapping.java
Outdated
Show resolved
Hide resolved
21880a1
to
b5f2789
Compare
@sopel39 AC |
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.
I didn't do a complete review but looks good to me
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/StandardColumnMappings.java
Outdated
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/JdbcPageSink.java
Outdated
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/JdbcPageSink.java
Outdated
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/JdbcPageSink.java
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/JdbcPageSink.java
Outdated
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/BaseJdbcClient.java
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/WriteMapping.java
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/QueryBuilder.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.
Thanks @electrum for the review.
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/StandardColumnMappings.java
Outdated
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/JdbcPageSink.java
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/BaseJdbcClient.java
Show resolved
Hide resolved
presto-base-jdbc/src/main/java/io/prestosql/plugin/jdbc/WriteMapping.java
Show resolved
Hide resolved
b5f2789
to
3c9c460
Compare
WriteMapping captures how data should be written in a JDBC connector: - what data type should be used in the remote database - how the data should be bound to `PreparedStatement`
2620bff
to
b5fa79a
Compare
… branches with multiple repos.
Today, a jdbc-based connector controls how data should be read from a
ResultSet
viaReadMapping
definitions. However, writing is hard-coded inJdbcPageSink#appendColumn
.This expands the
ReadMapping
concept intoColumnMapping
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