diff --git a/parquet/parquet_cursor.cc b/parquet/parquet_cursor.cc index de0eeaf..03b6e05 100644 --- a/parquet/parquet_cursor.cc +++ b/parquet/parquet_cursor.cc @@ -7,8 +7,8 @@ ParquetCursor::ParquetCursor(ParquetTable* table) { } bool ParquetCursor::currentRowGroupSatisfiesRowIdFilter(Constraint& constraint) { - int64_t target = constraint.getInt(); - switch(constraint.getOperator()) { + int64_t target = constraint.intValue; + switch(constraint.op) { case IsNull: return false; case Is: @@ -30,7 +30,6 @@ bool ParquetCursor::currentRowGroupSatisfiesRowIdFilter(Constraint& constraint) } bool ParquetCursor::currentRowGroupSatisfiesTextFilter(Constraint& constraint, std::shared_ptr _stats) { - std::vector target = constraint.getBytes(); parquet::TypedRowGroupStatistics>* stats = (parquet::TypedRowGroupStatistics>*)_stats.get(); @@ -38,18 +37,18 @@ bool ParquetCursor::currentRowGroupSatisfiesTextFilter(Constraint& constraint, s return true; } - if(constraint.getType() != Text) { + if(constraint.type != Text) { return true; } - const std::string& str = constraint.getString(); + const std::string& str = constraint.stringValue; const parquet::ByteArray& min = stats->min(); const parquet::ByteArray& max = stats->max(); std::string minStr((const char*)min.ptr, min.len); std::string maxStr((const char*)max.ptr, max.len); // printf("min=%s [%d], max=%s [%d], target=%s\n", minStr.data(), min.len, maxStr.data(), max.len, str.data()); - switch(constraint.getOperator()) { + switch(constraint.op) { case Is: case Equal: return str >= minStr && str <= maxStr; @@ -75,14 +74,14 @@ bool ParquetCursor::currentRowGroupSatisfiesDoubleFilter(Constraint& constraint, } bool ParquetCursor::currentRowSatisfiesTextFilter(Constraint& constraint) { - if(constraint.getType() != Text) { + if(constraint.type != Text) { return true; } - const std::vector& blob = constraint.getBytes(); - parquet::ByteArray* ba = getByteArray(constraint.getColumn()); + const std::vector& blob = constraint.blobValue; + parquet::ByteArray* ba = getByteArray(constraint.column); - switch(constraint.getOperator()) { + switch(constraint.op) { case Is: case Equal: if(blob.size() != ba->len) @@ -120,8 +119,8 @@ bool ParquetCursor::currentRowSatisfiesDoubleFilter(Constraint& constraint) { // data, which provides substantial performance benefits. bool ParquetCursor::currentRowGroupSatisfiesFilter() { for(unsigned int i = 0; i < constraints.size(); i++) { - int column = constraints[i].getColumn(); - int op = constraints[i].getOperator(); + int column = constraints[i].column; + int op = constraints[i].op; bool rv = true; if(column == -1) { @@ -224,9 +223,9 @@ start: bool ParquetCursor::currentRowSatisfiesFilter() { for(unsigned int i = 0; i < constraints.size(); i++) { bool rv = true; - int column = constraints[i].getColumn(); + int column = constraints[i].column; ensureColumn(column); - int op = constraints[i].getOperator(); + int op = constraints[i].op; if(op == IsNull) { rv = isNull(column); diff --git a/parquet/parquet_filter.cc b/parquet/parquet_filter.cc index 1af14eb..765d6ae 100644 --- a/parquet/parquet_filter.cc +++ b/parquet/parquet_filter.cc @@ -18,31 +18,3 @@ Constraint::Constraint( if(type == Text) stringValue = std::string((char*)&blobValue[0], blobValue.size()); } - -int Constraint::getColumn() { - return column; -} - -ConstraintOperator Constraint::getOperator() { - return op; -} - -ValueType Constraint::getType() { - return type; -} - -int64_t Constraint::getInt() { - return intValue; -} - -double Constraint::getDouble() { - return doubleValue; -} - -const std::vector& Constraint::getBytes() { - return blobValue; -} - -const std::string& Constraint::getString() { - return stringValue; -} diff --git a/parquet/parquet_filter.h b/parquet/parquet_filter.h index ae5a535..d042ff4 100644 --- a/parquet/parquet_filter.h +++ b/parquet/parquet_filter.h @@ -31,16 +31,6 @@ enum ValueType { }; class Constraint { - int column; // underlying column in the query - ConstraintOperator op; - ValueType type; - - int64_t intValue; - double doubleValue; - std::vector blobValue; - // Only set when blobValue is set - std::string stringValue; - public: // Kind of a messy constructor function, but it's just for internal use, so whatever. Constraint( @@ -52,13 +42,15 @@ public: std::vector blobValue ); - int getColumn(); - ConstraintOperator getOperator(); - ValueType getType(); - int64_t getInt(); - double getDouble(); - const std::vector& getBytes(); - const std::string& getString(); + int column; // underlying column in the query + ConstraintOperator op; + ValueType type; + + int64_t intValue; + double doubleValue; + std::vector blobValue; + // Only set when blobValue is set + std::string stringValue; }; #endif