#ifndef PARQUET_CURSOR_H #define PARQUET_CURSOR_H #include "parquet_filter.h" #include "parquet_table.h" #include "parquet/api/reader.h" class ParquetCursor { ParquetTable* table; std::unique_ptr reader; std::unique_ptr rowGroupMetadata; std::shared_ptr rowGroup; std::vector> scanners; std::vector types; std::vector logicalTypes; std::vector colRows; std::vector colNulls; std::vector colIntValues; std::vector colDoubleValues; std::vector colByteArrayValues; int rowId; int rowGroupId; int rowGroupStartRowId; int rowGroupSize; int numRows; int numRowGroups; int rowsLeftInRowGroup; bool nextRowGroup(); std::vector constraints; bool currentRowSatisfiesFilter(); bool currentRowGroupSatisfiesFilter(); bool currentRowGroupSatisfiesRowIdFilter(Constraint& constraint); bool currentRowGroupSatisfiesTextFilter(Constraint& constraint, std::shared_ptr stats); bool currentRowGroupSatisfiesBlobFilter(Constraint& constraint, std::shared_ptr stats); bool currentRowGroupSatisfiesIntegerFilter(Constraint& constraint, std::shared_ptr stats); bool currentRowGroupSatisfiesDoubleFilter(Constraint& constraint, std::shared_ptr stats); bool currentRowSatisfiesTextFilter(Constraint& constraint); bool currentRowSatisfiesIntegerFilter(Constraint& constraint); bool currentRowSatisfiesDoubleFilter(Constraint& constraint); public: ParquetCursor(ParquetTable* table); int getRowId(); void next(); void close(); void reset(std::vector constraints); bool eof(); void ensureColumn(int col); bool isNull(int col); unsigned int getNumRowGroups() const; unsigned int getNumConstraints() const; const Constraint& getConstraint(unsigned int i) const; parquet::Type::type getPhysicalType(int col); parquet::ConvertedType::type getLogicalType(int col); ParquetTable* getTable() const; int getInt32(int col); long getInt64(int col); double getDouble(int col); parquet::ByteArray* getByteArray(int col); }; #endif