[ 
https://issues.apache.org/jira/browse/IMPALA-12811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17819010#comment-17819010
 ] 

ASF subversion and git services commented on IMPALA-12811:
----------------------------------------------------------

Commit 87212d791b5db2122f2f5d32369dc542bddcea3a in impala's branch 
refs/heads/master from Zoltan Borok-Nagy
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=87212d791 ]

IMPALA-12811: Exception during re-analyze can be lost

When there is an AnalysisException during re-analyze, we try to print
the re-written and original statements via invoking toSql() on them.
But toSql() fails because the analysis of the statement was incomplete,
so it throws another exception (typically an IllegalStateException
without any relevant information about the original issue).

This patch puts the original LOG.error() in a try-catch, then wraps the
original AnalysisException into a new exception that just mentions that
the error occurred after query rewrite.

Testing:
 * added a column masking test with an invalid masking function

Change-Id: Ie6e36b08703c07a2a8d68a4ec0e8ddd65ba03199
Reviewed-on: http://gerrit.cloudera.org:8080/21037
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Exception during re-analyze can be lost
> ---------------------------------------
>
>                 Key: IMPALA-12811
>                 URL: https://issues.apache.org/jira/browse/IMPALA-12811
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>            Reporter: Zoltán Borók-Nagy
>            Assignee: Zoltán Borók-Nagy
>            Priority: Major
>
> The problem is that while we handle an exception, we throw another:
> {noformat}
>     } catch (AnalysisException e) {
>       LOG.error(String.format("Error analyzing the rewritten query.\n" +
>           "Original SQL: %s\nRewritten SQL: %s", 
> analysisResult_.stmt_.toSql(),   // <== toSql() throws another exception, so 
> we lose the original one
>           analysisResult_.stmt_.toSql(REWRITTEN)), e);
>       throw e;
>     }
> {noformat}
> https://github.com/apache/impala/blob/49d37cfef2e1aef611330489082e12e3c0c63347/fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java#L649
> Statement.toSql() assumes that the statement is analyzed, but here we are 
> handling an AnalysisException, so there's good chance that the analysis of 
> statement failed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to