This is an automated email from the ASF dual-hosted git repository.

stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 1decfaf60 IMPALA-12247: Add unimplemented methods to ModifyStmt
1decfaf60 is described below

commit 1decfaf6060a2f297b8f5f2c4a34ba5b453872ef
Author: Zoltan Borok-Nagy <[email protected]>
AuthorDate: Tue Jun 27 17:47:18 2023 +0200

    IMPALA-12247: Add unimplemented methods to ModifyStmt
    
    This patch adds the missing method to ModifyStmt.
    
    Testing:
     * added e2e tests
    
    Change-Id: If00b4d9fb7c12b9eb63fe4e4dadbf349b633c31b
    Reviewed-on: http://gerrit.cloudera.org:8080/20127
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 .../org/apache/impala/analysis/ModifyStmt.java     |  5 +++++
 .../queries/QueryTest/ranger_column_masking.test   | 23 ++++++++++++++++++++++
 .../queries/QueryTest/ranger_row_filtering.test    | 19 ++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/fe/src/main/java/org/apache/impala/analysis/ModifyStmt.java 
b/fe/src/main/java/org/apache/impala/analysis/ModifyStmt.java
index 6599fb443..6f0fa3fdd 100644
--- a/fe/src/main/java/org/apache/impala/analysis/ModifyStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/ModifyStmt.java
@@ -199,6 +199,11 @@ public abstract class ModifyStmt extends StatementBase {
     modifyImpl_ = null;
   }
 
+  @Override
+  public boolean resolveTableMask(Analyzer analyzer) throws AnalysisException {
+    return sourceStmt_.resolveTableMask(analyzer);
+  }
+
   /**
    * Builds and validates the sourceStmt_. The select list of the sourceStmt_ 
contains
    * first the SlotRefs for the key Columns, followed by the expressions 
representing the
diff --git 
a/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking.test
 
b/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking.test
index 9f76fc778..50297ae76 100644
--- 
a/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking.test
+++ 
b/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking.test
@@ -662,6 +662,29 @@ select * from $UNIQUE_DB.masked_tbl;
 
INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
 ====
 ---- QUERY
+# Test UPDATE stmt
+create table $UNIQUE_DB.masked_kudu (id int primary key, string_col string) 
stored as kudu;
+insert into $UNIQUE_DB.masked_kudu select id, string_col from alltypestiny;
+insert into $UNIQUE_DB.masked_kudu values (1, NULL), (3, NULL), (5, NULL);
+update k set k.string_col=a.string_col
+from $UNIQUE_DB.masked_kudu k JOIN alltypestiny a ON (k.id=a.id);
+select * from $UNIQUE_DB.masked_kudu;
+---- RESULTS
+0,'0aaa'
+1,'NULL'
+3,'NULL'
+5,'NULL'
+100,'1aaa'
+200,'0aaa'
+300,'1aaa'
+400,'0aaa'
+500,'1aaa'
+600,'0aaa'
+700,'1aaa'
+---- TYPES
+INT, STRING
+====
+---- QUERY
 # Test on CreateView. Should not mask the columns when used in sql generations.
 create view $UNIQUE_DB.masked_view as select * from alltypestiny;
 show create view $UNIQUE_DB.masked_view;
diff --git 
a/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test
 
b/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test
index c303ec362..f13992daf 100644
--- 
a/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test
+++ 
b/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test
@@ -377,6 +377,25 @@ select * from $UNIQUE_DB.masked_tbl;
 
INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
 ====
 ---- QUERY
+# Test UPDATE stmt
+create table $UNIQUE_DB.masked_kudu_tbl(id int primary key, string_col string) 
stored as kudu;
+insert into $UNIQUE_DB.masked_kudu_tbl select id, string_col from 
functional.alltypestiny;
+insert into $UNIQUE_DB.masked_kudu_tbl values (1, NULL), (3, NULL), (5, NULL);
+update k set k.string_col=a.string_col
+from $UNIQUE_DB.masked_kudu_tbl k JOIN functional.alltypestiny a ON 
(k.id=a.id);
+select * from $UNIQUE_DB.masked_kudu_tbl;
+---- RESULTS
+0,'0'
+1,'NULL'
+2,'0'
+3,'NULL'
+4,'0'
+5,'NULL'
+6,'0'
+---- TYPES
+INT, STRING
+====
+---- QUERY
 # Test on SELECT used in INSERT statement
 create table $UNIQUE_DB.masked_tbl2 like functional.alltypestiny stored as 
textfile;
 insert into $UNIQUE_DB.masked_tbl2 partition(year, month) select * from 
functional.alltypestiny;

Reply via email to