float support

This commit is contained in:
Colin Dellow 2018-03-03 20:57:09 -05:00
parent 18f07f4c43
commit 67b0d96967
3 changed files with 12 additions and 10 deletions

View File

@ -178,6 +178,7 @@ static int parquetColumn(
sqlite3_result_int(ctx, rv); sqlite3_result_int(ctx, rv);
break; break;
} }
case parquet::Type::FLOAT:
case parquet::Type::DOUBLE: case parquet::Type::DOUBLE:
{ {
double rv = cursor->getDouble(col); double rv = cursor->getDouble(col);
@ -199,7 +200,6 @@ static int parquetColumn(
sqlite3_result_int64(ctx, rv); sqlite3_result_int64(ctx, rv);
break; break;
} }
case parquet::Type::FLOAT:
case parquet::Type::FIXED_LEN_BYTE_ARRAY: case parquet::Type::FIXED_LEN_BYTE_ARRAY:
default: default:
// Should be impossible to get here as we should have forbidden this at // Should be impossible to get here as we should have forbidden this at

View File

@ -86,6 +86,17 @@ void ParquetCursor::ensureColumn(int col) {
} }
break; break;
} }
case parquet::Type::FLOAT:
{
parquet::FloatScanner* s = (parquet::FloatScanner*)scanners[col].get();
float rv = 0;
if(s->NextValue(&rv, &wasNull)) {
colDoubleValues[col] = rv;
} else {
throw std::invalid_argument("unexpectedly lacking a next value");
}
break;
}
case parquet::Type::DOUBLE: case parquet::Type::DOUBLE:
{ {
parquet::DoubleScanner* s = (parquet::DoubleScanner*)scanners[col].get(); parquet::DoubleScanner* s = (parquet::DoubleScanner*)scanners[col].get();
@ -157,7 +168,6 @@ void ParquetCursor::ensureColumn(int col) {
} }
break; break;
} }
case parquet::Type::FLOAT:
case parquet::Type::FIXED_LEN_BYTE_ARRAY: case parquet::Type::FIXED_LEN_BYTE_ARRAY:
default: default:
// Should be impossible to get here as we should have forbidden this at // Should be impossible to get here as we should have forbidden this at

View File

@ -41,14 +41,6 @@ public:
long getInt64(int col); long getInt64(int col);
double getDouble(int col); double getDouble(int col);
parquet::ByteArray* getByteArray(int col); parquet::ByteArray* getByteArray(int col);
/*
sqlite3_result_double()
sqlite3_result_int()
sqlite3_result_int64()
sqlite3_result_null()
sqlite3_result_text()
*/
}; };
#endif #endif