Skip to content

Commit

Permalink
support tinyint in SelectiveColumnReader
Browse files Browse the repository at this point in the history
  • Loading branch information
yma11 committed Oct 7, 2023
1 parent 1910a17 commit fdab780
Showing 1 changed file with 55 additions and 45 deletions.
100 changes: 55 additions & 45 deletions velox/dwio/common/SelectiveColumnReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void SelectiveColumnReader::getIntValues(
const TypePtr& requestedType,
VectorPtr* result) {
switch (requestedType->kind()) {
case TypeKind::SMALLINT: {
case TypeKind::SMALLINT:
switch (valueSize_) {
case 8:
getFlatValues<int64_t, int16_t>(rows, result, requestedType);
Expand All @@ -164,50 +164,60 @@ void SelectiveColumnReader::getIntValues(
VELOX_FAIL("Unsupported value size: {}", valueSize_);
}
break;
case TypeKind::INTEGER:
switch (valueSize_) {
case 8:
getFlatValues<int64_t, int32_t>(rows, result, requestedType);
break;
case 4:
getFlatValues<int32_t, int32_t>(rows, result, requestedType);
break;
case 2:
getFlatValues<int16_t, int32_t>(rows, result, requestedType);
break;
default:
VELOX_FAIL("Unsupported value size: {}", valueSize_);
}
break;
case TypeKind::DATE:
getFlatValues<Date, Date>(rows, result, requestedType);
break;
case TypeKind::HUGEINT:
getFlatValues<int128_t, int128_t>(rows, result, requestedType);
break;
case TypeKind::TIMESTAMP:
getFlatValues<Timestamp, Timestamp>(rows, result, requestedType);
break;
case TypeKind::BIGINT:
switch (valueSize_) {
case 8:
getFlatValues<int64_t, int64_t>(rows, result, requestedType);
break;
case 4:
getFlatValues<int32_t, int64_t>(rows, result, requestedType);
break;
case 2:
getFlatValues<int16_t, int64_t>(rows, result, requestedType);
break;
default:
VELOX_FAIL("Unsupported value size: {}", valueSize_);
}
break;
default:
VELOX_FAIL(
"Not a valid type for integer reader: {}",
requestedType->toString());
}
case TypeKind::TINYINT:
switch (valueSize_) {
case 4:
getFlatValues<int32_t, int8_t>(rows, result, requestedType);
break;
case 2:
getFlatValues<int16_t, int8_t>(rows, result, requestedType);
break;
default:
VELOX_FAIL("Unsupported value size: {}", valueSize_);
}
break;
case TypeKind::INTEGER:
switch (valueSize_) {
case 8:
getFlatValues<int64_t, int32_t>(rows, result, requestedType);
break;
case 4:
getFlatValues<int32_t, int32_t>(rows, result, requestedType);
break;
case 2:
getFlatValues<int16_t, int32_t>(rows, result, requestedType);
break;
default:
VELOX_FAIL("Unsupported value size: {}", valueSize_);
}
break;
case TypeKind::DATE:
getFlatValues<Date, Date>(rows, result, requestedType);
break;
case TypeKind::HUGEINT:
getFlatValues<int128_t, int128_t>(rows, result, requestedType);
break;
case TypeKind::TIMESTAMP:
getFlatValues<Timestamp, Timestamp>(rows, result, requestedType);
break;
case TypeKind::BIGINT:
switch (valueSize_) {
case 8:
getFlatValues<int64_t, int64_t>(rows, result, requestedType);
break;
case 4:
getFlatValues<int32_t, int64_t>(rows, result, requestedType);
break;
case 2:
getFlatValues<int16_t, int64_t>(rows, result, requestedType);
break;
default:
VELOX_FAIL("Unsupported value size: {}", valueSize_);
}
break;
default:
VELOX_FAIL(
"Not a valid type for integer reader: {}", requestedType->toString());
}
}

Expand Down

0 comments on commit fdab780

Please sign in to comment.