@@ -437,27 +437,28 @@ private[parquet] class ParquetFilters(
437
437
// Parquet's type in the given file should be matched to the value's type
438
438
// in the pushed filter in order to push down the filter to Parquet.
439
439
def valueCanMakeFilterOn (name : String , value : Any ): Boolean = {
440
- value == null || (nameToType(name) match {
441
- case ParquetBooleanType => value.isInstanceOf [JBoolean ]
442
- case ParquetByteType | ParquetShortType | ParquetIntegerType => value.isInstanceOf [Number ]
443
- case ParquetLongType => value.isInstanceOf [JLong ]
444
- case ParquetFloatType => value.isInstanceOf [JFloat ]
445
- case ParquetDoubleType => value.isInstanceOf [JDouble ]
446
- case ParquetStringType => value.isInstanceOf [String ]
447
- case ParquetBinaryType => value.isInstanceOf [Array [Byte ]]
448
- case ParquetDateType => value.isInstanceOf [Date ]
449
- case ParquetTimestampMicrosType | ParquetTimestampMillisType =>
450
- value.isInstanceOf [Timestamp ]
451
- case ParquetSchemaType (DECIMAL , INT32 , _, decimalMeta) =>
452
- isDecimalMatched(value, decimalMeta)
453
- case ParquetSchemaType (DECIMAL , INT64 , _, decimalMeta) =>
454
- isDecimalMatched(value, decimalMeta)
455
- case ParquetSchemaType (DECIMAL , FIXED_LEN_BYTE_ARRAY , _, decimalMeta) =>
456
- isDecimalMatched(value, decimalMeta)
457
- case set : Set [_] =>
458
- valueCanMakeFilterOn(name, set.iterator.next())
459
- case _ => false
460
- })
440
+ value == null ||
441
+ (value.isInstanceOf [Array [_]]
442
+ && canMakeFilterOn(name, value.asInstanceOf [Array ].apply(0 ))) ||
443
+ (nameToType(name) match {
444
+ case ParquetBooleanType => value.isInstanceOf [JBoolean ]
445
+ case ParquetByteType | ParquetShortType | ParquetIntegerType => value.isInstanceOf [Number ]
446
+ case ParquetLongType => value.isInstanceOf [JLong ]
447
+ case ParquetFloatType => value.isInstanceOf [JFloat ]
448
+ case ParquetDoubleType => value.isInstanceOf [JDouble ]
449
+ case ParquetStringType => value.isInstanceOf [String ]
450
+ case ParquetBinaryType => value.isInstanceOf [Array [Byte ]]
451
+ case ParquetDateType => value.isInstanceOf [Date ]
452
+ case ParquetTimestampMicrosType | ParquetTimestampMillisType =>
453
+ value.isInstanceOf [Timestamp ]
454
+ case ParquetSchemaType (DECIMAL , INT32 , _, decimalMeta) =>
455
+ isDecimalMatched(value, decimalMeta)
456
+ case ParquetSchemaType (DECIMAL , INT64 , _, decimalMeta) =>
457
+ isDecimalMatched(value, decimalMeta)
458
+ case ParquetSchemaType (DECIMAL , FIXED_LEN_BYTE_ARRAY , _, decimalMeta) =>
459
+ isDecimalMatched(value, decimalMeta)
460
+ case _ => false
461
+ })
461
462
}
462
463
463
464
// Parquet does not allow dots in the column name because dots are used as a column path
@@ -525,7 +526,7 @@ private[parquet] class ParquetFilters(
525
526
.map(FilterApi .not)
526
527
.map(LogicalInverseRewriter .rewrite)
527
528
528
- case sources.In (name, values) if canMakeFilterOn(name, values.head ) =>
529
+ case sources.In (name, values) if canMakeFilterOn(name, values) =>
529
530
makeInSet.lift(nameToType(name)).map(_(name, values.toSet))
530
531
531
532
case sources.StringStartsWith (name, prefix)
0 commit comments