IMPALA-14405 ADDENDUM: Catch exception for bad column names

This commit is a fix on top of IMPALA-14405 for the Calcite
planner. The original commit matches column names from the
expression in the select clause.

For instance, if the query is "select 1 + 1", the label in
impala-shell will be "1 + 1". It accomplished this by
retrieving the string from the SqlNode object through the
MySql dialect.

However, when the expression doesn't succeed in the MySql
dialect, an AssertionError gets thrown, causing the query to
fail. We don't want the query to fail, we just want to go
back to using the Calcite expression, e.g. EXPR$0. This
occurred with this specific query:

"select timestamp_col + interval 3 nanoseconds"

So now the exception is caught and the default label name
is used. Eventually we should try to match what Impala has,
but this is a harder problem to fix.

Change-Id: I6c4d76a25fb2486eb1ef19485bce7888d45d282f
Reviewed-on: http://gerrit.cloudera.org:8080/23665
Reviewed-by: Riza Suminto <riza.suminto@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Steve Carlin <scarlin@cloudera.com>
This commit is contained in:
Steve Carlin
2025-11-05 06:31:20 -08:00
parent 454cb07e7c
commit 54c0074b33
2 changed files with 21 additions and 6 deletions

View File

@@ -1122,6 +1122,14 @@ int
row_regex: .*PlannerType: CalcitePlanner.*
====
---- QUERY
# IMPALA-14561: Should not be using MySqlDialect to capture labels
select timestamp_col + interval 3 milliseconds from functional.alltypestiny;
---- LABELS
expr$0
---- RUNTIME_PROFILE
row_regex: .*PlannerType: CalcitePlanner.*
====
---- QUERY
select cast('nan' as double), cast('inf' as float);
---- RESULTS
NaN,Inf