persist row group clauses on EOF

...not on close. Fixes #9
This commit is contained in:
Colin Dellow 2018-06-23 16:25:56 -04:00
parent 6d4be61261
commit b9c58bd97e
1 changed files with 5 additions and 5 deletions

View File

@ -208,10 +208,6 @@ void persistConstraints(sqlite3* db, ParquetCursor* cursor) {
*/ */
static int parquetClose(sqlite3_vtab_cursor *cur){ static int parquetClose(sqlite3_vtab_cursor *cur){
sqlite3_vtab_cursor_parquet* vtab_cursor_parquet = (sqlite3_vtab_cursor_parquet*)cur; sqlite3_vtab_cursor_parquet* vtab_cursor_parquet = (sqlite3_vtab_cursor_parquet*)cur;
sqlite3_vtab_parquet* vtab_parquet = (sqlite3_vtab_parquet*)(vtab_cursor_parquet->base.pVtab);
ParquetCursor* cursor = vtab_cursor_parquet->cursor;
persistConstraints(vtab_parquet->db, cursor);
vtab_cursor_parquet->cursor->close(); vtab_cursor_parquet->cursor->close();
delete vtab_cursor_parquet->cursor; delete vtab_cursor_parquet->cursor;
sqlite3_free(cur); sqlite3_free(cur);
@ -382,8 +378,12 @@ static int parquetRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
*/ */
static int parquetEof(sqlite3_vtab_cursor *cur){ static int parquetEof(sqlite3_vtab_cursor *cur){
ParquetCursor* cursor = ((sqlite3_vtab_cursor_parquet*)cur)->cursor; ParquetCursor* cursor = ((sqlite3_vtab_cursor_parquet*)cur)->cursor;
if(cursor->eof()) if(cursor->eof()) {
sqlite3_vtab_cursor_parquet* vtab_cursor_parquet = (sqlite3_vtab_cursor_parquet*)cur;
sqlite3_vtab_parquet* vtab_parquet = (sqlite3_vtab_parquet*)(vtab_cursor_parquet->base.pVtab);
persistConstraints(vtab_parquet->db, cursor);
return 1; return 1;
}
return 0; return 0;
} }