Skip to content

Commit d2e8dc3

Browse files
committed
PARQUET-34: Use Int for Size predicate value
1 parent 6a7207b commit d2e8dc3

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

parquet-column/src/main/java/org/apache/parquet/filter2/predicate/FilterApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public static <T extends Comparable<T>, P extends SingleColumnFilterPredicate<T>
264264
return Contains.of(pred);
265265
}
266266

267-
public static Size size(Column<?> column, Size.Operator operator, long value) {
267+
public static Size size(Column<?> column, Size.Operator operator, int value) {
268268
return new Size(column, operator, value);
269269
}
270270

parquet-column/src/main/java/org/apache/parquet/filter2/predicate/LogicalInverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public <T extends Comparable<T>> FilterPredicate visit(Contains<T> contains) {
101101

102102
@Override
103103
public FilterPredicate visit(Size size) {
104-
final long value = size.getValue();
104+
final int value = size.getValue();
105105
final Operators.Column<?> column = size.getColumn();
106106

107107
return size.filter(

parquet-column/src/main/java/org/apache/parquet/filter2/predicate/Operators.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,9 @@ public enum Operator {
516516

517517
private final Column<?> column;
518518
private final Operator operator;
519-
private final long value;
519+
private final int value;
520520

521-
Size(Column<?> column, Operator operator, long value) {
521+
Size(Column<?> column, Operator operator, int value) {
522522
this.column = column;
523523
this.operator = operator;
524524
if (value < 0) {
@@ -532,7 +532,7 @@ public <R> R accept(Visitor<R> visitor) {
532532
return visitor.visit(this);
533533
}
534534

535-
public long getValue() {
535+
public int getValue() {
536536
return value;
537537
}
538538

@@ -541,11 +541,11 @@ public Column<?> getColumn() {
541541
}
542542

543543
public <R> R filter(
544-
Function<Long, R> onEq,
545-
Function<Long, R> onLt,
546-
Function<Long, R> onLtEq,
547-
Function<Long, R> onGt,
548-
Function<Long, R> onGtEq) {
544+
Function<Integer, R> onEq,
545+
Function<Integer, R> onLt,
546+
Function<Integer, R> onLtEq,
547+
Function<Integer, R> onGt,
548+
Function<Integer, R> onGtEq) {
549549
if (operator == Operator.EQ) {
550550
return onEq.apply(value);
551551
} else if (operator == Operator.LT) {

parquet-column/src/main/java/org/apache/parquet/filter2/recordlevel/IncrementallyUpdatedFilterPredicate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public void reset() {
225225
}
226226

227227
class CountingValueInspector extends ValueInspector {
228-
private long observedValueCount;
228+
private int observedValueCount;
229229
private final ValueInspector delegate;
230230

231231
/**
@@ -236,9 +236,9 @@ class CountingValueInspector extends ValueInspector {
236236
* underlying `lt(3)` predicate to be evaluated on the first or second elements of the array, since it would
237237
* return a premature True value.
238238
*/
239-
private final Function<Long, Boolean> shouldUpdateDelegate;
239+
private final Function<Integer, Boolean> shouldUpdateDelegate;
240240

241-
public CountingValueInspector(ValueInspector delegate, Function<Long, Boolean> shouldUpdateDelegate) {
241+
public CountingValueInspector(ValueInspector delegate, Function<Integer, Boolean> shouldUpdateDelegate) {
242242
this.observedValueCount = 0;
243243
this.delegate = delegate;
244244
this.shouldUpdateDelegate = shouldUpdateDelegate;

parquet-column/src/main/java/org/apache/parquet/filter2/recordlevel/IncrementallyUpdatedFilterPredicateBuilderBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
*/
6161
public abstract class IncrementallyUpdatedFilterPredicateBuilderBase
6262
implements Visitor<IncrementallyUpdatedFilterPredicate> {
63-
static final Operators.LongColumn SIZE_PSUEDOCOLUMN = FilterApi.longColumn("$SIZE");
63+
static final Operators.IntColumn SIZE_PSUEDOCOLUMN = FilterApi.intColumn("$SIZE");
6464

6565
private boolean built = false;
6666
private final Map<ColumnPath, List<ValueInspector>> valueInspectorsByColumn = new HashMap<>();
@@ -80,7 +80,7 @@ public IncrementallyUpdatedFilterPredicateBuilderBase(List<PrimitiveColumnIO> le
8080
SIZE_PSUEDOCOLUMN.getColumnPath(),
8181
new PrimitiveType(
8282
Type.Repetition.REQUIRED,
83-
PrimitiveType.PrimitiveTypeName.INT64,
83+
PrimitiveType.PrimitiveTypeName.INT32,
8484
SIZE_PSUEDOCOLUMN.getColumnPath().toDotString())
8585
.comparator());
8686
}

0 commit comments

Comments
 (0)