okumin commented on code in PR #5077:
URL: https://github.com/apache/hive/pull/5077#discussion_r1485585374
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveTableScan.java:
##########
@@ -202,6 +203,12 @@ public HiveTableScan copyIncludingTable(RelDataType
newRowtype) {
// Also include partition list key to trigger cost evaluation even if an
// expression was already generated.
@Override public RelWriter explainTerms(RelWriter pw) {
+ if (pw instanceof RelTreeSignatureWriter) {
+ return super.explainTerms(pw)
+ .item("tableScanTrait", this.tableScanTrait)
+ .itemIf("fromVersion", ((RelOptHiveTable)
table).getHiveTableMD().getVersionIntervalFrom(),
+ isNotBlank(((RelOptHiveTable)
table).getHiveTableMD().getVersionIntervalFrom()));
Review Comment:
I added some attributes that could differentiate two HiveTableScans. We may
not need these ones here.
There is one potential problem in my mind. HiveTableScan doesn't retain the
equivalents of `TableScanDesc#getPredicateString` or
`TableScanDesc#getRowLimit`. So, we can't unify ASTNodes or RelNodes of
HiveTableScan based on signatures. Otherwise, Operators will be over-unified
later.
Currently, we link only HiveFilter RelNodes using RelTreeSignatures(we link
HiveTableScan with its ASTNode, but don't link it with the signature). So, the
existence of `TableScanDesc#getPredicateString` doesn't matter to us.
Also, [CBO is disabled when TABLESAMPLE is
used](https://github.com/apache/hive/blob/rel/release-4.0.0-beta-1/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveCalciteUtil.java#L105).
So, we can say `TableScanDesc#getRowLimit` doesn't cause an issue in the world
of RelNodes. I expect we could push down the row count to HiveTableScan when we
support TABLESAMPLE in CBO.
So, in my current understanding, this PR doesn't cause an immediate problem.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]