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

Method make_record_batch

benchmarks/src/dict.rs:386–421  ·  view source on GitHub ↗
(&self, query: &DictionaryQuery)

Source from the content-addressed store, hash-verified

384 }
385
386 fn make_record_batch(&self, query: &DictionaryQuery) -> Result<RecordBatch> {
387 let size = self.num_rows;
388
389 let col1 = generate_dict(
390 query.col.value_type,
391 query.col.cardinality,
392 query.col.null_percent,
393 size,
394 );
395
396 let (schema, columns): (Schema, Vec<ArrayRef>) = match &query.col2 {
397 None => {
398 let schema = Schema::new(vec![Field::new(
399 "dict_col",
400 col1.data_type().clone(),
401 true,
402 )]);
403 (schema, vec![col1])
404 }
405 Some(col2_params) => {
406 let col2 = generate_dict(
407 col2_params.value_type,
408 col2_params.cardinality,
409 col2_params.null_percent,
410 size,
411 );
412 let schema = Schema::new(vec![
413 Field::new("dict_col", col1.data_type().clone(), true),
414 Field::new("dict_col2", col2.data_type().clone(), true),
415 ]);
416 (schema, vec![col1, col2])
417 }
418 };
419
420 Ok(RecordBatch::try_new(Arc::new(schema), columns)?)
421 }
422
423 async fn execute_query_without_result_buffering(
424 sql: &str,

Callers 1

benchmark_queryMethod · 0.80

Calls 2

generate_dictFunction · 0.85
newFunction · 0.85

Tested by

no test coverage detected