File tree Expand file tree Collapse file tree
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,11 +115,14 @@ public class VectorizedColumnReader {
115115
116116 private boolean isDecimalTypeMatched (DataType dt ) {
117117 DecimalType d = (DecimalType ) dt ;
118- DecimalLogicalTypeAnnotation dm =
119- (DecimalLogicalTypeAnnotation )descriptor .getPrimitiveType ().getLogicalTypeAnnotation ();
120- // It's OK if the required decimal precision is larger than or equal to the physical decimal
121- // precision in the Parquet metadata, as long as the decimal scale is the same.
122- return dm != null && dm .getPrecision () <= d .precision () && dm .getScale () == d .scale ();
118+ LogicalTypeAnnotation typeAnnotation = descriptor .getPrimitiveType ().getLogicalTypeAnnotation ();
119+ if (typeAnnotation instanceof DecimalLogicalTypeAnnotation ) {
120+ DecimalLogicalTypeAnnotation decimalType = (DecimalLogicalTypeAnnotation ) typeAnnotation ;
121+ // It's OK if the required decimal precision is larger than or equal to the physical decimal
122+ // precision in the Parquet metadata, as long as the decimal scale is the same.
123+ return decimalType .getPrecision () <= d .precision () && decimalType .getScale () == d .scale ();
124+ }
125+ return false ;
123126 }
124127
125128 private boolean canReadAsIntDecimal (DataType dt ) {
You can’t perform that action at this time.
0 commit comments