From 4cbde9fc09ebeac55e591b1fe531e272e54ec29f Mon Sep 17 00:00:00 2001 From: Colin Dellow Date: Sat, 17 Mar 2018 16:09:57 -0400 Subject: [PATCH] Row filtering for doubles --- parquet/parquet_cursor.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/parquet/parquet_cursor.cc b/parquet/parquet_cursor.cc index f2bdf60..806ae77 100644 --- a/parquet/parquet_cursor.cc +++ b/parquet/parquet_cursor.cc @@ -370,6 +370,34 @@ bool ParquetCursor::currentRowSatisfiesIntegerFilter(Constraint& constraint) { } bool ParquetCursor::currentRowSatisfiesDoubleFilter(Constraint& constraint) { + if(constraint.type != Double) { + return true; + } + + int column = constraint.column; + double value = getDouble(column); + double constraintValue = constraint.doubleValue; + + switch(constraint.op) { + case Is: + case Equal: + return constraintValue == value; + case IsNot: + case NotEqual: + return constraintValue != value; + case GreaterThan: + return value > constraintValue; + case GreaterThanOrEqual: + return value >= constraintValue; + case LessThan: + return value < constraintValue; + case LessThanOrEqual: + return value <= constraintValue; + case Like: + default: + return true; + } + return true; }