You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2022/12/06 04:27:40 UTC

[impala] 02/02: IMPALA-11744: Table mask view should preserve the original column order in Hive

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

commit 367378438f8a780cb44cf904e3d449165fdc190e
Author: stiga-huang <hu...@gmail.com>
AuthorDate: Fri Nov 25 09:22:30 2022 +0800

    IMPALA-11744: Table mask view should preserve the original column order in Hive
    
    Ranger provides column masking and row filtering policies to mask
    sensitive data for specific users/groups. When a table should be masked
    in a query, Impala replaces it with a table mask view that exposes the
    columns with masked expressions.
    
    After IMPALA-9661, only selected columns are exposed in the table mask
    view. However, the columns of the view are exposed in the order that
    they are registered. If the registering order differs from the column
    order in the table, STAR expansions will mismatch the columns.
    
    To be specific, let's say table 'tbl' with 3 columns a, b, c should be
    masked in the following query:
      select b, * from tbl;
    Ideally Impala should replace the TableRef of 'tbl' with a table mask
    view as:
      select b, * from (
        select mask(a) a, mask(b) b, mask(c) c from tbl
      ) t;
    
    Currently, the rewritten query is
      select b, * from (
        select mask(b) b, mask(a) a, mask(c) c from tbl
      ) t;
    This incorrectly expands the STAR as "b, a, c" in the re-analyze phase.
    
    The cause is that column 'b' is registered earlier than all other
    columns. This patch fixes it by sorting the selected columns based on
    their original order in the table.
    
    Tests:
     - Add tests for selecting STAR with normal columns on table and view.
    
    Change-Id: Ic83d78312b19fa2c5ab88ac4f359bfabaeaabce6
    Reviewed-on: http://gerrit.cloudera.org:8080/19279
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../java/org/apache/impala/analysis/Analyzer.java  |  10 +-
 .../org/apache/impala/analysis/InlineViewRef.java  |   5 +
 .../java/org/apache/impala/analysis/TableRef.java  |  33 ++-
 .../queries/QueryTest/ranger_column_masking.test   | 246 +++++++++++++++++++++
 .../ranger_column_masking_and_row_filtering.test   |  88 ++++++++
 .../queries/QueryTest/ranger_row_filtering.test    |  98 ++++++++
 6 files changed, 474 insertions(+), 6 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/analysis/Analyzer.java b/fe/src/main/java/org/apache/impala/analysis/Analyzer.java
index d85218be8..0ef130ef0 100644
--- a/fe/src/main/java/org/apache/impala/analysis/Analyzer.java
+++ b/fe/src/main/java/org/apache/impala/analysis/Analyzer.java
@@ -30,7 +30,6 @@ import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.function.Function;
 
@@ -939,7 +938,10 @@ public class Analyzer {
       dbName = resolvedTableRef.getTable().getDb().getName();
       tblName = resolvedTableRef.getTable().getName();
     }
