Skip to content

Commit

Permalink
GDV-94:[C++][Java]Fixed literals and nulls for time types. (apache#72)
Browse files Browse the repository at this point in the history
Added support for literals and null for time types.
  • Loading branch information
praveenbingo authored Jul 23, 2018
1 parent 983f8a7 commit edb0fc5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/codegen/llvm_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,22 @@ void LLVMGenerator::Visitor::Visit(const LiteralDex &dex) {
break;
}

case arrow::Type::DATE64:
value = types->i64_constant(boost::get<int64_t>(dex.holder()));
break;

case arrow::Type::TIME32:
value = types->i32_constant(boost::get<int32_t>(dex.holder()));
break;

case arrow::Type::TIME64:
value = types->i64_constant(boost::get<int64_t>(dex.holder()));
break;

case arrow::Type::TIMESTAMP:
value = types->i64_constant(boost::get<int64_t>(dex.holder()));
break;

default:
DCHECK(0);
}
Expand Down
8 changes: 8 additions & 0 deletions src/codegen/tree_expr_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ NodePtr TreeExprBuilder::MakeNull(DataTypePtr data_type) {
case arrow::Type::STRING:
case arrow::Type::BINARY:
return std::make_shared<LiteralNode>(data_type, LiteralHolder(empty), true);
case arrow::Type::DATE64:
return std::make_shared<LiteralNode>(data_type, LiteralHolder((int64_t)0), true);
case arrow::Type::TIME32:
return std::make_shared<LiteralNode>(data_type, LiteralHolder((int32_t)0), true);
case arrow::Type::TIME64:
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);
default:
return nullptr;
}
Expand Down

0 comments on commit edb0fc5

Please sign in to comment.