Skip to content

Commit

Permalink
feat: add test to check for ctx.enable_ulr_table()
Browse files Browse the repository at this point in the history
  • Loading branch information
milenkovicm committed Jan 3, 2025
1 parent 8829e01 commit 92e376a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions ballista/client/tests/context_unsupported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,45 @@ mod unsupported {

assert_batches_eq!(expected, &result);
}

/// looks like `ctx.enable_url_table()` changes session context id
/// error returned `SessionContext for session ID 3aeb9328-b207-4ef2-beae-0313d912160d`
#[rstest]
#[case::standalone(standalone_context())]
#[case::remote(remote_context())]
#[tokio::test]
#[should_panic]
async fn should_execute_sql_show_with_url_table(
#[future(awt)]
#[case]
ctx: SessionContext,
test_data: String,
) {
let ctx = ctx.enable_url_table();

ctx.register_parquet(
"test",
&format!("{test_data}/alltypes_plain.parquet"),
Default::default(),
)
.await
.unwrap();

let result = ctx
.sql(&format!("select string_col, timestamp_col from '{test_data}/alltypes_plain.parquet' where id > 4"))
.await.unwrap()
.collect()
.await.unwrap();
let expected = [
"+------------+---------------------+",
"| string_col | timestamp_col |",
"+------------+---------------------+",
"| 31 | 2009-03-01T00:01:00 |",
"| 30 | 2009-04-01T00:00:00 |",
"| 31 | 2009-04-01T00:01:00 |",
"+------------+---------------------+",
];

assert_batches_eq!(expected, &result);
}
}

0 comments on commit 92e376a

Please sign in to comment.