-    List<Column> columns = resolvedTableRef.getColumns();
+    // The selected columns should be in the same relative order as they are in the
+    // corresponding Hive table so that the order of the SelectListItem's in the
+    // table mask view (if needs masking or filtering) would be correct.
+    List<Column> columns = resolvedTableRef.getSelectedColumnsInHiveOrder();
     TableMask tableMask = new TableMask(authChecker, dbName, tblName, columns, user_);
     try {
       if (resolvedTableRef instanceof CollectionTableRef) {
@@ -1609,7 +1611,9 @@ public class Analyzer {
   }
 
   /**
-   * Register scalar columns. Used in resolving column mask.
+   * Register columns for resolving column mask. The order in which columns are registered
+   * is not necessarily the same as the relative order of those columns in the
+   * corresponding Hive table.
    */
   public void registerColumnForMasking(SlotDescriptor slotDesc) {
     Preconditions.checkNotNull(slotDesc.getPath());
diff --git a/fe/src/main/java/org/apache/impala/analysis/InlineViewRef.java b/fe/src/main/java/org/apache/impala/analysis/InlineViewRef.java
index 7a233eb5f..38c9508b5 100644
--- a/fe/src/main/java/org/apache/impala/analysis/InlineViewRef.java
+++ b/fe/src/main/java/org/apache/impala/analysis/InlineViewRef.java
@@ -556,6 +556,11 @@ public class InlineViewRef extends TableRef {
     return queryStmt_.getColLabels();
   }
 
+  @Override
+  public List<Column> getColumnsInHiveOrder() {
+    return view_.getColumnsInHiveOrder();
+  }
+
   public FeView getView() { return view_; }
 
   public boolean isTableMaskingView() { return isTableMaskingView_; }
diff --git a/fe/src/main/java/org/apache/impala/analysis/TableRef.java b/fe/src/main/java/org/apache/impala/analysis/TableRef.java
index ed3d813df..ad6df20c0 100644
--- a/fe/src/main/java/org/apache/impala/analysis/TableRef.java
+++ b/fe/src/main/java/org/apache/impala/analysis/TableRef.java
@@ -21,6 +21,7 @@ import static org.apache.impala.analysis.ToSqlOptions.DEFAULT;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -156,7 +157,7 @@ public class TableRef extends StmtNode {
   protected boolean exposeNestedColumnsByTableMaskView_ = false;
 
   // Columns referenced in the query. Used in resolving column mask.
-  protected Map<String, Column> columns_ = new LinkedHashMap<>();
+  protected Map<String, Column> columns_ = new HashMap<>();
 
   // Time travel spec of this table ref. It contains information specified in the
   // FOR SYSTEM_TIME AS OF <timestamp> or FOR SYSTEM_TIME AS OF <version> clause.
@@ -778,8 +779,34 @@ public class TableRef extends StmtNode {
     columns_.put(column.getName(), column);
   }
 
-  public List<Column> getColumns() {
-    return new ArrayList<>(columns_.values());
+  /**
+   * @return an unmodifiable list of all columns, but with partition columns at the end of
+   * the list rather than the beginning. This is equivalent to the order in which Hive
+   * enumerates columns.
+   */
+  public List<Column> getColumnsInHiveOrder() {
+    return getTable().getColumnsInHiveOrder();
+  }
+
+  public List<Column> getSelectedColumnsInHiveOrder() {
+    // Map from column name to the Column object (null if not selected).
+    // Use LinkedHashMap to preserve the order.
+    Map<String, Column> colSelection = new LinkedHashMap<>();
+    for (Column c : getColumnsInHiveOrder()) {
+      colSelection.put(c.getName(), null);
+    }
+    // Update 'colSelection' with selected columns. Virtual columns will also be added.
+    for (String colName : columns_.keySet()) {
+      colSelection.put(colName, columns_.get(colName));
+    }
+    List<Column> res = new ArrayList<>();
+    for (Column c : colSelection.values()) {
+      if (c != null) res.add(c);
+    }
+    // Make sure not missing any columns
+    Preconditions.checkState(res.size() == columns_.size(),
+        "missing columns: " + res.size() + " != " + columns_.size());
+    return res;
   }
 
   void migratePropertiesTo(TableRef other) {
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 97c3f8175..d23961010 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking.test
@@ -75,6 +75,111 @@ select * from functional.alltypestiny t
 INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
 ====
 ---- QUERY
+# Test on star select item with other columns
+select int_col, * from functional.alltypestiny
+---- RESULTS
+0,0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1
+1,100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1
+0,200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2
+1,300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2
+0,400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3
+1,500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3
+0,600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4
+1,700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4
+---- TYPES
+INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+select string_col, * from functional.alltypestiny
+---- RESULTS
+'0aaa',0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1
+'1aaa',100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1
+'0aaa',200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2
+'1aaa',300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2
+'0aaa',400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3
+'1aaa',500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3
+'0aaa',600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4
+'1aaa',700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+select string_col, month, * from functional.alltypestiny
+---- RESULTS
+'0aaa',1,0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1
+'1aaa',1,100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1
+'0aaa',2,200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2
+'1aaa',2,300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2
+'0aaa',3,400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3
+'1aaa',3,500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3
+'0aaa',4,600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4
+'1aaa',4,700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4
+---- TYPES
+STRING,INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+select *, int_col from functional.alltypestiny
+---- RESULTS
+0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1,0
+100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1,1
+200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2,0
+300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2,1
+400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3,0
+500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3,1
+600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4,0
+700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4,1
+---- TYPES
+INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+select *, string_col from functional.alltypestiny
+---- RESULTS
+0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1,'0aaa'
+100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1,'1aaa'
+200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2,'0aaa'
+300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2,'1aaa'
+400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3,'0aaa'
+500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3,'1aaa'
+600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4,'0aaa'
+700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4,'1aaa'
+---- TYPES
+INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,STRING
+====
+---- QUERY
+# Test on star select item with other columns
+select string_col, *, int_col from functional.alltypestiny
+---- RESULTS
+'0aaa',0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1,0
+'1aaa',100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1,1
+'0aaa',200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2,0
+'1aaa',300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2,1
+'0aaa',400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3,0
+'1aaa',500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3,1
+'0aaa',600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4,0
+'1aaa',700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4,1
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+select string_col, *, month, *, int_col from functional.alltypestiny
+---- RESULTS
+'0aaa',0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1,1,0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1,0
+'1aaa',100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1,1,100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1,1
+'0aaa',200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2,2,200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2,0
+'1aaa',300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2,2,300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2,1
+'0aaa',400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3,3,400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3,0
+'1aaa',500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3,3,500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3,1
+'0aaa',600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4,4,600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4,0
+'1aaa',700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4,4,700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4,1
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
 # Test on predicate. Should evaluate on masked values.
 select * from functional.alltypestiny where id = 1
 ---- RESULTS
@@ -215,6 +320,132 @@ order by id limit 10
 INT,BOOLEAN,INT,STRING
 ====
 ---- QUERY
+# Test on star select item with other columns on view
+select int_col, * from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+0,0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1
+1,100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1
+2,200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1
+3,300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1
+4,400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1
+5,500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1
+6,600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1
+7,700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1
+8,800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1
+9,900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1
+---- TYPES
+INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns on view
+select string_col, * from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+'vvv0ttt',0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1
+'vvv1ttt',100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1
+'vvv2ttt',200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1
+'vvv3ttt',300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1
+'vvv4ttt',400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1
+'vvv5ttt',500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1
+'vvv6ttt',600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1
+'vvv7ttt',700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1
+'vvv8ttt',800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1
+'vvv9ttt',900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns on view
+select string_col, month, * from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+'vvv0ttt',1,0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1
+'vvv1ttt',1,100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1
+'vvv2ttt',1,200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1
+'vvv3ttt',1,300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1
+'vvv4ttt',1,400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1
+'vvv5ttt',1,500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1
+'vvv6ttt',1,600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1
+'vvv7ttt',1,700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1
+'vvv8ttt',1,800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1
+'vvv9ttt',1,900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1
+---- TYPES
+STRING,INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns on view
+select *, int_col from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1,0
+100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1,1
+200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1,2
+300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1,3
+400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1,4
+500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1,5
+600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1,6
+700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1,7
+800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1,8
+900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1,9
+---- TYPES
+INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns on view
+select *, string_col from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1,'vvv0ttt'
+100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1,'vvv1ttt'
+200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1,'vvv2ttt'
+300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1,'vvv3ttt'
+400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1,'vvv4ttt'
+500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1,'vvv5ttt'
+600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1,'vvv6ttt'
+700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1,'vvv7ttt'
+800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1,'vvv8ttt'
+900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1,'vvv9ttt'
+---- TYPES
+INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,STRING
+====
+---- QUERY
+# Test on star select item with other columns on view
+select string_col, *, int_col from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+'vvv0ttt',0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1,0
+'vvv1ttt',100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1,1
+'vvv2ttt',200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1,2
+'vvv3ttt',300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1,3
+'vvv4ttt',400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1,4
+'vvv5ttt',500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1,5
+'vvv6ttt',600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1,6
+'vvv7ttt',700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1,7
+'vvv8ttt',800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1,8
+'vvv9ttt',900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1,9
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns on view
+select string_col, *, month, *, int_col from functional.alltypes_view
+order by id limit 10
+---- RESULTS
+'vvv0ttt',0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1,1,0,true,0,0,0,0,0.0,0.0,'01/01/09','vvv0ttt',2009-01-01 00:00:00,2009,1,0
+'vvv1ttt',100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1,1,100,false,1,1,1,10,1.10000002384,10.1,'01/01/09','vvv1ttt',2009-01-01 00:01:00,2009,1,1
+'vvv2ttt',200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1,1,200,true,2,2,2,20,2.20000004768,20.2,'01/01/09','vvv2ttt',2009-01-01 00:02:00.100000000,2009,1,2
+'vvv3ttt',300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1,1,300,false,3,3,3,30,3.29999995232,30.3,'01/01/09','vvv3ttt',2009-01-01 00:03:00.300000000,2009,1,3
+'vvv4ttt',400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1,1,400,true,4,4,4,40,4.40000009537,40.4,'01/01/09','vvv4ttt',2009-01-01 00:04:00.600000000,2009,1,4
+'vvv5ttt',500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1,1,500,false,5,5,5,50,5.5,50.5,'01/01/09','vvv5ttt',2009-01-01 00:05:00.100000000,2009,1,5
+'vvv6ttt',600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1,1,600,true,6,6,6,60,6.59999990463,60.6,'01/01/09','vvv6ttt',2009-01-01 00:06:00.150000000,2009,1,6
+'vvv7ttt',700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1,1,700,false,7,7,7,70,7.69999980927,70.7,'01/01/09','vvv7ttt',2009-01-01 00:07:00.210000000,2009,1,7
+'vvv8ttt',800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1,1,800,true,8,8,8,80,8.80000019073,80.8,'01/01/09','vvv8ttt',2009-01-01 00:08:00.280000000,2009,1,8
+'vvv9ttt',900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1,1,900,false,9,9,9,90,9.89999961853,90.9,'01/01/09','vvv9ttt',2009-01-01 00:09:00.360000000,2009,1,9
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
 # Test on local view (CTE). Correctly ignore masking on local view names so the result
 # won't be 100 (affected by policy id => id * 100).
 use functional;
@@ -448,6 +679,21 @@ regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090401.txt',700,NULL,1,1
 STRING, INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP, INT, INT
 ====
 ---- QUERY
+# Select masked INPUT_FILE__NAME plus all cols
+select int_col, input__file__name, * from alltypestiny order by id;
+---- RESULTS
+0,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090101.txt',0,NULL,0,0,0,0,0,0,'01/01/09','0aaa',2009-01-01 00:00:00,2009,1
+1,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090101.txt',100,NULL,1,1,1,10,1.100000023841858,10.1,'01/01/09','1aaa',2009-01-01 00:01:00,2009,1
+0,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090201.txt',200,NULL,0,0,0,0,0,0,'02/01/09','0aaa',2009-02-01 00:00:00,2009,2
+1,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090201.txt',300,NULL,1,1,1,10,1.100000023841858,10.1,'02/01/09','1aaa',2009-02-01 00:01:00,2009,2
+0,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090301.txt',400,NULL,0,0,0,0,0,0,'03/01/09','0aaa',2009-03-01 00:00:00,2009,3
+1,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090301.txt',500,NULL,1,1,1,10,1.100000023841858,10.1,'03/01/09','1aaa',2009-03-01 00:01:00,2009,3
+0,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090401.txt',600,NULL,0,0,0,0,0,0,'04/01/09','0aaa',2009-04-01 00:00:00,2009,4
+1,regex:'.*/xxxx-xxxxxxxxx/xxxxxxxxxxxx/xxxx=xxxx/xxxxx=x/090401.txt',700,NULL,1,1,1,10,1.100000023841858,10.1,'04/01/09','1aaa',2009-04-01 00:01:00,2009,4
+---- TYPES
+INT, STRING, INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP, INT, INT
+====
+---- QUERY
 # Select masked INPUT_FILE__NAME plus a few cols
 select input__file__name, id, bool_col from alltypestiny order by id;
 ---- RESULTS
diff --git a/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking_and_row_filtering.test b/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking_and_row_filtering.test
index 848ad4fd2..0b8eec575 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking_and_row_filtering.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/ranger_column_masking_and_row_filtering.test
@@ -14,6 +14,46 @@ from functional.alltypestiny
 INT,BOOLEAN,INT,STRING,STRING,INT,INT
 ====
 ---- QUERY
+# Test on star select item
+select * from functional.alltypestiny
+---- RESULTS
+100,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-01-01 00:00:00,2009,1
+103,false,1,1,1,10,1.100000023841858,10.1,'nn/nn/nn','NULL',2009-02-01 00:01:00,2009,2
+106,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-04-01 00:00:00,2009,4
+---- TYPES
+INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select int_col, * from functional.alltypestiny
+---- RESULTS
+0,100,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-01-01 00:00:00,2009,1
+1,103,false,1,1,1,10,1.100000023841858,10.1,'nn/nn/nn','NULL',2009-02-01 00:01:00,2009,2
+0,106,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-04-01 00:00:00,2009,4
+---- TYPES
+INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select string_col, * from functional.alltypestiny
+---- RESULTS
+'NULL',100,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-01-01 00:00:00,2009,1
+'NULL',103,false,1,1,1,10,1.100000023841858,10.1,'nn/nn/nn','NULL',2009-02-01 00:01:00,2009,2
+'NULL',106,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-04-01 00:00:00,2009,4
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select string_col, *, int_col from functional.alltypestiny
+---- RESULTS
+'NULL',100,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-01-01 00:00:00,2009,1,0
+'NULL',103,false,1,1,1,10,1.100000023841858,10.1,'nn/nn/nn','NULL',2009-02-01 00:01:00,2009,2,1
+'NULL',106,true,0,0,0,0,0,0,'nn/nn/nn','NULL',2009-04-01 00:00:00,2009,4,0
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
 # Column-masking policies of functional.alltypes mask "id" to "-id" and redact column
 # "date_string_col". Row-filtering policy of functional.alltypes_view keeps rows with
 # "id >= -8 and date_string_col = 'nn/nn/nn'". functional.alltypes_view is a view based
@@ -34,6 +74,54 @@ select id, bool_col, date_string_col, year, month from functional.alltypes_view
 INT,BOOLEAN,STRING,INT,INT
 ====
 ---- QUERY
+# Test on star select item with normal columns
+select int_col, * from functional.alltypes_view
+---- RESULTS
+0,0,true,0,0,0,0,0.0,0.0,'nn/nn/nn','0',2009-01-01 00:00:00,2009,1
+1,-1,false,1,1,1,10,1.10000002384,10.1,'nn/nn/nn','1',2009-01-01 00:01:00,2009,1
+2,-2,true,2,2,2,20,2.20000004768,20.2,'nn/nn/nn','2',2009-01-01 00:02:00.100000000,2009,1
+3,-3,false,3,3,3,30,3.29999995232,30.3,'nn/nn/nn','3',2009-01-01 00:03:00.300000000,2009,1
+4,-4,true,4,4,4,40,4.40000009537,40.4,'nn/nn/nn','4',2009-01-01 00:04:00.600000000,2009,1
+5,-5,false,5,5,5,50,5.5,50.5,'nn/nn/nn','5',2009-01-01 00:05:00.100000000,2009,1
+6,-6,true,6,6,6,60,6.59999990463,60.6,'nn/nn/nn','6',2009-01-01 00:06:00.150000000,2009,1
+7,-7,false,7,7,7,70,7.69999980927,70.7,'nn/nn/nn','7',2009-01-01 00:07:00.210000000,2009,1
+8,-8,true,8,8,8,80,8.80000019073,80.8,'nn/nn/nn','8',2009-01-01 00:08:00.280000000,2009,1
+---- TYPES
+INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select string_col, * from functional.alltypes_view
+---- RESULTS
+'0',0,true,0,0,0,0,0.0,0.0,'nn/nn/nn','0',2009-01-01 00:00:00,2009,1
+'1',-1,false,1,1,1,10,1.10000002384,10.1,'nn/nn/nn','1',2009-01-01 00:01:00,2009,1
+'2',-2,true,2,2,2,20,2.20000004768,20.2,'nn/nn/nn','2',2009-01-01 00:02:00.100000000,2009,1
+'3',-3,false,3,3,3,30,3.29999995232,30.3,'nn/nn/nn','3',2009-01-01 00:03:00.300000000,2009,1
+'4',-4,true,4,4,4,40,4.40000009537,40.4,'nn/nn/nn','4',2009-01-01 00:04:00.600000000,2009,1
+'5',-5,false,5,5,5,50,5.5,50.5,'nn/nn/nn','5',2009-01-01 00:05:00.100000000,2009,1
+'6',-6,true,6,6,6,60,6.59999990463,60.6,'nn/nn/nn','6',2009-01-01 00:06:00.150000000,2009,1
+'7',-7,false,7,7,7,70,7.69999980927,70.7,'nn/nn/nn','7',2009-01-01 00:07:00.210000000,2009,1
+'8',-8,true,8,8,8,80,8.80000019073,80.8,'nn/nn/nn','8',2009-01-01 00:08:00.280000000,2009,1
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select string_col, *, int_col from functional.alltypes_view
+---- RESULTS
+'0',0,true,0,0,0,0,0.0,0.0,'nn/nn/nn','0',2009-01-01 00:00:00,2009,1,0
+'1',-1,false,1,1,1,10,1.10000002384,10.1,'nn/nn/nn','1',2009-01-01 00:01:00,2009,1,1
+'2',-2,true,2,2,2,20,2.20000004768,20.2,'nn/nn/nn','2',2009-01-01 00:02:00.100000000,2009,1,2
+'3',-3,false,3,3,3,30,3.29999995232,30.3,'nn/nn/nn','3',2009-01-01 00:03:00.300000000,2009,1,3
+'4',-4,true,4,4,4,40,4.40000009537,40.4,'nn/nn/nn','4',2009-01-01 00:04:00.600000000,2009,1,4
+'5',-5,false,5,5,5,50,5.5,50.5,'nn/nn/nn','5',2009-01-01 00:05:00.100000000,2009,1,5
+'6',-6,true,6,6,6,60,6.59999990463,60.6,'nn/nn/nn','6',2009-01-01 00:06:00.150000000,2009,1,6
+'7',-7,false,7,7,7,70,7.69999980927,70.7,'nn/nn/nn','7',2009-01-01 00:07:00.210000000,2009,1,7
+'8',-8,true,8,8,8,80,8.80000019073,80.8,'nn/nn/nn','8',2009-01-01 00:08:00.280000000,2009,1,8
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
 # Test with expr rewrite rules.
 select id, bool_col, string_col,
   if (id <=> id, 0, 1),
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 c1ef6b99a..c303ec362 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/ranger_row_filtering.test
@@ -11,6 +11,54 @@ select * from functional.alltypestiny
 INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
 ====
 ---- QUERY
+# Test on star select item with other columns
+# Row-filtering policy keeps rows with "id % 2 = 0"
+select int_col, * from functional.alltypestiny
+---- RESULTS
+0,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1
+0,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2
+0,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3
+0,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4
+---- TYPES
+INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+# Row-filtering policy keeps rows with "id % 2 = 0"
+select string_col, * from functional.alltypestiny
+---- RESULTS
+'0',0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1
+'0',2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2
+'0',4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3
+'0',6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+# Row-filtering policy keeps rows with "id % 2 = 0"
+select string_col, *, int_col from functional.alltypestiny
+---- RESULTS
+'0',0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1,0
+'0',2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2,0
+'0',4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3,0
+'0',6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4,0
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
+# Test on star select item with other columns
+# Row-filtering policy keeps rows with "id % 2 = 0"
+select string_col, *, month, *, int_col from functional.alltypestiny
+---- RESULTS
+'0',0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1,0
+'0',2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2,0
+'0',4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3,0
+'0',6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4,0
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
 # Row-filtering policy keeps rows with
 # "(string_col = '0' and id <= 0) or (string_col = '1' and bool_col = true and id > 90)"
 select id, string_col, bool_col, year, month from functional.alltypessmall
@@ -232,6 +280,56 @@ from functional.alltypes_view where id % 2 = 0
 INT,BOOLEAN,INT,STRING,STRING,INT,INT
 ====
 ---- QUERY
+# Test on star select item
+# Row-filtering policy on the view keeps rows with "id < 5". Row-filtering policy on the
+# underlying table 'alltypes' keeps rows with "year = 2009 and month = 1".
+select * from functional.alltypes_view
+---- RESULTS
+0,true,0,0,0,0,0.0,0.0,'01/01/09','0',2009-01-01 00:00:00,2009,1
+1,false,1,1,1,10,1.10000002384,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1
+2,true,2,2,2,20,2.20000004768,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1
+3,false,3,3,3,30,3.29999995232,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000,2009,1
+4,true,4,4,4,40,4.40000009537,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1
+---- TYPES
+INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select int_col, * from functional.alltypes_view
+---- RESULTS
+0,0,true,0,0,0,0,0.0,0.0,'01/01/09','0',2009-01-01 00:00:00,2009,1
+1,1,false,1,1,1,10,1.10000002384,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1
+2,2,true,2,2,2,20,2.20000004768,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1
+3,3,false,3,3,3,30,3.29999995232,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000,2009,1
+4,4,true,4,4,4,40,4.40000009537,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1
+---- TYPES
+INT,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select string_col, * from functional.alltypes_view
+---- RESULTS
+'0',0,true,0,0,0,0,0.0,0.0,'01/01/09','0',2009-01-01 00:00:00,2009,1
+'1',1,false,1,1,1,10,1.10000002384,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1
+'2',2,true,2,2,2,20,2.20000004768,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1
+'3',3,false,3,3,3,30,3.29999995232,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000,2009,1
+'4',4,true,4,4,4,40,4.40000009537,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT
+====
+---- QUERY
+# Test on star select item with normal columns
+select string_col, *, int_col from functional.alltypes_view
+---- RESULTS
+'0',0,true,0,0,0,0,0.0,0.0,'01/01/09','0',2009-01-01 00:00:00,2009,1,0
+'1',1,false,1,1,1,10,1.10000002384,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1,1
+'2',2,true,2,2,2,20,2.20000004768,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1,2
+'3',3,false,3,3,3,30,3.29999995232,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000,2009,1,3
+'4',4,true,4,4,4,40,4.40000009537,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1,4
+---- TYPES
+STRING,INT,BOOLEAN,TINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE,STRING,STRING,TIMESTAMP,INT,INT,INT
+====
+---- QUERY
 # The query has no results since the where-clause is the opposite of the row-filter expr.
 select * from functional.alltypes_view where id >= 5
 ---- RESULTS