tsreaper commented on code in PR #1274:
URL: https://github.com/apache/incubator-paimon/pull/1274#discussion_r1213016733


##########
paimon-core/src/main/java/org/apache/paimon/casting/CastExecutors.java:
##########
@@ -123,6 +125,8 @@ public class CastExecutors {
                                             (Decimal) value,
                                             decimalType.getPrecision(),
                                             decimalType.getScale());
+                        case VARCHAR:
+                            return Object::toString;

Review Comment:
   Same as above.



##########
paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java:
##########
@@ -603,11 +603,11 @@ public void testAlterTableUpdateColumnType() throws 
Exception {
                                         identifier,
                                         Lists.newArrayList(
                                                 SchemaChange.updateColumnType(
-                                                        "col1", 
DataTypes.STRING())),
+                                                        "col1", 
DataTypes.DATE())),

Review Comment:
   Why changing this?



##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java:
##########
@@ -283,7 +283,7 @@ public TableSchema commitChanges(List<SchemaChange> 
changes) throws Exception {
                             update.fieldName(),
                             (field) -> {
                                 checkState(
-                                        DataTypeCasts.supportsImplicitCast(

Review Comment:
   By allowing explicit type casting you will allow casting from `string` to 
`bigint`, or `timestamp` to `tinyint`, etc., etc. Have you implemented all 
these in `CastExecutors`?



##########
paimon-core/src/test/java/org/apache/paimon/casting/CastExecutorTest.java:
##########
@@ -144,6 +144,42 @@ public void testDecimalToNumeric() {
                 1.23D);
     }
 
+    @Test
+    public void testNumericToString() {

Review Comment:
   Cast result should be `BinaryString`, not normal `String`. See 
`testStringToString`.



##########
paimon-core/src/main/java/org/apache/paimon/casting/CastExecutors.java:
##########
@@ -97,6 +97,8 @@ public class CastExecutors {
                                         }
                                 }
                             };
+                        case VARCHAR:
+                            return Object::toString;

Review Comment:
   Return type should be `BinaryString`, not `String`. See the following case 
branches about `CHAR` and `VARCHAR`.



-- 
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]

Reply via email to