Akshat-Jain commented on code in PR #16682:
URL: https://github.com/apache/druid/pull/16682#discussion_r1672675098
##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/sql/HllSketchSqlAggregatorTest.java:
##########
@@ -508,6 +524,33 @@ public void testApproxCountDistinctHllSketchIsRounded()
);
}
+ @Test
+ public void testApproxCountDistinctOnUnsupportedComplexColumn()
+ {
+ try {
+ testQuery("SELECT COUNT(distinct double_first_added) FROM
druid.wikipedia_first_last", ImmutableList.of(), ImmutableList.of());
+ Assert.fail("query planning should fail");
Review Comment:
I've used `assertQueryIsUnplannable` in
`testApproxCountDistinctOnUnsupportedComplexColumn`, it's certainly much
cleaner. But using it in
`testApproxCountDistinctFunctionOnUnsupportedComplexColumn` gives the following
error:
```
Expected: (message: a string containing "Cannot apply
'APPROX_COUNT_DISTINCT' to arguments of type
'APPROX_COUNT_DISTINCT(<COMPLEX<JSON>>)'" and targetPersona: is <ADMIN> and
category: is <INVALID_INPUT> and errorCode: is "general")
but: targetPersona: is <ADMIN> was <USER>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
at
org.apache.druid.sql.calcite.BaseCalciteQueryTest.assertQueryIsUnplannable(BaseCalciteQueryTest.java:655)
at
org.apache.druid.sql.calcite.BaseCalciteQueryTest.assertQueryIsUnplannable(BaseCalciteQueryTest.java:646)
at
org.apache.druid.sql.calcite.CalciteNestedDataQueryTest.testApproxCountDistinctFunctionOnUnsupportedComplexColumn(CalciteNestedDataQueryTest.java:7338)
```
So I've kept `testApproxCountDistinctFunctionOnUnsupportedComplexColumn` as
it is. My guess is the difference comes from the fact that this error is thrown
internally by Calcite (via the SQL operand type checker layer), hence somehow
gets assigned the admin persona, which doesn't sit right with the way the
BaseCalciteQueryTest assertions are wired.
Hope that works.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]