Skip to content

Commit

Permalink
More array type fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
lriggs committed Apr 26, 2024
1 parent 281283f commit 207ca8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions java/gandiva/src/main/cpp/expression_registry_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ void ArrowToProtobuf(DataTypePtr type, gandiva::types::ExtGandivaType* gandiva_d
gandiva_data_type->set_intervaltype(gandiva::types::IntervalType::DAY_TIME);
break;
case arrow::Type::LIST: {
gandiva_data_type->set_type(types::GandivaType::LIST);
gandiva_data_type->set_type(gandiva::types::GandivaType::LIST);
if (type->num_fields() <= 0) {
break;
}
if (type->fields()[0]->type()->id() != arrow::Type::LIST) {
types::ExtGandivaType gt;
gandiva::types::ExtGandivaType gt;
ArrowToProtobuf(type->fields()[0]->type(), &gt);
gandiva_data_type->set_listtype(gt.type());
}
Expand Down
14 changes: 7 additions & 7 deletions java/gandiva/src/main/cpp/jni_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ DataTypePtr ProtoTypeToInterval(const gandiva::types::ExtGandivaType& ext_type)
}
}

DataTypePtr ProtoTypeToList(const types::ExtGandivaType& ext_type) {
DataTypePtr ProtoTypeToList(const gandiva::types::ExtGandivaType& ext_type) {
DataTypePtr childType = SimpleProtoTypeToDataType(ext_type.listtype());
return arrow::list(childType);
}

DataTypePtr SimpleProtoTypeToDataType(const types::GandivaType& gandiva_type) {
DataTypePtr SimpleProtoTypeToDataType(const gandiva::types::GandivaType& gandiva_type) {
switch (gandiva_type) {
case types::NONE:
case gandiva::types::NONE:
return arrow::null();
case gandiva::types::BOOL:
return arrow::boolean();
Expand Down Expand Up @@ -264,9 +264,9 @@ DataTypePtr SimpleProtoTypeToDataType(const types::GandivaType& gandiva_type) {



DataTypePtr ProtoTypeToDataType(const types::ExtGandivaType& ext_type) {
DataTypePtr ProtoTypeToDataType(const gandiva::types::ExtGandivaType& ext_type) {
switch (ext_type.type()) {
case types::DECIMAL:
case gandiva::types::DECIMAL:
// TODO: error handling
return arrow::decimal(ext_type.precision(), ext_type.scale());
case gandiva::types::TIME32:
Expand All @@ -291,8 +291,8 @@ DataTypePtr ProtoTypeToDataType(const types::ExtGandivaType& ext_type) {
}
}

DataTypePtr ProtoTypeToDataType(const types::Field& f) {
const types::ExtGandivaType& ext_type = f.type();
DataTypePtr ProtoTypeToDataType(const gandiva::types::Field& f) {
const gandiva::types::ExtGandivaType& ext_type = f.type();
if (ext_type.type() == gandiva::types::LIST) {
if (f.children().size() > 0 && f.children()[0].type().type() != gandiva::types::LIST) {
DataTypePtr childType = ProtoTypeToDataType(f.children()[0].type());
Expand Down

0 comments on commit 207ca8a

Please sign in to comment.