[
https://issues.apache.org/jira/browse/FLINK-5357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15814005#comment-15814005
]
ASF GitHub Bot commented on FLINK-5357:
---------------------------------------
Github user KurtYoung commented on a diff in the pull request:
https://github.com/apache/flink/pull/3063#discussion_r95304042
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/logical/operators.scala
---
@@ -92,20 +92,19 @@ case class Project(projectList: Seq[NamedExpression],
child: LogicalNode) extend
}
override protected[logical] def construct(relBuilder: RelBuilder):
RelBuilder = {
- val allAlias = projectList.forall(_.isInstanceOf[Alias])
child.construct(relBuilder)
- if (allAlias) {
- // Calcite's RelBuilder does not translate identity projects even if
they rename fields.
- // Add a projection ourselves (will be automatically removed by
translation rules).
- val project = LogicalProject.create(relBuilder.peek(),
+ // Calcite's RelBuilder does not translate identity projects even if
they rename fields.
+ // We add a projection ourselves (will be automatically removed by
translation rules).
+ val project = LogicalProject.create(
--- End diff --
I noticed that Calcite's RelBuilder has this method:
`project(
Iterable<? extends RexNode> nodes,
Iterable<String> fieldNames,
boolean force)`
Would it be more consistent to use this method by setting the force to
`true`, instead of creating Projection by ourself.
But either is fine with me.
> WordCountTable fails
> --------------------
>
> Key: FLINK-5357
> URL: https://issues.apache.org/jira/browse/FLINK-5357
> Project: Flink
> Issue Type: Bug
> Components: Table API & SQL
> Reporter: Timo Walther
> Assignee: Timo Walther
>
> The execution of org.apache.flink.table.examples.java.WordCountTable fails:
> {code}
> Exception in thread "main" org.apache.flink.table.api.TableException: POJO
> does not define field name: TMP_0
> at
> org.apache.flink.table.typeutils.TypeConverter$$anonfun$2.apply(TypeConverter.scala:85)
> at
> org.apache.flink.table.typeutils.TypeConverter$$anonfun$2.apply(TypeConverter.scala:81)
> at scala.collection.immutable.List.foreach(List.scala:318)
> at
> org.apache.flink.table.typeutils.TypeConverter$.determineReturnType(TypeConverter.scala:81)
> at
> org.apache.flink.table.plan.nodes.dataset.DataSetCalc.translateToPlan(DataSetCalc.scala:110)
> 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)
> at
> org.apache.flink.table.examples.java.WordCountTable.main(WordCountTable.java:56)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)