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

Function test_without_projection

datafusion/core/src/datasource/memory_test.rs:77–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76 #[tokio::test]
77 async fn test_without_projection() -> Result<()> {
78 let session_ctx = SessionContext::new();
79 let task_ctx = session_ctx.task_ctx();
80 let schema = Arc::new(Schema::new(vec![
81 Field::new("a", DataType::Int32, false),
82 Field::new("b", DataType::Int32, false),
83 Field::new("c", DataType::Int32, false),
84 ]));
85
86 let batch = RecordBatch::try_new(
87 schema.clone(),
88 vec![
89 Arc::new(Int32Array::from(vec![1, 2, 3])),
90 Arc::new(Int32Array::from(vec![4, 5, 6])),
91 Arc::new(Int32Array::from(vec![7, 8, 9])),
92 ],
93 )?;
94
95 let provider = MemTable::try_new(schema, vec![vec![batch]])?;
96
97 let exec = provider.scan(&session_ctx.state(), None, &[], None).await?;
98 let mut it = exec.execute(0, task_ctx)?;
99 let batch1 = it.next().await.unwrap()?;
100 assert_eq!(3, batch1.schema().fields().len());
101 assert_eq!(3, batch1.num_columns());
102
103 Ok(())
104 }
105
106 #[tokio::test]
107 async fn test_invalid_projection() -> Result<()> {

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
task_ctxMethod · 0.45
cloneMethod · 0.45
scanMethod · 0.45
stateMethod · 0.45
executeMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…