You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "rice668 (via GitHub)" <gi...@apache.org> on 2025/09/09 13:20:34 UTC

[I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

rice668 opened a new issue, #14037:
URL: https://github.com/apache/iceberg/issues/14037

   ### Feature Request / Improvement
   
   Currently, Iceberg's schema evolution for DECIMAL types is more restrictive than the SQL:2011 standard. The current implementation in `TypeUtil.isPromotionAllowed()` only allows precision increases while keeping the scale unchanged.
   
    ## Current Behavior
   
     In https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/types/TypeUtil.java#L416, the DECIMAL type promotion logic is:
   
     ```java
     case DECIMAL:
         Types.DecimalType fromDecimal = (Types.DecimalType) from;
         if (to.typeId() != Type.TypeID.DECIMAL) {
             return false;
         }
         Types.DecimalType toDecimal = (Types.DecimalType) to;
         return fromDecimal.scale() == toDecimal.scale()
             && fromDecimal.precision() <= toDecimal.precision();
   
     This means:
     - ✅ Allowed: DECIMAL(10,2) → DECIMAL(12,2) (only precision increases)
     - ❌ Rejected: DECIMAL(10,2) → DECIMAL(12,4) (scale change is blocked)
   ```
   SQL:2011 Standard Requirements
   
   According to SQL:2011 standard, for exact numeric types, the following rules apply,  so I think we need to align Iceberg's DECIMAL type evolution with SQL:2011 standard
   
   <img width="639" height="260" alt="Image" src="https://github.com/user-attachments/assets/a3093c37-58d4-48e2-b5af-6e236641ae4f" />
   
   <img width="559" height="277" alt="Image" src="https://github.com/user-attachments/assets/761a0fac-342c-4510-91dd-cf2720a0ffd3" />
   
   This means SQL:2011 allows scale increases as long as the constraints are satisfied.
   
   ### Query engine
   
   None
   
   ### Willingness to contribute
   
   - [x] I can contribute this improvement/feature independently
   - [ ] I would be willing to contribute this improvement/feature with guidance from the Iceberg community
   - [ ] I cannot contribute this improvement/feature at this time


-- 
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: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #14037: Support SQL:2011 compliant DECIMAL type evolution with scale changes
URL: https://github.com/apache/iceberg/issues/14037


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3271362946

   V3 is closed :) V4 discussion has begun see
   
   One file commits
   Relative paths
   Expanded column metrics
   Columna Metadata (Parquet Metadata)
   Indexing Support


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-4035332505

   This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-4122306547

   This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "rice668 (via GitHub)" <gi...@apache.org>.
rice668 commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3273727885

   @nandorKollar @RussellSpitzer I've initiated the discussion on the dev mailing list as suggested. The thread can be found here:
   https://lists.apache.org/thread/n33xz8vh4d4x6f1p6k4csnnbsy1l9lqt. Looking forward to community feedback and consensus on whether this enhancement should be included in V4.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "nandorKollar (via GitHub)" <gi...@apache.org>.
nandorKollar commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3270906465

   The current Iceberg spec clearly states, that only [precision widening](https://iceberg.apache.org/spec/#schema-evolution) is supported in V3 and below. Although your proposal might make sense, it requires change in specification, which is best to discuss with the entire Iceberg community to come to a common consensus. Would you mind opening a discussion on the dev mailing list about this, or if already happened, could you please link the result of it here?


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "rice668 (via GitHub)" <gi...@apache.org>.
rice668 commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3271319353

   @RussellSpitzer @nandorKollar I've sent an email to the dev mailing list to initiate the discussion on this proposal. Let's wait for community feedback there. Also, I noticed there doesn't seem to be much discussion about V4 in the community yet. Perhaps this could be considered for V3 if the community agrees, or it could be part of the initial V4 discussions when those begin.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "rice668 (via GitHub)" <gi...@apache.org>.
rice668 commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3271080443

   @nandorKollar Thank you for the feedback! You're absolutely right that this change involves modifying the Iceberg specification itself. I agree that this should be discussed with the broader community. I'll open a discussion on the dev mailing list to gather feedback and reach consensus on whether we should extend the specification to support SQL:2011 compliant DECIMAL type evolution with scale changes.
   
   The motivation behind this proposal is to align with SQL:2011 standard behavior, which many users expect from modern data systems. For example, evolving from DECIMAL(10,2) to DECIMAL(12,4) is a safe operation as long as the integer part capacity is preserved (10-2=8 <= 12-4=8). I'll post the mailing list discussion link here once initiated. Thanks again for pointing out the proper process!


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3271276558

   @nandorKollar Is right, we need to first vote on a spec change for this before changing the codebase imho. Especially if we are only allowing this in V4


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Support SQL:2011 compliant DECIMAL type evolution with scale changes [iceberg]

Posted by "rice668 (via GitHub)" <gi...@apache.org>.
rice668 commented on issue #14037:
URL: https://github.com/apache/iceberg/issues/14037#issuecomment-3271392711

   @RussellSpitzer Could you share the links to the V4 discussion threads? I'm particularly interested in the Indexing Support topic you mentioned, along with the other V4 features. I'd like to understand the broader V4 context before positioning this DECIMAL evolution proposal.
   


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org