Skip to content

Instantly share code, notes, and snippets.

@timsaucer
timsaucer / testing_nested_structs.rs
Created May 26, 2024 12:40
This code is a test to programmatically create a DataFusion DataFrame that contains a struct of structs. It is an attempt to test the problem reported at https://github.com/apache/datafusion-python/issues/715 in the python interface. It may also be helpful to anyone who wants to create struct of struct from StructBuilder.
use datafusion::prelude::*;
use arrow::{array::{Int32Builder, StructBuilder}, datatypes::*};
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
let inner_field1 = Field::new("inner_1", DataType::Int32, true);
let inner_field2 = Field::new("inner_2", DataType::Int32, true);