Hello Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/24004

to look at the new patch set (#2).

Change subject: IMPALA-14741: [WIP] Remove the SQL comments from redacted_stmt 
of TClientRequest
......................................................................

IMPALA-14741: [WIP] Remove the SQL comments from redacted_stmt of
TClientRequest

This patch removes the SQL comments from redacted_stmt of TClientRequest
by calling toSql() of the StatementBase generated by the parser of
Impala's classic frontend so that we could guarantee that the resulting
redacted_stmt could still be a valid SQL statement.

Approaches that remove SQL comments via regular expression do not work
in some cases like the one in the following. Specifically, if we try to
find a match with the pattern "--\s.*$", then the "--" inside the quotes
will also be removed.

create table lineage_test_db.foo as
select '-- abcde' from lineage_test_db.source_tbl_01;

Writing a separate function to remove the SQL comments could work, but
this approach would be a bit fragile, and we are reinventing the wheel
if we decide to do so. Note that we would also have to deal with the
case when a hint is encountered.

However, currently there are some tests that rely on the fact that
redacted_stmt is simply the result of us replacing each newline with a
space in 'stmt' of TClientRequest, e.g., those in test_otel_trace.py.
Hence, there is still some plumbing to do if we'd really like to make
redacted_stmt a valid SQL statement after removing the SQL comments.

Change-Id: I5ab1bfdcb4cb1793274924288cd52eaa205025dd
---
M be/src/service/frontend.cc
M be/src/service/frontend.h
M be/src/service/impala-server.cc
M fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java
M fe/src/main/java/org/apache/impala/analysis/ToSqlOptions.java
M fe/src/main/java/org/apache/impala/analysis/ToSqlUtils.java
M fe/src/main/java/org/apache/impala/service/Frontend.java
M fe/src/main/java/org/apache/impala/service/JniFrontend.java
8 files changed, 50 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/04/24004/2
--
To view, visit http://gerrit.cloudera.org:8080/24004
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5ab1bfdcb4cb1793274924288cd52eaa205025dd
Gerrit-Change-Number: 24004
Gerrit-PatchSet: 2
Gerrit-Owner: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>

Reply via email to