kasakrisz commented on a change in pull request #2401:
URL: https://github.com/apache/hive/pull/2401#discussion_r657889592
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/AlterMaterializedViewRebuildAnalyzer.java
##########
@@ -353,6 +375,23 @@ private RelNode toJoinInsertIncremental(
basePlan, mdProvider, executorProvider,
HiveJoinInsertIncrementalRewritingRule.INSTANCE);
}
+ private RelNode toPartitionInsertOverwrite(
+ RelNode basePlan, RelMetadataProvider mdProvider, RexExecutor
executorProvider,
+ HiveRelOptMaterialization materialization, RelNode
calcitePreMVRewritingPlan) {
+
+ if (materialization.isSourceTablesUpdateDeleteModified()) {
+ return calcitePreMVRewritingPlan;
+ }
+
+ RelOptHiveTable hiveTable = (RelOptHiveTable)
materialization.tableRel.getTable();
+ if (!AcidUtils.isInsertOnlyTable(hiveTable.getHiveTableMD())) {
Review comment:
I tested scenarios when the view definition has aggregate functions like
`avg`, `std`, `variance`.
These functions are represented in the Calcite plan by a formula which input
is usually `sum` and `count`. Example:
```
HiveProject(b=[$0], avgc=[/(CAST($2):DOUBLE, $3)], a=[$1])
HiveAggregate(group=[{0, 1}], agg#0=[sum($2)], agg#1=[count($2)])
HiveProject($f0=[$1], $f1=[$0], $f2=[$2])
HiveTableScan(table=[[default, t1]], table:alias=[t1])
```
This type of plan is not converted to a Union based MV rewrite so execution
doesn't even reach the incremental rewriting rules.
It seems that the rules generates the Union based MV rewrite should be
improved first.
Adding TODO.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]