Skip to content

Commit 3a46669

Browse files
authored
feat: add test to check for ctx.enable_url_table() (#1155)
1 parent b3eba16 commit 3a46669

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+
///
217+
/// Error returned:
218+
/// ```
219+
/// Failed to load SessionContext for session ID b5530099-63d1-43b1-9e11-87ac83bb33e5:
220+
/// General error: No session for b5530099-63d1-43b1-9e11-87ac83bb33e5 found
221+
/// ```
222+
#[rstest]
223+
#[case::standalone(standalone_context())]
224+
#[case::remote(remote_context())]
225+
#[tokio::test]
226+
#[should_panic]
227+
async fn should_execute_sql_show_with_url_table(
228+
#[future(awt)]
229+
#[case]
230+
ctx: SessionContext,
231+
test_data: String,
232+
) {
233+
let ctx = ctx.enable_url_table();
234+
235+
let result = ctx
236+
.sql(&format!("select string_col, timestamp_col from '{test_data}/alltypes_plain.parquet' where id > 4"))
237+
.await
238+
.unwrap()
239+
.collect()
240+
.await
241+
.unwrap();
242+
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)