-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add HAVING support #5889
Add HAVING support #5889
Conversation
f287a70
to
fc8d3c4
Compare
for (int rowId = 0; rowId < numRows; rowId++) { | ||
Object[] values = new Object[_numColumns]; | ||
for (int colId = 0; colId < _numColumns; colId++) { | ||
switch (columnDataTypes[colId]) { |
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.
NOTE: Change this to per-value switch based because we have found that this way has better performance (similar change in #4788 for performance improvement)
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.
This is awesome. LGTM!
case BYTES: | ||
return _predicateEvaluator.applySV(((ByteArray) value).getBytes()); | ||
default: | ||
throw new IllegalStateException(); |
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.
some message?
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.
It is not possible to run into this branch as the _valueType
is set inside the class
query = "SELECT COUNT(*) AS Count, DaysSinceEpoch FROM mytable GROUP BY DaysSinceEpoch HAVING Count > 350"; | ||
testSqlQuery(query, Collections.singletonList(query)); | ||
query = | ||
"SELECT MAX(ArrDelay) - MAX(AirTime) AS Diff, DaysSinceEpoch FROM mytable GROUP BY DaysSinceEpoch HAVING Diff * 2 > 1000 ORDER BY Diff ASC"; |
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 about some queries with AND and OR RowMatchers as well?
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.
Added
fc8d3c4
to
a6adf75
Compare
Description
Add support for SQL HAVING clause
Example of supported query:
SELECT MAX(ArrDelay) - MAX(AirTime) AS Diff, DaysSinceEpoch FROM mytable GROUP BY DaysSinceEpoch HAVING Diff > 500 ORDER BY Diff ASC