twalthr commented on a change in pull request #7328: [FLINK-11191][table] Check
for ambiguous columns in MATCH_RECOGNIZE
URL: https://github.com/apache/flink/pull/7328#discussion_r245604561
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamMatchRule.scala
##########
@@ -91,6 +95,47 @@ class DataStreamMatchRule
expr.foreach(_.accept(validator))
}
+ private def validateAmbiguousColumns(logicalMatch: FlinkLogicalMatch): Unit
= {
+ if (logicalMatch.isAllRows) {
+ throw new TableException("All rows per match mode is not supported yet.")
+ } else {
+ val refNameFinder = new RefNameFinder(logicalMatch.getInput.getRowType)
+ validateAmbiguousColumnsOnRowPerMatch(
+ logicalMatch.getPartitionKeys,
+ logicalMatch.getMeasures.keySet().asScala,
+ logicalMatch.getRowType,
+ refNameFinder)
+ }
+ }
+
+ private def validateAmbiguousColumnsOnRowPerMatch(
+ partitionKeys: JList[RexNode],
+ measuresNames: mutable.Set[String],
+ expectedSchema: RelDataType,
+ refNameFinder: RefNameFinder)
+ : Unit = {
+ val actualSize = partitionKeys.size() + measuresNames.size
+ val expectedSize = expectedSchema.getFieldCount
+ if (actualSize != expectedSize) {
+ //try to find ambiguous column
+
+ val ambigousColumns = partitionKeys.asScala.map(_.accept(refNameFinder))
Review comment:
Fix typo "ambiguous"
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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