-
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
Upgrade Pinot Connector Libraries to 0.8.0 #9098
Conversation
Based on #7630 . |
Does the upgrade require the changes from #7630? |
684cef2
to
7ebd38e
Compare
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.
First pass. Didn't review PinotSqlFormatter yet.
Would appreciate someone familiar with Pinot to also review the changes in DynamicTableBuilder (and PinotSqlFormatter).
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTableBuilder.java
Outdated
Show resolved
Hide resolved
} | ||
else { | ||
groupByColumns = resolvePinotColumns(schemaTableName, request.getGroupBy().getExpressions(), columnHandles); | ||
Optional<String> filter = Optional.empty(); |
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.
The order of processing changed - filters before grouping. Was this intentional (I do think the operation doesn't matter but makes the change seem more involved than it actually was).
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 reverted the order of processing so the functionality is the same as it was with the following caveat:
A passthrough query with grouping columns but no aggregations is parsed by pinot 0.8.0 differently than other queries: it wraps the grouping columns in a distinct(col1, col2, ...)
select list, returns a null list of grouping columns and a "distinct" aggregation function which does not support the Pinot AggregatationFunction::getFinalResultColumnType
method.
I addressed this but it seems better to include it in a separate pr, as the previous functionality is preserved with this pr and rewriting would change how distinct aggregations are handled. wdyt?
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.
Makes sense, it's easier to review changes related to version bump separately from behaviour changes.
We can change the behaviour in follow-up PRs.
for (AggregationFunction aggregationFunction : queryContext.getAggregationFunctions()) { | ||
aggregateColumnsBuilder.add(new PinotColumnHandle( | ||
aggregationFunction.getResultColumnName(), | ||
toTrinoType(aggregationFunction.getFinalResultColumnType()))); | ||
} | ||
if (queryContext.getGroupByExpressions() != null) { |
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.
Why is this nested inside the aggregations block?
I think it's possible for queries to have GROUP BY without aggregations.
SELECT 1 FROM t GROUP BY c
?
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.
reverted.
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.
Let's add a test with this query:
- Ensure that the plan contains a TableScan (so that we are sure that the connector participated in the query and the engine didn't do it all itself).
- The results are correct.
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 created #9167 to test this in BaseConnectorTest as well.
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTableBuilder.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTableBuilder.java
Show resolved
Hide resolved
aec35ea
to
6151d53
Compare
Fixes #9133 |
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.
Let's extract until 5fc2a82 into a separate PR since those commits are all good and can be merged right now.
Let's also extract the below three into another PR since those look good and can be merged:
Add support for varbinary filters 93a80ca
Fix decoding real -INFINITY and +INFINITY e88b097
Fix decoding double -INFINITY and +INFINITY 82f2914
Let's extract "Fix in clause handling in filter pushdown e6ff226" into a separate PR (for the sake of release notes and people who'd want to look at the fix).
We can then focus on just the 0.8.0 upgrade commits here (which I still need to review some parts of).
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/decoders/DoubleDecoder.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/PinotQueryBuilder.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestPinotIntegrationSmokeTest.java
Show resolved
Hide resolved
Created #9178 for the first pr |
Created #9180 for the varbinary filter support + real/double fixes |
Pr for the in clause varchar handling: #9181 |
f4e02d2
to
e9e0f10
Compare
<groupId>org.apache.pinot</groupId> | ||
<artifactId>pinot-yammer</artifactId> | ||
<version>${dep.pinot.version}</version> | ||
<scope>runtime</scope> |
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.
how are we getting this during runtime?
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.
shall we make a noop implementation for this pinot-metrics interface ?
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.
how are we getting this during runtime?
Required by the PinotQueryClient which requires PinotMetricsFactory. Would it be ok to leave it, so that we can have broker metrics? The worker functions like a broker without a reducer service (soon we will put that in also). wdyt?
e9e0f10
to
d04ee23
Compare
@elonazoulay Please separate a PR if subsequent commits |
I wonder if anyone can let me know when this is expected to be released? thanks |
a594161
to
03f9d25
Compare
I removed them and pushed. Btw, the commit for handling null on empty group was reworded (and removed from this pr) - it fixes issues in #9137 - let me know if you would like me to restore the branch as it was. |
@ebyhr, I removed them and pushed. FYI, the commit for handling null on empty group was reworded to "Fix handling of complex aggregate expressions in passthrough queries" and removed from this pr - it fixes issues in #9137 - let me know if you would like me to add it back. If not I will create another pr for it now. Thanks! |
Looks like an unrelated failure. |
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.
Almost good to me. Let's update the minimum requirement from 0.1.0
to 0.8.0
in pinot.rst
file.
plugin/trino-pinot/src/test/resources/quotes_in_column_name_realtimeSpec.json
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotColumnHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/TestDynamicTable.java
Show resolved
Hide resolved
d3664a2
to
f373703
Compare
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.
For "Remove PinotColumn":
Maybe reword message to Remove PinotColumn and moved used methods to PinotColumnHandle instead.
to clarify it was a mechanical refactor - nothing actually changed.
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.
For "Upgrade libraries to pinot-0.8.0"
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/AggregateExpression.java
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTable.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTable.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTableBuilder.java
Outdated
Show resolved
Hide resolved
plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/query/DynamicTablePqlExtractor.java
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.
Move "Update supported pinot version in documentation" into the commit that updates the library version.
LGTM % comments. Sorry about the long back and forth for this PR. |
This is groundwork for pinot-0.8.0 which uses PinotQuery in the broker request.
Remove PinotColumn and moved used methods to PinotColumnHandle instead
d556a42
to
791d47f
Compare
Use the QueryContext from the broker request to parse queries. Use FilterContext to parse filters in pinot-0.8.0. Pinot 0.8.0 supports native boolean types.
The offset is the first parameter in Pinot. Ensure that aggregations are not pushed down if there is an offset.
791d47f
to
f02d3fe
Compare
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 @elonazoulay
No description provided.