From edb0fc5a382a76457a0d74204827f609ed9ebba7 Mon Sep 17 00:00:00 2001 From: praveenbingo Date: Mon, 23 Jul 2018 10:55:11 +0530 Subject: [PATCH] GDV-94:[C++][Java]Fixed literals and nulls for time types. (#72) Added support for literals and null for time types. --- src/codegen/llvm_generator.cc | 16 ++++++++++++++++ src/codegen/tree_expr_builder.cc | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/codegen/llvm_generator.cc b/src/codegen/llvm_generator.cc index fe0dae1c3c87a..fb862ae10ea44 100644 --- a/src/codegen/llvm_generator.cc +++ b/src/codegen/llvm_generator.cc @@ -523,6 +523,22 @@ void LLVMGenerator::Visitor::Visit(const LiteralDex &dex) { break; } + case arrow::Type::DATE64: + value = types->i64_constant(boost::get(dex.holder())); + break; + + case arrow::Type::TIME32: + value = types->i32_constant(boost::get(dex.holder())); + break; + + case arrow::Type::TIME64: + value = types->i64_constant(boost::get(dex.holder())); + break; + + case arrow::Type::TIMESTAMP: + value = types->i64_constant(boost::get(dex.holder())); + break; + default: DCHECK(0); } diff --git a/src/codegen/tree_expr_builder.cc b/src/codegen/tree_expr_builder.cc index 9f81a8f2f26a2..5c56454215b27 100644 --- a/src/codegen/tree_expr_builder.cc +++ b/src/codegen/tree_expr_builder.cc @@ -78,6 +78,14 @@ NodePtr TreeExprBuilder::MakeNull(DataTypePtr data_type) { case arrow::Type::STRING: case arrow::Type::BINARY: return std::make_shared(data_type, LiteralHolder(empty), true); + case arrow::Type::DATE64: + return std::make_shared(data_type, LiteralHolder((int64_t)0), true); + case arrow::Type::TIME32: + return std::make_shared(data_type, LiteralHolder((int32_t)0), true); + case arrow::Type::TIME64: + return std::make_shared(data_type, LiteralHolder((int64_t)0), true); + case arrow::Type::TIMESTAMP: + return std::make_shared(data_type, LiteralHolder((int64_t)0), true); default: return nullptr; }