alamb commented on code in PR #6362:
URL: https://github.com/apache/arrow-datafusion/pull/6362#discussion_r1196971797


##########
datafusion/core/tests/sql/avro.rs:
##########
@@ -1,157 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-use super::*;
-
-async fn register_alltypes_avro(ctx: &SessionContext) {
-    let testdata = datafusion::test_util::arrow_test_data();
-    ctx.register_avro(
-        "alltypes_plain",
-        &format!("{testdata}/avro/alltypes_plain.avro"),
-        AvroReadOptions::default(),
-    )
-    .await
-    .unwrap();
-}
-
-#[tokio::test]
-async fn avro_query() {
-    let ctx = SessionContext::new();
-    register_alltypes_avro(&ctx).await;
-    // NOTE that string_col is actually a binary column and does not have the 
UTF8 logical type
-    // so we need an explicit cast
-    let sql = "SELECT id, CAST(string_col AS varchar) FROM alltypes_plain";
-    let actual = execute_to_batches(&ctx, sql).await;
-    let expected = vec![
-        "+----+---------------------------+",
-        "| id | alltypes_plain.string_col |",
-        "+----+---------------------------+",
-        "| 4  | 0                         |",
-        "| 5  | 1                         |",
-        "| 6  | 0                         |",
-        "| 7  | 1                         |",
-        "| 2  | 0                         |",
-        "| 3  | 1                         |",
-        "| 0  | 0                         |",
-        "| 1  | 1                         |",
-        "+----+---------------------------+",
-    ];
-
-    assert_batches_eq!(expected, &actual);
-}
-
-#[tokio::test]
-async fn avro_query_multiple_files() {

Review Comment:
   🤔  I think adding something to `SessionContext` for testing only is likely 
not the best idea
   
   Maybe we could return the TempDir alongside the `SessionContext` like:
   
   ```rust
   struct TestContext {
     /// Context for running queries
     ctx: SessionContext,
     /// Temporary directory created and cleared at the end of the test
     tmpdir: TempDir
   }
   ```
   And then change
   ```rust
   async fn context_for_test_file(relative_path: &Path) -> SessionContext {
   ```
   
   to 
   ```rust
   async fn context_for_test_file(relative_path: &Path) -> TestContext {
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to