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

Function get_fixed_list_batch

datafusion/core/tests/dataframe/mod.rs:5233–5262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5231}
5232
5233fn get_fixed_list_batch() -> Result<RecordBatch, ArrowError> {
5234 let mut shape_id_builder = UInt32Builder::new();
5235 let mut tags_builder = FixedSizeListBuilder::new(StringBuilder::new(), 2);
5236
5237 for idx in 0..6 {
5238 // Append shape id.
5239 shape_id_builder.append_value(idx as u32 + 1);
5240
5241 if idx % 3 != 0 {
5242 tags_builder
5243 .values()
5244 .append_value(format!("tag{}1", idx + 1));
5245 tags_builder
5246 .values()
5247 .append_value(format!("tag{}2", idx + 1));
5248 tags_builder.append(true);
5249 } else {
5250 tags_builder.values().append_null();
5251 tags_builder.values().append_null();
5252 tags_builder.append(false);
5253 }
5254 }
5255
5256 let batch = RecordBatch::try_from_iter(vec![
5257 ("shape_id", Arc::new(shape_id_builder.finish()) as ArrayRef),
5258 ("tags", Arc::new(tags_builder.finish()) as ArrayRef),
5259 ])?;
5260
5261 Ok(batch)
5262}
5263
5264/// Create a table with different types of list columns and a string column.
5265async fn table_with_mixed_lists() -> Result<DataFrame> {

Callers 2

unnest_fixed_listFunction · 0.85

Calls 5

newFunction · 0.85
append_valueMethod · 0.45
valuesMethod · 0.45
appendMethod · 0.45
append_nullMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…