JingsongLi 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_r338931356
########## 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: Although I don't think it's possible to use it like this, it can. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services