| 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<()> { |