[
https://issues.apache.org/jira/browse/FLINK-13534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16898069#comment-16898069
]
Rui Li commented on FLINK-13534:
--------------------------------
It seems in {{BatchTableSourceScan.translateToPlan}} the produced type gets
converted back and forth between {{TypeInformation}} and {{DataType}}, and
somehow there's a type mismatch. Similarly the following experimental test
would fail. Not sure whether this is intended behavior.
{code}
DataType dataType = DataTypes.DECIMAL(10, 0);
TypeInformation typeInfo = TypeConversions.fromDataTypeToLegacyInfo(dataType);
DataType convertedDataType = TypeConversions.fromLegacyInfoToDataType(typeInfo);
assertEquals(dataType, convertedDataType);
{code}
[~lzljs3620320] would you mind share your thoughts about this issue? Thanks.
And here's {{HiveTableSource.getProducedDataType}}, in case there's something
wrong with this method.
{code}
@Override
public DataType getProducedDataType() {
TableSchema tableSchema = catalogTable.getSchema();
DataTypes.Field[] fields = new
DataTypes.Field[tableSchema.getFieldCount()];
for (int i = 0; i < fields.length; i++) {
fields[i] =
DataTypes.FIELD(tableSchema.getFieldName(i).get(),
tableSchema.getFieldDataType(i).get());
}
return DataTypes.ROW(fields);
}
{code}
> Unable to query Hive table with decimal column
> ----------------------------------------------
>
> Key: FLINK-13534
> URL: https://issues.apache.org/jira/browse/FLINK-13534
> Project: Flink
> Issue Type: Bug
> Components: Connectors / Hive
> Reporter: Rui Li
> Priority: Major
>
> Hit the following exception when access a Hive table with decimal column:
> {noformat}
> Caused by: org.apache.flink.table.api.TableException: TableSource of type
> org.apache.flink.batch.connectors.hive.HiveTableSource returned a DataSet of
> data type ROW<`x` LEGACY(BigDecimal)> that does not match with the data type
> ROW<`x` DECIMAL(10, 0)> declared by the TableSource.getProducedDataType()
> method. Please validate the implementation of the TableSource.
> at
> org.apache.flink.table.plan.nodes.dataset.BatchTableSourceScan.translateToPlan(BatchTableSourceScan.scala:118)
> at
> org.apache.flink.table.api.internal.BatchTableEnvImpl.translate(BatchTableEnvImpl.scala:303)
> at
> org.apache.flink.table.api.internal.BatchTableEnvImpl.translate(BatchTableEnvImpl.scala:281)
> at
> org.apache.flink.table.api.internal.BatchTableEnvImpl.writeToSink(BatchTableEnvImpl.scala:117)
> at
> org.apache.flink.table.api.internal.TableEnvImpl.insertInto(TableEnvImpl.scala:564)
> at
> org.apache.flink.table.api.internal.TableEnvImpl.insertInto(TableEnvImpl.scala:516)
> at
> org.apache.flink.table.api.internal.BatchTableEnvImpl.insertInto(BatchTableEnvImpl.scala:59)
> at
> org.apache.flink.table.api.internal.TableImpl.insertInto(TableImpl.java:428)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)