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

Function create_struct_table_provider

datafusion/core/benches/sql_planner.rs:77–89  ·  view source on GitHub ↗

Create a table provider with a struct column: `id` (Int32) and `props` (Struct { value: Int32, label: Utf8 })

()

Source from the content-addressed store, hash-verified

75
76/// Create a table provider with a struct column: `id` (Int32) and `props` (Struct { value: Int32, label: Utf8 })
77fn create_struct_table_provider() -> Arc<MemTable> {
78 let struct_fields = Fields::from(vec![
79 Field::new("value", DataType::Int32, true),
80 Field::new("label", DataType::Utf8, true),
81 ]);
82 let schema = Arc::new(Schema::new(vec![
83 Field::new("id", DataType::Int32, true),
84 Field::new("props", DataType::Struct(struct_fields), true),
85 ]));
86 MemTable::try_new(schema, vec![vec![]])
87 .map(Arc::new)
88 .unwrap()
89}
90
91fn create_context() -> SessionContext {
92 let ctx = SessionContext::new();

Callers 1

create_contextFunction · 0.85

Calls 2

newFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…