clintropolis commented on a change in pull request #12033:
URL: https://github.com/apache/druid/pull/12033#discussion_r764601254
##########
File path:
sql/src/test/java/org/apache/druid/sql/calcite/CalciteJoinQueryTest.java
##########
@@ -3122,23 +3121,8 @@ public void
testInnerJoinOnTwoInlineDataSources_withLeftDirectAccess(Map<String,
@Parameters(source = QueryContextForJoinProvider.class)
public void testJoinOnConstantShouldFail(Map<String, Object> queryContext)
throws Exception
{
- cannotVectorize();
-
- final String query = "SELECT t1.dim1 from foo as t1 LEFT JOIN foo as t2 on
t1.dim1 = '10.1'";
-
- try {
- testQuery(
- query,
- queryContext,
- ImmutableList.of(),
- ImmutableList.of()
- );
- }
- catch (RelOptPlanner.CannotPlanException cpe) {
- Assert.assertEquals(cpe.getMessage(), "Possible error: SQL is resulting
in a join that have unsupported operand types.");
- return;
- }
- Assert.fail("Expected an exception of type: " +
RelOptPlanner.CannotPlanException.class);
+ assertQueryIsUnplannable("SELECT t1.dim1 from foo as t1 LEFT JOIN foo as
t2 on t1.dim1 = '10.1'",
+ "Possible error: SQL is resulting in a join that have unsupported
operand types.");
Review comment:
nit: i know this isn't new, but this error message should maybe be "...
in a join that _has_ unsupported operand ..." or "SQL has join conditions that
have unsupported operand types." or something
##########
File path: sql/src/main/java/org/apache/druid/sql/http/SqlResource.java
##########
@@ -205,22 +205,20 @@ public Response doPost(
throw (ForbiddenException)
serverConfig.getErrorResponseTransformStrategy()
.transformIfNeeded(e); // let
ForbiddenExceptionMapper handle this
}
+ catch (RelOptPlanner.CannotPlanException e) {
+ endLifecycle(sqlQueryId, lifecycle, e, remoteAddr, -1);
+ SqlPlanningException spe = new
SqlPlanningException(SqlPlanningException.PlanningError.UNSUPPORTED_SQL_ERROR,
+ e.getMessage());
+ return buildNonOkResponse(BadQueryException.STATUS_CODE, spe,
sqlQueryId);
Review comment:
i had to think a bit on this because I was a bit torn. One the one hand,
it's not necessarily the users fault that we don't support some SQL syntax they
might have tried so a server error seems fair in that sense, but on the other
hand being a client error might inspire the user to try to rewrite their query
where a server error might not, so I've come around to being :+1: on this
--
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]