AshishKhatkar opened a new pull request, #5692:
URL: https://github.com/apache/paimon/pull/5692

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... 
-->
   
   ### Purpose
   This PR disables explicit type casting by default.
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #xxx
   
   As of today, for example BIGINT type can be converted to INT which is not 
desirable as this conversion leads to overflow. Consider the case as follows:
   
   ```
   - CREATE CATALOG paimon WITH ('type' = 'paimon', 'warehouse' = 
'file:/Users/ashish/Documents/flink-1.20.1/paimon_warehouse');
   
   - USE CATALOG paimon;
   
   - CREATE TABLE type_cast_test(field1 INT, field2 INT, PRIMARY KEY (field1) 
NOT ENFORCED);
   - ALTER TABLE type_cast_test MODIFY field1 TINYINT;
   - DESCRIBE type_cast_test;
   +--------+---------+------+-----+--------+-----------+
   |   name |    type | null | key | extras | watermark |
   +--------+---------+------+-----+--------+-----------+
   | field1 | TINYINT | TRUE |     |        |           |
   | field2 |     INT | TRUE |     |        |           |
   +--------+---------+------+-----+--------+-----------+
   
   After the change I did
   
   - ALTER TABLE type_cast_test MODIFY field1 TINYINT;
   This throws exception :
   [ERROR] Could not execute SQL statement. Reason:
   java.lang.IllegalStateException: Column type field1[INT] cannot be converted 
to TINYINT without loosing information.
   ```
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   Added new tests to verify the change for complex types (Row, Array and Map) 
as well.
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


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