soumyakanti3578 commented on code in PR #5798:
URL: https://github.com/apache/hive/pull/5798#discussion_r2082402095


##########
hbase-handler/src/test/results/positive/hbase_queries.q.out:
##########
@@ -151,14 +151,14 @@ STAGE PLANS:
               predicate: UDFToDouble(key) is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE 
Column stats: NONE
               Select Operator
-                expressions: key (type: int)
+                expressions: UDFToDouble(key) (type: double)

Review Comment:
   With this PR, we don't see any virtual columns for the HBase table, whereas 
earlier virtual columns for native tables were getting wrongly added to the 
HBase tables. This affects the plan in the CBO, especially in RelFieldTrimmer.
   
   With the PR, the plan after RelFieldTrimmer is:
   ```
   2025-05-09T12:06:15,305 DEBUG [0de9da36-a1b4-4747-8aa3-b84858aed485 main] 
rules.RelFieldTrimmer: Plan after trimming unused fields
   HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[20])
     HiveProject(key=[$1], value=[$2])
       HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], 
cost=[not available])
         HiveProject(EXPR$0=[CAST($0):DOUBLE])
           HiveFilter(condition=[IS NOT NULL(CAST($0):DOUBLE)])
             HiveProject(key=[$0])
               HiveTableScan(table=[[default, hbase_table_1]], 
table:alias=[hbase_table_1])
         HiveProject(key=[$0], value=[$1], EXPR$0=[CAST($0):DOUBLE])
           HiveFilter(condition=[IS NOT NULL(CAST($0):DOUBLE)])
             HiveProject(key=[$0], value=[$1])
               HiveTableScan(table=[[default, src]], table:alias=[src])
   ```
   whereas earlier the plan was:
   ```
   2025-05-09T12:11:50,457 DEBUG [bd84dbdb-d563-43d7-a012-3132221196b4 main] 
rules.RelFieldTrimmer: Plan after trimming unused fields
   HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[20])
     HiveProject(key=[$1], value=[$2])
       HiveJoin(condition=[=(CAST($0):DOUBLE, CAST($1):DOUBLE)], 
joinType=[inner], algorithm=[none], cost=[not available])
         HiveFilter(condition=[IS NOT NULL(CAST($0):DOUBLE)])
           HiveProject(key=[$0])
             HiveTableScan(table=[[default, hbase_table_1]], 
table:alias=[hbase_table_1])
         HiveFilter(condition=[IS NOT NULL(CAST($0):DOUBLE)])
           HiveProject(key=[$0], value=[$1])
             HiveTableScan(table=[[default, src]], table:alias=[src])
   ```
   
   We see that the `CAST`s are getting pushed down from the `Join` now. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to