Skip to content
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
7 changes: 5 additions & 2 deletions c_glib/arrow-glib/basic-array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ G_BEGIN_DECLS
* string data. If you don't have Arrow format data, you need to
* use #GArrowLargeStringArrayBuilder to create a new array.
*
* #GArrayBinaryViewArray is a class for variable-size binary view array.
* #GArrowBinaryViewArray is a class for variable-size binary view array.
* It can store zero or more binary view data. If you don't have Arrow
* format data, you need to use #GArrowBinaryViewArrayBuilder to create
* a new array.
*
* #GArrayStringViewArray is a class for variable-size string view array.
* #GArrowStringViewArray is a class for variable-size string view array.
* It can store zero or more string view data. If you don't have Arrow
* format data, you need to use #GArrowStringViewArrayBuilder to create
* a new array.
Expand Down Expand Up @@ -4140,6 +4140,9 @@ garrow_array_new_raw_valist(std::shared_ptr<arrow::Array> *arrow_array,
case arrow::Type::type::RUN_END_ENCODED:
type = GARROW_TYPE_RUN_END_ENCODED_ARRAY;
break;
case arrow::Type::type::STRING_VIEW:
type = GARROW_TYPE_STRING_VIEW_ARRAY;
break;
case arrow::Type::type::BINARY_VIEW:
type = GARROW_TYPE_BINARY_VIEW_ARRAY;
break;
Expand Down
15 changes: 15 additions & 0 deletions c_glib/test/test-cast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,19 @@ def test_true
build_binary_array(["\xff"]).cast(string_data_type, options))
end
end

def test_string_view
values = ["a", nil, "b"]
string_view_data_type = Arrow::StringViewDataType.new
array = build_string_array(values).cast(string_view_data_type)
actual_values = array.length.times.collect do |i|
if array.null?(i)
nil
else
array.get_value(i).to_s
end
end
assert_equal([Arrow::StringViewArray, values],
[array.class, actual_values])
end
end
Loading