Skip to content

Commit

Permalink
ARROW-8096: [C++][Gandiva] fix TreeExprBuilder::MakeNull to create no…
Browse files Browse the repository at this point in the history
…de for interval type

Closes #6598 from pprudhvi/intervalnull and squashes the following commits:

a53d4eb <Prudhvi Porandla> null node creation for interval type

Authored-by: Prudhvi Porandla <prudhvi.porandla@icloud.com>
Signed-off-by: Praveen <praveen@dremio.com>
  • Loading branch information
pprudhvi authored and praveenbingo committed Mar 15, 2020
1 parent 567664b commit 293040d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cpp/src/gandiva/tree_expr_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ NodePtr TreeExprBuilder::MakeNull(DataTypePtr data_type) {
return std::make_shared<LiteralNode>(data_type, LiteralHolder((int64_t)0), true);
case arrow::Type::TIMESTAMP:
return std::make_shared<LiteralNode>(data_type, LiteralHolder((int64_t)0), true);
case arrow::Type::INTERVAL: {
std::shared_ptr<arrow::IntervalType> interval_type =
arrow::internal::checked_pointer_cast<arrow::IntervalType>(data_type);
if (interval_type->interval_type() == arrow::IntervalType::type::MONTHS) {
return std::make_shared<LiteralNode>(data_type, LiteralHolder((int32_t)0), true);
}
return std::make_shared<LiteralNode>(data_type, LiteralHolder((int64_t)0), true);
}
case arrow::Type::DECIMAL: {
std::shared_ptr<arrow::DecimalType> decimal_type =
arrow::internal::checked_pointer_cast<arrow::DecimalType>(data_type);
Expand Down

0 comments on commit 293040d

Please sign in to comment.