KurtYoung commented on a change in pull request #9909: [FLINK-14381][table]
Partition field names should be got from CatalogTable instead of source/sink
URL: https://github.com/apache/flink/pull/9909#discussion_r338906042
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/PushPartitionIntoTableSourceScanRule.scala
##########
@@ -62,85 +60,89 @@ class PushPartitionIntoTableSourceScanRule extends
RelOptRule(
val filter: Filter = call.rel(0)
val scan: LogicalTableScan = call.rel(1)
val table: FlinkRelOptTable = scan.getTable.asInstanceOf[FlinkRelOptTable]
- pushPartitionIntoScan(call, filter, scan, table)
- }
- private def pushPartitionIntoScan(
- call: RelOptRuleCall,
- filter: Filter,
- scan: LogicalTableScan,
- relOptTable: FlinkRelOptTable): Unit = {
-
- val tableSourceTable = relOptTable.unwrap(classOf[TableSourceTable[_]])
- val tableSource =
tableSourceTable.tableSource.asInstanceOf[PartitionableTableSource]
- val partitionFieldNames = tableSource.getPartitionFieldNames.toList.toArray
- val inputFieldType = filter.getInput.getRowType
-
- val relBuilder = call.builder()
- val maxCnfNodeCount = FlinkRelOptUtil.getMaxCnfNodeCount(scan)
- val (partitionPredicate, nonPartitionPredicate) =
- RexNodeExtractor.extractPartitionPredicates(
- filter.getCondition,
- maxCnfNodeCount,
+ val tableSourceTable = table.unwrap(classOf[TableSourceTable[_]])
+
+ if (!tableSourceTable.tableSource.isInstanceOf[PartitionableTableSource]) {
+ throw new TableException(s"Table(${table.getQualifiedName}) with
partition keys" +
Review comment:
It the table is partitioned, but we have a non PartitionableTableSource,
couldn't we just skip partition prune and read the whole data instead?
Throwing an exception doesn't seem to be right.
----------------------------------------------------------------
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]
With regards,
Apache Git Services