JingsongLi commented on a change in pull request #8781: 
[FLINK-12874][table-common] Improve the semantics of zero length strings
URL: https://github.com/apache/flink/pull/8781#discussion_r295169573
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/BinaryType.java
 ##########
 @@ -91,9 +92,11 @@ private BinaryType(int length, boolean isNullable) {
         * For consistent behavior, the same logic applies to binary strings.
         *
         * <p>This method enables this special kind of binary string.
+        *
+        * <p>Zero-length binary strings have no serializable string 
representation.
         */
        public static BinaryType ofEmptyLiteral() {
-               return new BinaryType(EMPTY_LITERAL_LENGTH, false);
+               return new BinaryType(EMPTY_LITERAL_LENGTH, true);
 
 Review comment:
   I prefer `ofEmptyLiteral(boolean isNullable)`.
   Literal empty string will be empty literal non-nullable CharType.
   But there are some nullable cases too.
   Consider `substring('', 1, 3)`, I think we should return an empty literal 
nullable VarCharType in blink runner, Unlike Flink runner, Blink runner tries 
not to throw exceptions, which leads to task failure. Blink runner chooses 
return null to when error in calculation. (be consistent with Hive and Spark)

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to