MCPcopy Create free account
hub / github.com/apache/arrow / BinaryArrayFromStrings

Function BinaryArrayFromStrings

cpp/src/arrow/testing/builder.h:97–127  ·  view source on GitHub ↗

BinaryArrayFromStrings: construct an Array of any binary-like type from string values, dispatching on the runtime type id

Source from the content-addressed store, hash-verified

95// BinaryArrayFromStrings: construct an Array of any binary-like type from
96// string values, dispatching on the runtime type id
97inline std::shared_ptr<Array> BinaryArrayFromStrings(
98 const std::shared_ptr<DataType>& type, const std::vector<std::string>& values) {
99 std::shared_ptr<Array> array;
100 switch (type->id()) {
101 case Type::BINARY:
102 ArrayFromVector<BinaryType, std::string>(type, values, &array);
103 break;
104 case Type::STRING:
105 ArrayFromVector<StringType, std::string>(type, values, &array);
106 break;
107 case Type::LARGE_BINARY:
108 ArrayFromVector<LargeBinaryType, std::string>(type, values, &array);
109 break;
110 case Type::LARGE_STRING:
111 ArrayFromVector<LargeStringType, std::string>(type, values, &array);
112 break;
113 case Type::BINARY_VIEW:
114 ArrayFromVector<BinaryViewType, std::string>(type, values, &array);
115 break;
116 case Type::STRING_VIEW:
117 ArrayFromVector<StringViewType, std::string>(type, values, &array);
118 break;
119 case Type::FIXED_SIZE_BINARY:
120 ArrayFromVector<FixedSizeBinaryType, std::string>(type, values, &array);
121 break;
122 default:
123 ADD_FAILURE() << "unsupported type for binary test data: " << type->ToString();
124 break;
125 }
126 return array;
127}
128
129// ChunkedArrayFromVector: construct a ChunkedArray from vectors of C values
130

Callers 3

InvalidUtf8Function · 0.50
FixedSizeInvalidUtf8Function · 0.50
TEST_FFunction · 0.50

Calls 2

idMethod · 0.45
ToStringMethod · 0.45

Tested by 3

InvalidUtf8Function · 0.40
FixedSizeInvalidUtf8Function · 0.40
TEST_FFunction · 0.40