Skip to content

Commit

Permalink
ARROW-8130: [C++][Gandiva] fix dex visitor to handle interval type
Browse files Browse the repository at this point in the history
Closes #6629 from pprudhvi/intervalnull

Authored-by: Prudhvi Porandla <prudhvi.porandla@icloud.com>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
  • Loading branch information
pprudhvi authored and wesm committed Mar 17, 2020
1 parent e359930 commit 1078dc4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cpp/src/gandiva/llvm_generator.cc
@@ -1,4 +1,4 @@
// Licensed to the Apache Software Foundation (ASF) under one
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
Expand Down Expand Up @@ -708,6 +708,17 @@ void LLVMGenerator::Visitor::Visit(const LiteralDex& dex) {
value = types->i64_constant(arrow::util::get<int64_t>(dex.holder()));
break;

case arrow::Type::INTERVAL: {
std::shared_ptr<arrow::IntervalType> interval_type =
arrow::internal::checked_pointer_cast<arrow::IntervalType>(dex.type());
if (interval_type->interval_type() == arrow::IntervalType::type::MONTHS) {
value = types->i32_constant(arrow::util::get<int32_t>(dex.holder()));
} else {
value = types->i64_constant(arrow::util::get<int64_t>(dex.holder()));
}
break;
}

case arrow::Type::DECIMAL: {
// build code for struct
auto scalar = arrow::util::get<DecimalScalar128>(dex.holder());
Expand Down

0 comments on commit 1078dc4

Please sign in to comment.