Skip to content

Commit

Permalink
strange, registering with json_table seems to break datafusion
Browse files Browse the repository at this point in the history
  • Loading branch information
dadepo committed Feb 3, 2024
1 parent d273b9b commit 3a36962
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/common/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn set_up_json_data_test() -> Result<SessionContext> {
// declare a new context
let ctx = SessionContext::new();
// declare a table in memory.
ctx.register_batch("json_table", batch)?;
ctx.register_batch("json_values_table", batch)?;

// data for json_type
let schema = Arc::new(Schema::new(vec![
Expand Down
8 changes: 4 additions & 4 deletions src/sqlite/json_udfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ mod tests {
let ctx = register_udfs_for_test()?;
let df = ctx
.sql(
r#"select index, json(json_data) as col_result FROM json_table ORDER BY index ASC"#,
r#"select index, json(json_data) as col_result FROM json_values_table ORDER BY index ASC"#,
)
.await?;

Expand Down Expand Up @@ -170,7 +170,7 @@ mod tests {
let ctx = register_udfs_for_test()?;
let df = ctx
.sql(
r#"select index, json(' { "this" : "is", "a": [ "test" ] ') as col_result FROM json_table ORDER BY index ASC"#,
r#"select index, json(' { "this" : "is", "a": [ "test" ] ') as col_result FROM json_values_table ORDER BY index ASC"#,
)
.await?;

Expand All @@ -190,7 +190,7 @@ mod tests {
#[tokio::test]
async fn test_json_valid() -> Result<()> {
let ctx = register_udfs_for_test()?;
let df = ctx.sql(r#"select index, json_valid(json_data) as col_result FROM json_table ORDER BY index ASC"#).await?;
let df = ctx.sql(r#"select index, json_valid(json_data) as col_result FROM json_values_table ORDER BY index ASC"#).await?;

let batches = df.clone().collect().await?;

Expand Down Expand Up @@ -225,7 +225,7 @@ mod tests {
let ctx = register_udfs_for_test()?;
let df = ctx
.sql(
r#"select index, json_type(json_data) as col_result FROM json_table ORDER BY index ASC"#,
r#"select index, json_type(json_data) as col_result FROM json_values_table ORDER BY index ASC"#,
)
.await?;

Expand Down

0 comments on commit 3a36962

Please sign in to comment.