Better error message when theta_sketch_intersect is used on scalar expression (#13508)

This commit is contained in:
Abhishek Agarwal 2022-12-07 09:35:43 +05:30 committed by GitHub
parent 37d8833125
commit b25cf216d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,8 @@ public abstract class ThetaSketchSetBaseOperatorConversion implements SqlOperato
RexNode rexNode
)
{
plannerContext.setPlanningError("%s can only be used on aggregates. " +
"It cannot be used directly on a column or on a scalar expression.", getFunctionName());
return null;
}

View File

@ -1014,4 +1014,12 @@ public class ThetaSketchSqlAggregatorTest extends BaseCalciteQueryTest
ImmutableList.of(new Object[]{"a", 0L, 0L, "0.0", "0.0"})
);
}
@Test
public void testThetaSketchIntersectOnScalarExpression()
{
assertQueryIsUnplannable("SELECT THETA_SKETCH_INTERSECT(NULL, NULL) FROM foo",
"Possible error: THETA_SKETCH_INTERSECT can only be used on aggregates. " +
"It cannot be used directly on a column or on a scalar expression.");
}
}