test/values/test-struct-array.rb in red-arrow-11.0.0 vs test/values/test-struct-array.rb in red-arrow-12.0.0
- old
+ new
@@ -421,16 +421,28 @@
},
values)
assert_equal(values, target.values)
end
+ def remove_union_field_names(values)
+ values.collect do |value|
+ if value.nil?
+ value
+ else
+ v = value["field"]
+ v = v.values[0] unless v.nil?
+ {"field" => v}
+ end
+ end
+ end
+
def test_sparse_union
- omit("Need to add support for SparseUnionArrayBuilder")
values = [
{"field" => {"field1" => true}},
nil,
{"field" => nil},
+ {"field" => {"field2" => 29}},
{"field" => {"field2" => nil}},
]
target = build({
type: :sparse_union,
fields: [
@@ -444,19 +456,20 @@
},
],
type_codes: [0, 1],
},
values)
- assert_equal(values, target.values)
+ assert_equal(remove_union_field_names(values),
+ target.values)
end
def test_dense_union
- omit("Need to add support for DenseUnionArrayBuilder")
values = [
{"field" => {"field1" => true}},
nil,
{"field" => nil},
+ {"field" => {"field2" => 29}},
{"field" => {"field2" => nil}},
]
target = build({
type: :dense_union,
fields: [
@@ -470,26 +483,25 @@
},
],
type_codes: [0, 1],
},
values)
- assert_equal(values, target.values)
+ assert_equal(remove_union_field_names(values),
+ target.values)
end
def test_dictionary
- omit("Need to add support for DictionaryArrayBuilder")
values = [
{"field" => "Ruby"},
nil,
{"field" => nil},
{"field" => "GLib"},
]
- dictionary = Arrow::StringArray.new(["GLib", "Ruby"])
target = build({
type: :dictionary,
index_data_type: :int8,
- dictionary: dictionary,
- ordered: true,
+ value_data_type: :string,
+ ordered: false,
},
values)
assert_equal(values, target.values)
end
end