File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -636,14 +636,13 @@ def visit_fixed(self, fixed_type: FixedType) -> pa.DataType:
636636 return pa .binary (len (fixed_type ))
637637
638638 def visit_decimal (self , decimal_type : DecimalType ) -> pa .DataType :
639- if decimal_type .precision <= 9 :
640- return pa .decimal32 (decimal_type .precision , decimal_type .scale )
641- elif decimal_type .precision <= 18 :
642- return pa .decimal64 (decimal_type .precision , decimal_type .scale )
643- elif decimal_type .precision <= 38 :
644- return pa .decimal128 (decimal_type .precision , decimal_type .scale )
645- else :
646- raise ValueError (f"Precision above 38 is not supported: { decimal_type .precision } " )
639+ # It looks like decimal{32,64} is not fully implemented:
640+ # https://github.com/apache/arrow/issues/25483
641+ # https://github.com/apache/arrow/issues/43956
642+ # However, if we keep it as 128 in memory, and based on the
643+ # precision/scale Arrow will map it to INT{32,64}
644+ # https://github.com/apache/arrow/blob/598938711a8376cbfdceaf5c77ab0fd5057e6c02/cpp/src/parquet/arrow/schema.cc#L380-L392
645+ return pa .decimal128 (decimal_type .precision , decimal_type .scale )
647646
648647 def visit_boolean (self , _ : BooleanType ) -> pa .DataType :
649648 return pa .bool_ ()
You can’t perform that action at this time.
0 commit comments