Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.github.dfa1.vortex.reader.array.FloatArray;
import io.github.dfa1.vortex.reader.array.IntArray;
import io.github.dfa1.vortex.reader.array.LongArray;
import io.github.dfa1.vortex.reader.array.MaskedArray;
import io.github.dfa1.vortex.reader.array.ShortArray;
import io.github.dfa1.vortex.reader.array.VarBinArray;
import io.github.dfa1.vortex.csv.CsvExporter;
Expand Down Expand Up @@ -158,6 +159,8 @@ private static RowPredicate toRowPredicate(RowFilter filter) {
(chunk, rowIdx) -> compareValue(chunk.column(col), rowIdx, (Comparable<?>) val) == 0;
case RowFilter.Neq(var col, var val) ->
(chunk, rowIdx) -> compareValue(chunk.column(col), rowIdx, (Comparable<?>) val) != 0;
case RowFilter.IsNull(var col) -> (chunk, rowIdx) -> isRowNull(chunk.column(col), rowIdx);
case RowFilter.IsNotNull(var col) -> (chunk, rowIdx) -> !isRowNull(chunk.column(col), rowIdx);
case RowFilter.And(var filters) -> {
RowPredicate[] preds = filters.stream().map(FilterCommand::toRowPredicate).toArray(RowPredicate[]::new);
yield (chunk, rowIdx) -> {
Expand All @@ -172,6 +175,11 @@ private static RowPredicate toRowPredicate(RowFilter filter) {
};
}

// Only a masked column carries nulls; an unmasked array is null-free, so every row is non-null.
private static boolean isRowNull(Array arr, long rowIdx) {
return arr instanceof MaskedArray masked && !masked.isValid(rowIdx);
}

private static int compareValue(Array arr, long rowIdx, Comparable<?> value) {
return switch (arr) {
case LongArray la -> compareNumeric(la.getLong(rowIdx), value);
Expand Down