Skip to content

Commit

Permalink
GH-45517: [GLib] garrow_data_type_new_raw() returns GARROW_TYPE_STRIN…
Browse files Browse the repository at this point in the history
…G_VIEW_DATA_TYPE (#45518)

### Rationale for this change

The #44686 introduced `GArrowStringViewDataType`.
It was missed the one work. It is necessary that `garrow_data_type_new_raw()` returns `GARROW_TYPE_STRING_VIEW_DATA_TYPE`.

### What changes are included in this PR?

 `garrow_data_type_new_raw()` returns `GARROW_TYPE_STRING_VIEW_DATA_TYPE`
if the input data type is `arrow::Type::type::STRING_VIEW`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #45517

Authored-by: Hiroyuki Sato <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
hiroyuki-sato authored Feb 13, 2025
1 parent fdd3e15 commit cc861b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions c_glib/arrow-glib/basic-data-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,9 @@ garrow_data_type_new_raw(std::shared_ptr<arrow::DataType> *arrow_data_type)
case arrow::Type::type::RUN_END_ENCODED:
type = GARROW_TYPE_RUN_END_ENCODED_DATA_TYPE;
break;
case arrow::Type::type::STRING_VIEW:
type = GARROW_TYPE_STRING_VIEW_DATA_TYPE;
break;
default:
type = GARROW_TYPE_DATA_TYPE;
break;
Expand Down
7 changes: 7 additions & 0 deletions c_glib/test/test-string-view-data-type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ def test_to_s
data_type = Arrow::StringViewDataType.new
assert_equal("string_view", data_type.to_s)
end

def test_export
data_type = Arrow::StringViewDataType.new
c_abi_schema = data_type.export
assert_equal(data_type,
Arrow::DataType.import(c_abi_schema))
end
end

0 comments on commit cc861b5

Please sign in to comment.