CrunchyData / pg_parquet

Copy to/from Parquet in S3 from within PostgreSQL
Other
358 stars 11 forks source link

Numeric improvement and fix #65

Closed aykut-bozkurt closed 1 week ago

aykut-bozkurt commented 3 weeks ago

Problem Previously, we were writing unbounded numerics, that does not specify precision and scale (i.e. numeric), as text since they can be too large to represent as parquet decimal. Most of the time users ignores the precision for numeric columns, so they were written as text. That prevents pushing down some operators on the numeric type by execution engines.

Improvement We start to read/write unbounded numerics as numeric(38, 16) to parquet file. We throw a runtime error if an unbounded numeric value exceeds 22 digits before the decimal point or 16 digits after the decimal point.

For the users that bump into the error, we give hint to change the column type to a numeric(p,s) with precision and scale specified, to get rid of the error.

Fixes Arrow to pg conversions were not correct for some cases

These cases are fixed and covered by tests.