Skip to content

Map MySQL JSON to Presto JSON#824

Merged
electrum merged 1 commit intotrinodb:masterfrom
ebyhr:mysql/json
May 28, 2019
Merged

Map MySQL JSON to Presto JSON#824
electrum merged 1 commit intotrinodb:masterfrom
ebyhr:mysql/json

Conversation

@ebyhr
Copy link
Member

@ebyhr ebyhr commented May 28, 2019

Implements prestodb/presto#12806

TestPostgreSqlTypeMapping has this test "\"text with \\\" quotations and ' apostrophes\"", but mysql's escape logic is little different from postgresql and presto. Then, I changed the test case to "\"text with ' apostrophes\""

presto> select CAST('"text with \" quotations and '' apostrophes"' AS JSON);
                       _col0                       
---------------------------------------------------
 "\"text with \\\" quotations and ' apostrophes\"" 
postgresql> select CAST('"text with \" quotations and '' apostrophes"' AS JSON);
                    json                     
---------------------------------------------
 "text with \" quotations and ' apostrophes"
mysql> select CAST('"text with \" quotations and '' apostrophes"' AS JSON);
ERROR 3141 (22032): Invalid JSON text in argument 1 to function cast_as_json: "The document root must not follow by other values." at position 13.

mysql> select CAST('"text with \\" quotations and '' apostrophes"' AS JSON);
+---------------------------------------------------------------+
| CAST('"text with \\" quotations and '' apostrophes"' AS JSON) |
+---------------------------------------------------------------+
| "text with \" quotations and ' apostrophes"                   |
+---------------------------------------------------------------+

@cla-bot cla-bot bot added the cla-signed label May 28, 2019
@ebyhr
Copy link
Member Author

ebyhr commented May 28, 2019

The travis failed by No output has been received in the last 10m0s

Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebyhr thank you for your contribution!
@electrum do you want to have a look?

@electrum electrum merged commit 85659a0 into trinodb:master May 28, 2019
@electrum
Copy link
Member

Merged, thanks!

@electrum electrum added this to the 312 milestone May 28, 2019
@electrum electrum mentioned this pull request May 29, 2019
6 tasks
@ebyhr ebyhr deleted the mysql/json branch September 5, 2021 10:12
v-jizhang added a commit to v-jizhang/presto that referenced this pull request Aug 15, 2023
Cherry-pick of trinodb/trino#824

Co-authored-by: Yuya Ebihara <ebyhry@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants