Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ velox::variant VeloxExprConverter::getConstantValue(
case TypeKind::TIMESTAMP:
return valueVector->as<velox::SimpleVector<velox::Timestamp>>()->valueAt(
0);
case TypeKind::DATE:
return valueVector->as<velox::SimpleVector<velox::Date>>()->valueAt(0);
case TypeKind::BOOLEAN:
return valueVector->as<velox::SimpleVector<bool>>()->valueAt(0);
case TypeKind::DOUBLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int64_t dateToInt64(
const VeloxExprConverter& exprConverter,
const TypePtr& type) {
auto value = exprConverter.getConstantValue(type, *block);
return value.value<Date>().days();
return value.value<int32_t>();
}

double toDouble(
Expand Down Expand Up @@ -600,6 +600,9 @@ std::unique_ptr<common::Filter> toFilter(
const protocol::Range& range,
bool nullAllowed,
const VeloxExprConverter& exprConverter) {
if (type->isDate()) {
return dateRangeToFilter(range, nullAllowed, exprConverter, type);
}
switch (type->kind()) {
case TypeKind::TINYINT:
case TypeKind::SMALLINT:
Expand All @@ -616,8 +619,6 @@ std::unique_ptr<common::Filter> toFilter(
return boolRangeToFilter(range, nullAllowed, exprConverter, type);
case TypeKind::REAL:
return floatRangeToFilter(range, nullAllowed, exprConverter, type);
case TypeKind::DATE:
return dateRangeToFilter(range, nullAllowed, exprConverter, type);
default:
VELOX_UNSUPPORTED("Unsupported range type: {}", type->toString());
}
Expand Down Expand Up @@ -653,6 +654,17 @@ std::unique_ptr<common::Filter> toFilter(
return toFilter(type, ranges[0], nullAllowed, exprConverter);
}

if (type->isDate()) {
std::vector<std::unique_ptr<common::BigintRange>> dateFilters;
dateFilters.reserve(ranges.size());
for (const auto& range : ranges) {
dateFilters.emplace_back(
dateRangeToFilter(range, nullAllowed, exprConverter, type));
}
return std::make_unique<common::BigintMultiRange>(
std::move(dateFilters), nullAllowed);
}

if (type->kind() == TypeKind::BIGINT || type->kind() == TypeKind::INTEGER ||
type->kind() == TypeKind::SMALLINT ||
type->kind() == TypeKind::TINYINT) {
Expand All @@ -665,17 +677,6 @@ std::unique_ptr<common::Filter> toFilter(
return combineIntegerRanges(bigintFilters, nullAllowed);
}

if (type->kind() == TypeKind::DATE) {
std::vector<std::unique_ptr<common::BigintRange>> dateFilters;
dateFilters.reserve(ranges.size());
for (const auto& range : ranges) {
dateFilters.emplace_back(
dateRangeToFilter(range, nullAllowed, exprConverter, type));
}
return std::make_unique<common::BigintMultiRange>(
std::move(dateFilters), nullAllowed);
}

if (type->kind() == TypeKind::VARCHAR) {
std::vector<std::unique_ptr<common::BytesRange>> bytesFilters;
bytesFilters.reserve(ranges.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ TypePtr typeFromString(const std::string& typeName) {
return INTERVAL_YEAR_MONTH();
}

if (upper == DATE()->toString()) {
return DATE();
}

return createScalarType(mapNameToTypeKind(upper));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class RowExpressionTest : public ::testing::Test {
converter_->toVeloxExpr(p));

ASSERT_EQ(cexpr->type()->toString(), type);
ASSERT_EQ(cexpr->value().toJson(), value);
ASSERT_EQ(cexpr->value().toJson(cexpr->type()), value);
}

std::shared_ptr<memory::MemoryPool> pool_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ velox::VectorPtr readScalarBlock(
case velox::TypeKind::DOUBLE:
case velox::TypeKind::REAL:
case velox::TypeKind::VARCHAR:
case velox::TypeKind::DATE:
case velox::TypeKind::HUGEINT:
return std::make_shared<velox::FlatVector<U>>(
pool,
Expand Down
2 changes: 1 addition & 1 deletion presto-native-execution/velox
Submodule velox updated 151 files