JingsongLi commented on a change in pull request #10518: [FLINK-15124][table]
Fix types with precision defined in DDL can't be executed
URL: https://github.com/apache/flink/pull/10518#discussion_r356416161
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/sources/TableSourceUtil.scala
##########
@@ -100,18 +96,32 @@ object TableSourceUtil {
throw new ValidationException(s"Rowtime field '$name' has invalid
type $t. " +
s"Rowtime attributes must be of TimestampType.")
}
- val (physicalName, idx, tpe) = resolveInputField(name, tableSource)
+ val (physicalName, idx, logicalType) = resolveInputField(name,
tableSource)
// validate that mapped fields are are same type
- if (!isAssignable(fromTypeInfoToLogicalType(tpe), t)) {
+ if (!isAssignable(logicalType, t)) {
throw new ValidationException(s"Type $t of table field '$name' does
not " +
- s"match with type $tpe of the field '$physicalName' of the
TableSource return type.")
+ s"match with type $logicalType of the field '$physicalName' of the
" +
+ "TableSource return type.")
+ } else if (!isInteroperable(logicalType, t)) {
+ // the produced type of TableSource is different with the logical
type defined in DDL
+ // on the precision or nullability.
+ throw new ValidationException(
+ "If the connector would like to support precision and nullability
defined in DDL," +
Review comment:
No `nullability` check, both `isInteroperable` and `isAssignable` not check
`nullability`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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