Skip to content

Commit 92e376a

Browse files
committed
feat: add test to check for ctx.enable_ulr_table()
1 parent 8829e01 commit 92e376a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

ballista/client/tests/context_unsupported.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,45 @@ mod unsupported {
211211

212212
assert_batches_eq!(expected, &result);
213213
}
214+
215+
/// looks like `ctx.enable_url_table()` changes session context id
216+
/// error returned `SessionContext for session ID 3aeb9328-b207-4ef2-beae-0313d912160d`
217+
#[rstest]
218+
#[case::standalone(standalone_context())]
219+
#[case::remote(remote_context())]
220+
#[tokio::test]
221+
#[should_panic]
222+
async fn should_execute_sql_show_with_url_table(
223+
#[future(awt)]
224+
#[case]
225+
ctx: SessionContext,
226+
test_data: String,
227+
) {
228+
let ctx = ctx.enable_url_table();
229+
230+
ctx.register_parquet(
231+
"test",
232+
&format!("{test_data}/alltypes_plain.parquet"),
233+
Default::default(),
234+
)
235+
.await
236+
.unwrap();
237+
238+
let result = ctx
239+
.sql(&format!("select string_col, timestamp_col from '{test_data}/alltypes_plain.parquet' where id > 4"))
240+
.await.unwrap()
241+
.collect()
242+
.await.unwrap();
243+
let expected = [
244+
"+------------+---------------------+",
245+
"| string_col | timestamp_col |",
246+
"+------------+---------------------+",
247+
"| 31 | 2009-03-01T00:01:00 |",
248+
"| 30 | 2009-04-01T00:00:00 |",
249+
"| 31 | 2009-04-01T00:01:00 |",
250+
"+------------+---------------------+",
251+
];
252+
253+
assert_batches_eq!(expected, &result);
254+
}
214255
}

0 commit comments

Comments
 (0)