Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
Impala 2.3.0, Impala 2.5.0, Impala 2.4.0, Impala 2.6.0, Impala 2.7.0
Description
When scanning a DECIMAL-typed column with precision <= 9 a data source scan node may return incorrect results.
The reason is that 8 bytes are accidentally written to a 4 byte slot because of a missing break in a switch. See data-source-scan-node.cc:
... inline Status SetDecimalVal(const ColumnType& type, char* bytes, int len, void* slot) { uint8_t* buffer = reinterpret_cast<uint8_t*>(bytes); switch (type.GetByteSize()) { case 4: { Decimal4Value* val = reinterpret_cast<Decimal4Value*>(slot); if (UNLIKELY(len > sizeof(Decimal4Value) || ParquetPlainEncoder::Decode(buffer, buffer + len, len, val) < 0)) { return Status(ERROR_INVALID_DECIMAL); } <-- missing break, falling through to case 8 } case 8: { Decimal8Value* val = reinterpret_cast<Decimal8Value*>(slot); if (UNLIKELY(len > sizeof(Decimal8Value) || ParquetPlainEncoder::Decode(buffer, buffer + len, len, val) < 0)) { return Status(ERROR_INVALID_DECIMAL); } break; } ...