Skip to content

Commit

Permalink
[Go & Cpp] Fix set type values error (#65)
Browse files Browse the repository at this point in the history
Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby committed Sep 28, 2023
1 parent c9eb20b commit 2b69464
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
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

0 comments on commit 2b69464

Please sign in to comment.