-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix HyperLogLog type registration in registerApproxDistinctAggregates #10664
Conversation
✅ Deploy Preview for meta-velox canceled.
|
@pramodsatya : Your fix seems reasonable. What did you do to encounter this error ? Please can you elaborate. Reason: Type doesn't exist: 'HYPERLOGLOG' Its best if there is a Presto e2e query to illustrate this problem. We can then link the Presto PR to this PR to give the reviewers more details. |
Hi @aditi-pandit, I came across this issue while running the tests from I ran the existing e2e tests for |
@pramodsatya : It might be better to say that this code is changed to make it consistent with https://github.com/facebookincubator/velox/blob/main/velox/functions/prestosql/types/HyperLogLogType.cpp#L20 Actually its even better if you use the registerHyperLogLogType() function itself instead of the registerCustomType call. |
e7d42c3
to
2a37d91
Compare
Thanks for the suggestion @aditi-pandit, it is better to use |
@pramodsatya : We should follow up with a PR adding e2e presto-native tests. Add a single function to test SQL with all the different functions using HLL to ensure the correctness of this fix. |
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 @pramodsatya
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.
@pramodsatya Nice catch. The change looks good. Some comments re: test.
I assume this issue shows up only when we register aggregate, but not scalar functions. I see that scalar functions register 'hyperloglog' type correctly.
class SignaturesWithCustomType : public ::testing::Test {}; | ||
|
||
TEST_F(SignaturesWithCustomType, customType) { | ||
aggregate::prestosql::registerAllAggregateFunctions("presto.default."); |
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 use registerApproxDistinctAggregates
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 not present in any header and looks like only registerAllAggregateFunctions
is exposed for tests. Is it fine if registerAllAggregateFunctions
is retained?
2a37d91
to
0d6c00f
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 @mbasmanova, yes this issue shows up when we register aggregate functions with a prefix and do not register hyperloglog
as a custom type (using registerHyperLogLogType
).
class SignaturesWithCustomType : public ::testing::Test {}; | ||
|
||
TEST_F(SignaturesWithCustomType, customType) { | ||
aggregate::prestosql::registerAllAggregateFunctions("presto.default."); |
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 not present in any header and looks like only registerAllAggregateFunctions
is exposed for tests. Is it fine if registerAllAggregateFunctions
is retained?
@@ -432,5 +433,14 @@ TEST_F(ApproxDistinctTest, toIntermediate) { | |||
digests, {"c0"}, {"merge(a0)"}, {"c0", "cardinality(a0)"}, {input}); | |||
} | |||
|
|||
TEST(ApproxDistinctSignatureTest, hyperLogLog) { |
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.
As mentioned earlier, test name should match file name. Please, change to TEST_F(ApproxDistinctTest, ...
The test name 'hyperLogLog' is not very descriptive. Consider, typeRegistration.
It could be that changing to ApproxDistinctTest will end up registering scalar functions in the SetUp, in which case, this test won't reproduce the problem. I'm thinking that, perhaps, we don't need a test for this fix at all. Seems more trouble then worth it.
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.
Yes actually I had changed it because when I used the file name as the test name I got this error when running the test:
velox/cmake-build-debug/_deps/gtest-src/googletest/src/gtest.cc:2520: Failure
Failed
All tests in the same test suite must use the same test fixture
class, so mixing TEST_F and TEST in the same test suite is
illegal. In test suite ApproxDistinctTest,
test groupByIntegers is defined using TEST_F but
test hyperLogLog is defined using TEST. You probably
want to change the TEST to TEST_F or move it to another test
case.
Apologies for not mentioning this earlier in the comment.
Yes, I agree a test doesn't seem suitable for this fix, reverted the test.
0d6c00f
to
da531cf
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.
@pramodsatya Thank you for the fix.
@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@xiaoxmeng merged this pull request in f340734. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Prefix is not needed to register custom type
HyperLogLog
inApproxDistinctAggregates
.registerHyperLogLogType
is used instead to make registration of customTypeHyperLogLog
uniform across velox.
Use of prefix in
registerCustomType
here resulted in the following error while running testsin presto PR: