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

Function test_basic_aggregate

datafusion/wasmtest/src/lib.rs:179–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177
178 #[wasm_bindgen_test(unsupported = tokio::test)]
179 async fn test_basic_aggregate() {
180 let sql =
181 "SELECT FIRST_VALUE(value) OVER (ORDER BY id) as first_val FROM test_table;";
182
183 let schema = Arc::new(Schema::new(vec![
184 Field::new("id", DataType::Int32, false),
185 Field::new("value", DataType::Utf8, false),
186 ]));
187
188 let data: Vec<ArrayRef> = vec![
189 Arc::new(Int32Array::from(vec![1])),
190 Arc::new(StringArray::from(vec!["a"])),
191 ];
192
193 let batch = RecordBatch::try_new(schema.clone(), data).unwrap();
194 let table = MemTable::try_new(schema.clone(), vec![vec![batch]]).unwrap();
195
196 let ctx = get_ctx();
197 ctx.register_table("test_table", Arc::new(table)).unwrap();
198
199 let statement = DFParser::parse_sql(sql).unwrap().pop_back().unwrap();
200
201 let logical_plan = ctx.state().statement_to_plan(statement).await.unwrap();
202 let data_frame = ctx.execute_logical_plan(logical_plan).await.unwrap();
203 let physical_plan = data_frame.create_physical_plan().await.unwrap();
204
205 let task_ctx = ctx.task_ctx();
206 let _ = collect(physical_plan, task_ctx).await.unwrap();
207 }
208
209 #[wasm_bindgen_test(unsupported = tokio::test)]
210 async fn test_parquet_write() {

Callers

nothing calls this directly

Calls 10

newFunction · 0.85
get_ctxFunction · 0.85
collectFunction · 0.50
cloneMethod · 0.45
register_tableMethod · 0.45
statement_to_planMethod · 0.45
stateMethod · 0.45
execute_logical_planMethod · 0.45
create_physical_planMethod · 0.45
task_ctxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…