// Run a plan against the following input table as "t"
Run a plan against the following input table as "t"
Run a plan against the following input table as " t "
async fn run_plan(op: Expr) -> Result<Vec<String>, DataFusionError> {
        // define data for table
        let words = vec![
            Some("air"),
            Some("aphex twin"),
            Some("bruce"),
            Some("Blood Orange"),
            None,
            None,
            Some("cocteau twins"),
        ];
        let lengths = words
            .iter()
            .map(|word| word.map(|word| word.len() as u64))
            .collect::<UInt64Array>();
        let words = StringArray::from(words);
        let rb = RecordBatch::try_from_iter(vec![
            ("words", Arc::new(words) as ArrayRef),
            ("length", Arc::new(lengths)),
        ])
        .unwrap();
        let ctx = context_with_table(rb);
        let df = ctx.table("t").unwrap();
        let df = df.filter(op).unwrap();
        // execute the query
        let record_batches = df.collect().await?;
        Ok(pretty_format_batches(&record_batches)
            .unwrap()
            .to_string()
            .split('\n')
            .map(|s| s.to_owned())
            .collect())
    }
async fn run_plan ( op : Expr ) -> Result < Vec < String > , DataFusionError > { // define data for table let words = vec ! [ Some ( " " ) Some ( " " ) Some ( " " ) Some ( " " ) None None Some ( " " ) ] ; let lengths = words . iter ( ) . map ( | word | word . map ( | word | word . len ( ) as u64 ) ) . collect :: < UInt64Array > ( ) ; let words = StringArray :: from ( words ) ; let rb = RecordBatch :: try_from_iter ( vec ! [ ( " " Arc new ( words ) as ArrayRef ) ( " " Arc new ( lengths ) ) ] ) . unwrap ( ) ; let ctx = context_with_table ( rb ) ; let df = ctx . table ( " " ) . unwrap ( ) ; let df = df . filter ( op ) . unwrap ( ) ; // execute the query let record_batches = df . collect ( ) . await ? ; Ok ( pretty_format_batches ( & record_batches ) . unwrap ( ) . to_string ( ) . split ( '\n' ) . map ( | s | s . to_owned ( ) ) . collect ( ) ) }
Run a plan against the following input table as "t"
Run a plan against the following input table as " t "
op
Expr