snuyanzin commented on code in PR #1877:
URL: https://github.com/apache/fluss/pull/1877#discussion_r2469711116
##########
fluss-client/src/main/java/org/apache/fluss/client/converter/ConverterCommons.java:
##########
@@ -45,12 +45,39 @@ final class ConverterCommons {
private static Map<DataTypeRoot, Set<Class<?>>> createSupportedTypes() {
Map<DataTypeRoot, Set<Class<?>>> map = new HashMap<>();
map.put(DataTypeRoot.BOOLEAN, setOf(Boolean.class));
+
+ // Numeric types with widening support
map.put(DataTypeRoot.TINYINT, setOf(Byte.class));
- map.put(DataTypeRoot.SMALLINT, setOf(Short.class));
- map.put(DataTypeRoot.INTEGER, setOf(Integer.class));
- map.put(DataTypeRoot.BIGINT, setOf(Long.class));
- map.put(DataTypeRoot.FLOAT, setOf(Float.class));
- map.put(DataTypeRoot.DOUBLE, setOf(Double.class));
+ map.put(DataTypeRoot.SMALLINT, setOf(Short.class, Byte.class)); //
byte can widen to short
+ map.put(
+ DataTypeRoot.INTEGER,
+ setOf(Integer.class, Short.class, Byte.class)); // byte, short
can widen to int
+ map.put(
+ DataTypeRoot.BIGINT,
+ setOf(
+ Long.class,
+ Integer.class,
+ Short.class,
+ Byte.class)); // smaller ints can widen to long
+ map.put(
+ DataTypeRoot.FLOAT,
+ setOf(
+ Float.class,
+ Long.class,
+ Integer.class,
+ Short.class,
+ Byte.class)); // all ints can widen to float
+ map.put(
+ DataTypeRoot.DOUBLE,
+ setOf(
+ Double.class,
+ Float.class,
+ Long.class,
+ Integer.class,
+ Short.class,
+ Byte.class)); // all numerics can widen to double
+
+ // Non-numeric types remain unchanged
Review Comment:
can you elaborate why
```java
map.put(DataTypeRoot.DECIMAL, setOf(BigDecimal.class));
```
is considered as non-numeric?
--
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]