You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Iceberg Truncate Transform Wrong Result due to Integer Overflow #13105
I get wrong results when I apply truncate transform on bigint type via pyspark sql api. It seems like an overflow issue with truncate transform. (can repro without iceberg as well)
Steps to repro:
>spark.sql("""CREATE TABLE prod.db.sample (a bigint) using iceberg partitioned by (truncate(10,a));""")
DataFrame[]
>spark.sql("""insert into prod.db.sample values(-9223372036854775808);""")
DataFrame[]
# wrong result due to overflow>spark.sql(f"select * from prod.db.sample where a < 0").collect()
[]
# partition value overflow>spark.sql("select partition.* from prod.db.sample.files").collect()
[Row(a_trunc=9223372036854775806)]
Willingness to contribute
I can contribute a fix for this bug independently
I would be willing to contribute a fix for this bug with guidance from the Iceberg community
I cannot contribute a fix for this bug at this time
I think this would possibly require a spec change. I'm afraid that both over and underflows are possible, overflows might be addressed if spec would use v - (v % W) for positive values instead of v - (((v % W) + W) % W).
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.
Activity
nandorKollar commentedon May 21, 2025
I think this would possibly require a spec change. I'm afraid that both over and underflows are possible, overflows might be addressed if spec would use
v - (v % W)for positive values instead ofv - (((v % W) + W) % W).github-actions commentedon Nov 18, 2025
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.
github-actions commentedon Dec 2, 2025
This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'