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
PostgreSQL statistical aggregate function pushdown #6731
PostgreSQL statistical aggregate function pushdown #6731
Conversation
65176e8
to
454d021
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.
Doc changes look good.
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.
PostgreSQL supports covariance functions too. Maybe those should be added too? You might find the patterns added in #6734 to be useful for that.
https://www.postgresql.org/docs/9.6/functions-aggregate.html#FUNCTIONS-AGGREGATE-STATISTICS-TABLE
LGTM otherwise.
assertThat(query("SELECT min(short_decimal), min(long_decimal) FROM " + testTable.getName())).isFullyPushedDown(); | ||
assertThat(query("SELECT max(short_decimal), max(long_decimal) FROM " + testTable.getName())).isFullyPushedDown(); | ||
assertThat(query("SELECT sum(short_decimal), sum(long_decimal) FROM " + testTable.getName())).isFullyPushedDown(); | ||
assertThat(query("SELECT avg(short_decimal), avg(long_decimal) FROM " + testTable.getName())).isFullyPushedDown(); |
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.
what has changed here?
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 changed the withTable()
approach to using TestTable
since it's more robust.
mind CI red |
It's |
84c2ae7
to
1f78ec6
Compare
JdbcColumnHandle columnHandle1 = (JdbcColumnHandle) context.getAssignments().get(inputs.get(0).getName()); | ||
verifyNotNull(columnHandle1, "Unbound variable: %s", inputs.get(0)); |
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.
use context.getAssignment
and then no need for verify
same in other places
Set<Type> types = ImmutableSet.of(aggregateFunction.getOutputType(), columnHandle1.getColumnType(), columnHandle2.getColumnType()); | ||
verify(types.equals(ImmutableSet.of(REAL)) || types.equals(ImmutableSet.of(DOUBLE))); |
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.
You know that columnHandle1.getColumnType(), columnHandle2.getColumnType()
are the same, so it's an indirect way of saying "verify outputtype equals columnHandle1.getColumnType()"
let's make it explicit
} | ||
|
||
@Test | ||
public void testRegrPushdown() |
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 testRegrPushdown -> testRegrAggregationPushdown (same for others , also those existing ones)
-- as we're getting more test methods like that, this naming pattern will make them easier to find
// test some values for which the aggregate functions return whole numbers | ||
try (TestTable testTable = new TestTable( | ||
postgreSqlServer::execute, | ||
getSession().getSchema().orElseThrow() + ".test_regr_pushdown", |
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.
is the schema known to be 'tpch'?
i guess other tests already assme that & making the assumption yields to a more readable code.
@findepi please merge if this version is OK |
@MiguelWeezardo are you sure you did push your changes? |
1f78ec6
to
72c7463
Compare
Sorry, I forgot to run |
Merged, thanks! |
No description provided.