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

Upgrade Pinot Connector Libraries to 0.8.0 #9098

Merged
merged 5 commits into from
Nov 5, 2021

Conversation

elonazoulay
Copy link
Member

No description provided.

@elonazoulay
Copy link
Member Author

Based on #7630 .

@hashhar
Copy link
Member

hashhar commented Sep 2, 2021

Does the upgrade require the changes from #7630?
If not, let's extract it so that we can merge this quickly (and then rebase the other PR instead).

@elonazoulay elonazoulay force-pushed the pinot-0.8.0 branch 5 times, most recently from 684cef2 to 7ebd38e Compare September 6, 2021 10:21
Copy link
Member

@hashhar hashhar left a 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).

}
else {
groupByColumns = resolvePinotColumns(schemaTableName, request.getGroupBy().getExpressions(), columnHandles);
Optional<String> filter = Optional.empty();
Copy link
Member

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).

Copy link
Member Author

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?

Copy link
Member

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) {
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

reverted.

Copy link
Member

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:

  1. 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).
  2. The results are correct.

Copy link
Member

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.

@elonazoulay
Copy link
Member Author

Fixes #9133

Copy link
Member

@hashhar hashhar left a 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).

@elonazoulay
Copy link
Member Author

Created #9178 for the first pr

@elonazoulay
Copy link
Member Author

Created #9180 for the varbinary filter support + real/double fixes

@elonazoulay
Copy link
Member Author

Pr for the in clause varchar handling: #9181

@elonazoulay elonazoulay force-pushed the pinot-0.8.0 branch 2 times, most recently from f4e02d2 to e9e0f10 Compare September 13, 2021 09:04
@elonazoulay elonazoulay requested a review from hashhar September 13, 2021 09:04
<groupId>org.apache.pinot</groupId>
<artifactId>pinot-yammer</artifactId>
<version>${dep.pinot.version}</version>
<scope>runtime</scope>
Copy link
Contributor

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?

Copy link
Contributor

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 ?

Copy link
Member Author

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?

@ebyhr
Copy link
Member

ebyhr commented Oct 26, 2021

@elonazoulay Please separate a PR if subsequent commits Simplify logic for generating Pinot ColumnMetadata ... Cleanup various minor issues in the Pinot Connector aren't mandatory during library upgrade.

@ddcprg
Copy link
Member

ddcprg commented Oct 26, 2021

I wonder if anyone can let me know when this is expected to be released? thanks

@elonazoulay
Copy link
Member Author

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.

@elonazoulay
Copy link
Member Author

@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!

@elonazoulay
Copy link
Member Author

Looks like an unrelated failure.

Copy link
Member

@ebyhr ebyhr left a 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.

@elonazoulay elonazoulay force-pushed the pinot-0.8.0 branch 2 times, most recently from d3664a2 to f373703 Compare October 27, 2021 16:31
@elonazoulay elonazoulay requested a review from ebyhr October 27, 2021 18:56
Copy link
Member

@hashhar hashhar left a 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.

Copy link
Member

@hashhar hashhar left a 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"

Copy link
Member

@hashhar hashhar left a 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.

@hashhar
Copy link
Member

hashhar commented Nov 1, 2021

LGTM % comments.

Sorry about the long back and forth for this PR.

@mosabua mosabua added the docs label Nov 3, 2021
This is groundwork for pinot-0.8.0 which uses
PinotQuery in the broker request.
Remove PinotColumn and moved used methods to PinotColumnHandle instead
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.
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

Thanks @elonazoulay

@hashhar
Copy link
Member

hashhar commented Nov 5, 2021

CI hit #8792 and #8911.

@hashhar hashhar merged commit 4187472 into trinodb:master Nov 5, 2021
@github-actions github-actions bot added this to the 365 milestone Nov 5, 2021
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.

6 participants