Skip to content

Commit 9abbc6d

Browse files
committed
Truncate decimals that can't fit into Parquet
1 parent b5adc12 commit 9abbc6d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/common/iceberg_schema_column.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,12 @@ func (col *IcebergSchemaColumn) duckdbDecimal(value string) duckdb.Decimal {
480480
}
481481
}
482482
decimalValue := new(big.Int)
483+
484+
if len(integerPart)+len(fractionalPart) > PARQUET_MAX_DECIMAL_PRECISION {
485+
integerPart = strings.Repeat("9", PARQUET_MAX_DECIMAL_PRECISION-len(fractionalPart))
486+
LogWarn(col.Config, "Truncating decimal value", value, "to", integerPart+"."+fractionalPart, "in column", col.ColumnName, "to fit precision", IntToString(PARQUET_MAX_DECIMAL_PRECISION))
487+
}
488+
483489
decimalValue.SetString(integerPart+fractionalPart, 10)
484490

485491
return duckdb.Decimal{

0 commit comments

Comments
 (0)