Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ScanJson and JsonToStructs does not deal with escaped single quotes properly #10596

Closed
revans2 opened this issue Mar 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working cudf_dependency An issue or PR with this label depends on a new feature in cudf

Comments

@revans2
Copy link
Collaborator

revans2 commented Mar 14, 2024

Describe the bug
This is a little odd, but ' in a JSON string is only disallowed if allowBackslashEscapingAnyCharacter and allowSingleQuotes are both false. The default is to have allowSingleQuotes true, so on the GPU we end up returning the wrong thing, which is null all of the time.

scala> Seq("""{"data": "\'TESTING\'"}""").toDF("value").repartition(1).selectExpr("from_json(value, 'data string', map('allowBackslashEscapingAnyCharacter', 'true', 'allowSingleQuotes', 'true'))", "*").show(100, false)
+----------------+-----------------------+
|from_json(value)|value                  |
+----------------+-----------------------+
|{'TESTING'}     |{"data": "\'TESTING\'"}|
+----------------+-----------------------+


scala> Seq("""{"data": "\'TESTING\'"}""").toDF("value").repartition(1).selectExpr("from_json(value, 'data string', map('allowBackslashEscapingAnyCharacter', 'false', 'allowSingleQuotes', 'true'))", "*").show(100, false)
+----------------+-----------------------+
|from_json(value)|value                  |
+----------------+-----------------------+
|{'TESTING'}     |{"data": "\'TESTING\'"}|
+----------------+-----------------------+


scala> Seq("""{"data": "\'TESTING\'"}""").toDF("value").repartition(1).selectExpr("from_json(value, 'data string', map('allowBackslashEscapingAnyCharacter', 'true', 'allowSingleQuotes', 'false'))", "*").show(100, false)
+----------------+-----------------------+
|from_json(value)|value                  |
+----------------+-----------------------+
|{'TESTING'}     |{"data": "\'TESTING\'"}|
+----------------+-----------------------+


scala> Seq("""{"data": "\'TESTING\'"}""").toDF("value").repartition(1).selectExpr("from_json(value, 'data string', map('allowBackslashEscapingAnyCharacter', 'false', 'allowSingleQuotes', 'false'))", "*").show(100, false)
+----------------+-----------------------+
|from_json(value)|value                  |
+----------------+-----------------------+
|{null}          |{"data": "\'TESTING\'"}|
+----------------+-----------------------+
@revans2 revans2 added bug Something isn't working ? - Needs Triage Need team to review and classify labels Mar 14, 2024
@revans2 revans2 added the cudf_dependency An issue or PR with this label depends on a new feature in cudf label Mar 14, 2024
@revans2
Copy link
Collaborator Author

revans2 commented Mar 14, 2024

This depends on rapidsai/cudf#15303

1 similar comment
@revans2
Copy link
Collaborator Author

revans2 commented Mar 14, 2024

This depends on rapidsai/cudf#15303

@mattahrens mattahrens removed the ? - Needs Triage Need team to review and classify label Mar 26, 2024
@revans2 revans2 self-assigned this Aug 13, 2024
@revans2
Copy link
Collaborator Author

revans2 commented Aug 13, 2024

The CUDF code/dependency was fixed and this appears to be working fine now.

@revans2 revans2 closed this as completed Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cudf_dependency An issue or PR with this label depends on a new feature in cudf
Projects
None yet
Development

No branches or pull requests

2 participants