You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by pr...@apache.org on 2020/03/15 14:31:05 UTC

[arrow] branch master updated: ARROW-8096: [C++][Gandiva] fix TreeExprBuilder::MakeNull to create node for interval type

This is an automated email from the ASF dual-hosted git repository.

praveenbingo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 293040d  ARROW-8096: [C++][Gandiva] fix TreeExprBuilder::MakeNull to create node for interval type
293040d is described below

commit 293040d3a40e303ec0d1a681beaf0e4dff385cc3
Author: Prudhvi Porandla <pr...@icloud.com>
AuthorDate: Sun Mar 15 20:00:41 2020 +0530

    ARROW-8096: [C++][Gandiva] fix TreeExprBuilder::MakeNull to create node for interval type
    
    Closes #6598 from pprudhvi/intervalnull and squashes the following commits:
    
    a53d4eb9e <Prudhvi Porandla> null node creation for interval type
    
    Authored-by: Prudhvi Porandla <pr...@icloud.com>
    Signed-off-by: Praveen <pr...@dremio.com>
---
 cpp/src/gandiva/tree_expr_builder.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cpp/src/gandiva/tree_expr_builder.cc b/cpp/src/gandiva/tree_expr_builder.cc
index eb253f9..4f360e0 100644
--- a/cpp/src/gandiva/tree_expr_builder.cc
+++ b/cpp/src/gandiva/tree_expr_builder.cc
@@ -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);