Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go & Cpp] Fix set type values error #65

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions cpp/src/common/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ Result<std::unique_ptr<schema_proto::Field>> ToProtobufField(const arrow::Field*

Status SetTypeValues(schema_proto::DataType* proto_type, const arrow::DataType* type) {
switch (type->id()) {
case arrow::Type::INT64: {
proto_type->set_logic_type(schema_proto::LogicType::INT64);
break;
}
case arrow::Type::FIXED_SIZE_BINARY: {
auto real_type = dynamic_cast<const arrow::FixedSizeBinaryType*>(type);
auto fixed_size_binary_type = new schema_proto::FixedSizeBinaryType();
Expand Down Expand Up @@ -88,7 +84,7 @@ Status SetTypeValues(schema_proto::DataType* proto_type, const arrow::DataType*
break;
}
default:
return Status::InvalidArgument("Invalid type id: " + std::to_string(type->id()));
return Status::OK();
}
return Status::OK();
}
Expand Down
11 changes: 0 additions & 11 deletions go/common/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ func ToProtobufField(field *arrow.Field) (*schema_proto.Field, error) {

func SetTypeValues(protoType *schema_proto.DataType, dataType arrow.DataType) error {
switch dataType.ID() {
case arrow.STRING:
stringType := schema_proto.LogicType_STRING
protoType = &schema_proto.DataType{LogicType: stringType}
break

case arrow.INT64:
int64Type := schema_proto.LogicType_INT64
protoType = &schema_proto.DataType{LogicType: int64Type}
break

case arrow.FIXED_SIZE_BINARY:
realType, ok := dataType.(*arrow.FixedSizeBinaryType)
if !ok {
Expand Down Expand Up @@ -159,7 +149,6 @@ func SetTypeValues(protoType *schema_proto.DataType, dataType arrow.DataType) er
break

default:
return fmt.Errorf("set type values with typeid %s : %w", dataType.ID().String(), ErrInvalidArgument)
}

return nil
Expand Down
Loading