Timo Walther created FLINK-5677:
-----------------------------------
Summary: Validation layer should check whether field can be used as grouping key
Key: FLINK-5677
URL:
https://issues.apache.org/jira/browse/FLINK-5677 Project: Flink
Issue Type: Improvement
Components: Table API & SQL
Reporter: Timo Walther
When grouping on a GenericType (e.g. {{Object}}). The validation layer does no checking of types. The {{groupBy/keyBy}} of DataSet/DataStream API throws the exception. The validation layer should check this before.
{code}
public static class OuterPojo {
public Object object = new Object();
}
tEnv.sql("SELECT testing.object FROM testing GROUP BY testing.object")
{code}
leads to
{code}
Exception in thread "main" org.apache.flink.api.common.InvalidProgramException: This type (GenericType<java.lang.Object>) cannot be used as key.
at org.apache.flink.api.common.operators.Keys$ExpressionKeys.<init>(Keys.java:270)
at org.apache.flink.api.common.operators.Keys$ExpressionKeys.<init>(Keys.java:223)
at org.apache.flink.api.java.DataSet.groupBy(DataSet.java:692)
at org.apache.flink.table.plan.nodes.dataset.DataSetAggregate.translateToPlan(DataSetAggregate.scala:134)
at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:305)
at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:289)
at org.apache.flink.table.api.java.BatchTableEnvironment.toDataSet(BatchTableEnvironment.scala:146)
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)