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

Method values

datafusion/expr/src/logical_plan/builder.rs:210–231  ·  view source on GitHub ↗

Create a values list based relation, and the schema is inferred from data, consuming `value`. See the [Postgres VALUES](https://www.postgresql.org/docs/current/queries-values.html) documentation for more details. so it's usually better to override the default names with a table alias list. If the values include params/binders such as $1, $2, $3, etc, then the `param_data_types` should be provide

(values: Vec<Vec<Expr>>)

Source from the content-addressed store, hash-verified

208 ///
209 /// If the values include params/binders such as $1, $2, $3, etc, then the `param_data_types` should be provided.
210 pub fn values(values: Vec<Vec<Expr>>) -> Result<Self> {
211 if values.is_empty() {
212 return plan_err!("Values list cannot be empty");
213 }
214 let n_cols = values[0].len();
215 if n_cols == 0 {
216 return plan_err!("Values list cannot be zero length");
217 }
218 for (i, row) in values.iter().enumerate() {
219 if row.len() != n_cols {
220 return plan_err!(
221 "Inconsistent data length across values list: got {} values in row {} but expected {}",
222 row.len(),
223 i,
224 n_cols
225 );
226 }
227 }
228
229 // Infer from data itself
230 Self::infer_data(values)
231 }
232
233 /// Create a values list based relation, and the schema is inferred from data itself or table schema if provided, consuming
234 /// `value`. See the [Postgres VALUES](https://www.postgresql.org/docs/current/queries-values.html)

Callers 15

mainFunction · 0.45
evaluateMethod · 0.45
evaluateMethod · 0.45
executeMethod · 0.45
all_extension_typesMethod · 0.45
scalar_to_sqlMethod · 0.45
hash_primitive_valuesFunction · 0.45
get_list_valuesFunction · 0.45
str_to_map_implFunction · 0.45
spark_space_arrayFunction · 0.45

Calls 3

is_emptyMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45

Tested by 3

round_trip_literalsFunction · 0.36