[
https://issues.apache.org/jira/browse/FLINK-6884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16045679#comment-16045679
]
ASF GitHub Bot commented on FLINK-6884:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/4100#discussion_r121265361
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala
---
@@ -718,16 +718,20 @@ abstract class TableEnvironment(val config:
TableConfig) {
// validate that at least the field types of physical and logical type
match
// we do that here to make sure that plan translation was correct
if (schema.physicalTypeInfo != inputTypeInfo) {
- throw TableException("The field types of physical and logical row
types do not match." +
- "This is a bug and should not happen. Please file an issue.")
+ throw TableException(
+ s"The field types of physical and logical row types do not match.
" +
+ s"Physical type is [${schema.physicalTypeInfo}], Logical type is
[${inputTypeInfo}]. " +
+ s"This is a bug and should not happen. Please file an issue.")
}
val fieldTypes = schema.physicalFieldTypeInfo
val fieldNames = schema.physicalFieldNames
// validate requested type
if (requestedTypeInfo.getArity != fieldTypes.length) {
- throw new TableException("Arity of result does not match requested
type.")
+ throw new TableException(
+ s"Arity[${requestedTypeInfo.getArity}] of
result[${requestedTypeInfo}] does not match " +
--- End diff --
Result and requested types need to be switched.
> Incompatible TableSource#getReturnType and actual input type should fail
> faster
> -------------------------------------------------------------------------------
>
> Key: FLINK-6884
> URL: https://issues.apache.org/jira/browse/FLINK-6884
> Project: Flink
> Issue Type: Bug
> Components: Table API & SQL
> Affects Versions: 1.3.0
> Reporter: Dawid Wysakowicz
> Assignee: sunjincheng
>
> When a {{TableSource#getReturnType}} differs from the actual input type the
> exception is thrown in code generation step with an exception that is hard to
> track back:
> {code}
> org.apache.flink.table.codegen.CodeGenException: Arity of result type does
> not match number of expressions.
> at
> org.apache.flink.table.codegen.CodeGenerator.generateResultExpression(CodeGenerator.scala:940)
> at
> org.apache.flink.table.codegen.CodeGenerator.generateConverterResultExpression(CodeGenerator.scala:883)
> at
> org.apache.flink.table.plan.nodes.CommonScan$class.generatedConversionFunction(CommonScan.scala:57)
> at
> org.apache.flink.table.plan.nodes.datastream.StreamTableSourceScan.generatedConversionFunction(StreamTableSourceScan.scala:35)
> at
> org.apache.flink.table.plan.nodes.datastream.StreamScan$class.convertToInternalRow(StreamScan.scala:48)
> at
> org.apache.flink.table.plan.nodes.datastream.StreamTableSourceScan.convertToInternalRow(StreamTableSourceScan.scala:35)
> at
> org.apache.flink.table.plan.nodes.datastream.StreamTableSourceScan.translateToPlan(StreamTableSourceScan.scala:107)
> {code}
> It would be nice if more meaningful exception was thrown earlier.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)