deepthi912 commented on code in PR #17047:
URL: https://github.com/apache/pinot/pull/17047#discussion_r2450159109
##########
pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java:
##########
@@ -174,12 +177,65 @@ public QueryEnvironment(String database, TableCache
tableCache, @Nullable Worker
.build());
}
+ /**
+ * Recursively checks if the SqlNode contains a NATURAL JOIN.
+ */
+ private boolean isNaturalJoinQuery(SqlNode sqlNode) {
+ if (sqlNode == null) {
+ return false;
+ }
+ if (sqlNode instanceof SqlJoin) {
+ return ((SqlJoin) sqlNode).isNatural();
+ }
+ if (sqlNode instanceof SqlCall) {
+ SqlCall call = (SqlCall) sqlNode;
+ for (SqlNode operand : call.getOperandList()) {
+ if (isNaturalJoinQuery(operand)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Enhances validation error messages for specific scenarios like NATURAL
JOIN issues.
+ * To enhance the error message: Error Code: 700 (QueryValidationError)
+ * QueryValidationError: Index 58 out of bounds for length 54
+ *
+ */
+ private String enhanceNaturalJoinErrorMessage(SqlNode sqlNode, Throwable
originalError,
+ PlannerContext plannerContext) {
+ String originalMessage = originalError.getMessage();
+
+ if (originalError instanceof IndexOutOfBoundsException &&
isNaturalJoinQuery(sqlNode)) {
Review Comment:
Yeah this is a bit hacky. It's better to just remove this error than taping
it just for this use case.
--
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]