MCPcopy Create free account
hub / github.com/apache/datafusion / str_to_map_inner

Function str_to_map_inner

datafusion/spark/src/function/map/str_to_map.rs:111–178  ·  view source on GitHub ↗
(args: &[ArrayRef])

Source from the content-addressed store, hash-verified

109}
110
111fn str_to_map_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
112 match args.len() {
113 1 => match args[0].data_type() {
114 DataType::Utf8 => str_to_map_impl(as_string_array(&args[0])?, None, None),
115 DataType::LargeUtf8 => {
116 str_to_map_impl(as_large_string_array(&args[0])?, None, None)
117 }
118 DataType::Utf8View => {
119 str_to_map_impl(as_string_view_array(&args[0])?, None, None)
120 }
121 other => exec_err!(
122 "Unsupported data type {other:?} for str_to_map, \
123 expected Utf8, LargeUtf8, or Utf8View"
124 ),
125 },
126 2 => match (args[0].data_type(), args[1].data_type()) {
127 (DataType::Utf8, DataType::Utf8) => str_to_map_impl(
128 as_string_array(&args[0])?,
129 Some(as_string_array(&args[1])?),
130 None,
131 ),
132 (DataType::LargeUtf8, DataType::LargeUtf8) => str_to_map_impl(
133 as_large_string_array(&args[0])?,
134 Some(as_large_string_array(&args[1])?),
135 None,
136 ),
137 (DataType::Utf8View, DataType::Utf8View) => str_to_map_impl(
138 as_string_view_array(&args[0])?,
139 Some(as_string_view_array(&args[1])?),
140 None,
141 ),
142 (t1, t2) => exec_err!(
143 "Unsupported data types ({t1:?}, {t2:?}) for str_to_map, \
144 expected matching Utf8, LargeUtf8, or Utf8View"
145 ),
146 },
147 3 => match (
148 args[0].data_type(),
149 args[1].data_type(),
150 args[2].data_type(),
151 ) {
152 (DataType::Utf8, DataType::Utf8, DataType::Utf8) => str_to_map_impl(
153 as_string_array(&args[0])?,
154 Some(as_string_array(&args[1])?),
155 Some(as_string_array(&args[2])?),
156 ),
157 (DataType::LargeUtf8, DataType::LargeUtf8, DataType::LargeUtf8) => {
158 str_to_map_impl(
159 as_large_string_array(&args[0])?,
160 Some(as_large_string_array(&args[1])?),
161 Some(as_large_string_array(&args[2])?),
162 )
163 }
164 (DataType::Utf8View, DataType::Utf8View, DataType::Utf8View) => {
165 str_to_map_impl(
166 as_string_view_array(&args[0])?,
167 Some(as_string_view_array(&args[1])?),
168 Some(as_string_view_array(&args[2])?),

Callers 1

invoke_with_argsMethod · 0.85

Calls 6

str_to_map_implFunction · 0.85
as_string_arrayFunction · 0.85
as_large_string_arrayFunction · 0.85
as_string_view_arrayFunction · 0.85
lenMethod · 0.45
data_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…