danny0405 commented on code in PR #10531:
URL: https://github.com/apache/hudi/pull/10531#discussion_r1464196830
##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/source/TestExpressionPredicates.java:
##########
@@ -182,4 +193,54 @@ public void
testDisablePredicatesPushDownForUnsupportedType() {
assertNull(Or.getInstance().bindPredicates(greaterThanPredicate,
lessThanPredicate).filter(), "Decimal type push down is unsupported, so we
expect null");
assertNull(Not.getInstance().bindPredicate(greaterThanPredicate).filter(),
"Decimal type push down is unsupported, so we expect null");
}
+
+ public static Stream<Arguments>
testColumnPredicateLiteralTypeConversionParams() {
+ return Stream.of(
+ Arguments.of("f_boolean", DataTypes.BOOLEAN(), Boolean.TRUE, "Convert
from Boolean to Boolean failed"),
+ Arguments.of("f_boolean", DataTypes.BOOLEAN(), "true", "Convert from
String to Boolean failed"),
+ Arguments.of("f_tinyint", DataTypes.TINYINT(), 12345, "Convert from
Integer to tinyint failed"),
+ Arguments.of("f_tinyint", DataTypes.TINYINT(), "12345", "Convert from
String to tinyint failed"),
+ Arguments.of("f_smallint", DataTypes.SMALLINT(), 12345, "Convert from
Integer to smallint failed"),
+ Arguments.of("f_smallint", DataTypes.SMALLINT(), "12345", "Convert
from String to smallint failed"),
+ Arguments.of("f_integer", DataTypes.INT(), 12345, "Convert from
Integer to Integer failed"),
+ Arguments.of("f_integer", DataTypes.INT(), "12345", "Convert from
String to Integer failed"),
+ Arguments.of("f_bigint", DataTypes.BIGINT(), 12345L, "Convert from
Long to bigint failed"),
+ Arguments.of("f_bigint", DataTypes.BIGINT(), 12345, "Convert from
Integer to bigint failed"),
+ Arguments.of("f_bigint", DataTypes.BIGINT(), "12345", "Convert from
String to bigint failed"),
+ Arguments.of("f_float", DataTypes.FLOAT(), 123.45f, "Convert from
Float to Float failed"),
+ Arguments.of("f_float", DataTypes.FLOAT(), "123.45f", "Convert from
Float to Float failed"),
+ Arguments.of("f_double", DataTypes.DOUBLE(), 123.45, "Convert from
Double to Double failed"),
+ Arguments.of("f_double", DataTypes.DOUBLE(), "123.45", "Convert from
String to Double failed"),
+ Arguments.of("f_varbinary", DataTypes.VARBINARY(10), "a".getBytes(),
"Convert from ByteArray to varbinary failed"),
+ Arguments.of("f_varbinary", DataTypes.VARBINARY(10), "a", "Convert
from String to varbinary failed"),
+ Arguments.of("f_binary", DataTypes.BINARY(10), "a".getBytes(),
"Convert from ByteArray to binary failed"),
+ Arguments.of("f_binary", DataTypes.BINARY(10), "a", "Convert from
String to binary failed"),
+ Arguments.of("f_date", DataTypes.DATE(), LocalDate.now(), "Convert
from Date to Date failed"),
+ Arguments.of("f_date", DataTypes.DATE(), 19740, "Convert from Integer
to Date failed"),
+ Arguments.of("f_date", DataTypes.DATE(), 19740L, "Convert from Long to
Date failed"),
+ Arguments.of("f_date", DataTypes.DATE(), "2024-01-18", "Convert from
String to Date failed"),
+ Arguments.of("f_char", DataTypes.CHAR(1), "a", "Convert from String to
Char failed"),
+ Arguments.of("f_char", DataTypes.CHAR(1), 1, "Convert from Integer to
Char failed"),
+ Arguments.of("f_varchar", DataTypes.VARCHAR(1), "a", "Convert from
String to varchar failed"),
+ Arguments.of("f_varchar", DataTypes.VARCHAR(1), 1, "Convert from
Integer to varchar failed"),
+ Arguments.of("f_time", DataTypes.TIME(), LocalTime.now(), "Convert
from Time to Time failed"),
+ Arguments.of("f_time", DataTypes.TIME(), 12345, "Convert from Integer
to Time failed"),
+ Arguments.of("f_time", DataTypes.TIME(), 60981896000L, "Convert from
Long to Time failed"),
+ Arguments.of("f_time", DataTypes.TIME(), "20:00:00", "Convert from
String to Time failed"),
+ Arguments.of("f_timestamp", DataTypes.TIMESTAMP(),
LocalDateTime.now(), "Convert from Timestamp to Timestamp failed"),
+ Arguments.of("f_timestamp", DataTypes.TIMESTAMP(), 12345, "Convert
from Integer to Timestamp failed"),
+ Arguments.of("f_timestamp", DataTypes.TIMESTAMP(), 1705568913701L,
"Convert from Long to Timestamp failed"),
+ Arguments.of("f_timestamp", DataTypes.TIMESTAMP(),
"2024-01-18T15:00:00", "Convert from String to Timestamp failed")
Review Comment:
Maybe we can generate the error msg on the fly because we already know the
source and target data type.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]