zvonimir-dd commented on code in PR #2436:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2436#discussion_r3865906714
##########
tests/sqlparser_mysql.rs:
##########
@@ -4946,3 +4946,48 @@ fn parse_adjacent_string_literal_concatenation() {
fn parse_group_by_with_rollup() {
mysql().verified_stmt("SELECT * FROM tbl GROUP BY col1, col2 WITH ROLLUP");
}
+
+#[test]
+fn parse_is_distinct_from_json_arrow_precedence() {
+ // MySQL's `->` binds tighter than `IS [NOT] DISTINCT FROM`, so the JSON
+ // extraction must stay inside the right operand.
+ assert_eq!(
+ Expr::IsDistinctFrom(
+ Box::new(Expr::Identifier(Ident::new("a"))),
+ Box::new(Expr::BinaryOp {
+ left: Box::new(Expr::Identifier(Ident::new("b"))),
+ op: BinaryOperator::Arrow,
+ right: Box::new(Expr::Value(
+ Value::SingleQuotedString("k".into()).with_empty_span()
+ )),
+ }),
+ ),
+ mysql().verified_expr("a IS DISTINCT FROM b -> 'k'")
+ );
Review Comment:
Done, with the `->>` case using `IS NOT DISTINCT FROM` so both keyword forms
are covered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]