Robert Joseph Evans created SPARK-46761:
-------------------------------------------

             Summary: quoted strings in a JSON path should support ? characters
                 Key: SPARK-46761
                 URL: https://issues.apache.org/jira/browse/SPARK-46761
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.0.0, 4.0.0
            Reporter: Robert Joseph Evans


I think this impacts all versions of Spark after SPARK-18677, which made the 
operator work at all in 2.1.0/2.0.3

I comes down to
{code:java}
 name <- '.' ~> "[^\\.\\[]+".r | "['" ~> "[^\\'\\?]+".r <~ "']"{code}
[https://github.com/apache/spark/blob/01bb1b1a3dbfc68f41d9b13de863d26d587c7e2f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala#L79]

 

The regular expression/pattern is saying that we want a [' followed by one or 
more characters that are not a single quote ' or a question mark ? followed by 
']. That question mark looks out of place. When I try to put in a question mark 
in a quoted string it fails to produce any result, but when I put the same 
data/path into [https://jsonpath.com/] I get a result

 

data
{code:java}
{"?":"QUESTION"} {code}
path
{code:java}
$['?'] {code}
 

I also see no tests validating that a question mark is not allowed so I suspect 
that it is a long standing bug.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to