Skip to content

Commit

Permalink
try to fix lexical precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Jun 28, 2024
1 parent b364da4 commit f573a39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ impl CustomOperator for JsonOperator {
JsonOperator::LongArrow => "LongArrow",
}
}

fn precedence(&self) -> u8 {
255
}
}

impl TryFrom<&str> for JsonOperator {
Expand Down
7 changes: 7 additions & 0 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,3 +856,10 @@ async fn test_arrow_nested_double_columns() {
let batches = run_query(sql).await.unwrap();
assert_batches_eq!(expected, &batches);
}

#[tokio::test]
async fn test_lexical_precedence_wrong() {
let sql = r#"select '{"a": "b"}'->>'a'='b' as v"#;
let err = run_query(sql).await.unwrap_err();
assert_eq!(err.to_string(), "Error during planning: Unexpected argument type to 'LongArrow' at position 2, expected string or int, got Boolean.")
}

0 comments on commit f573a39

Please sign in to comment.