Skip to content

Commit

Permalink
use single quote instead
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cor committed Aug 16, 2022
1 parent 80aca34 commit fd72a9e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions enginetest/queries/json_table_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@ import (

var JSONTableQueryTests = []QueryTest{
{
Query: "SELECT * FROM JSON_TABLE(NULL,\"$[*]\" COLUMNS(x int path \"$.a\")) as t;",
Query: "SELECT * FROM JSON_TABLE(NULL,'$[*]' COLUMNS(x int path '$.a')) as t;",
Expected: []sql.Row{},
},
{
Query: "SELECT * FROM JSON_TABLE('[{\"a\":1},{\"a\":2}]',\"$[*]\" COLUMNS(x varchar(100) path \"$.a\")) as tt;",
Query: "SELECT * FROM JSON_TABLE('[{\"a\":1},{\"a\":2}]','$[*]' COLUMNS(x varchar(100) path '$.a')) as tt;",
Expected: []sql.Row{
{"1"},
{"2"},
},
},
{
Query: "SELECT * FROM JSON_TABLE('[{\"a\":1, \"b\":2},{\"a\":3, \"b\":4}]',\"$[*]\" COLUMNS(x int path \"$.a\", y int path \"$.b\")) as tt;",
Query: "SELECT * FROM JSON_TABLE('[{\"a\":1, \"b\":2},{\"a\":3, \"b\":4}]',\"$[*]\" COLUMNS(x int path '$.a', y int path '$.b')) as tt;",
Expected: []sql.Row{
{1, 2},
{3, 4},
},
},
{
Query: "SELECT * FROM JSON_TABLE('[{\"a\":1.5, \"b\":2.25},{\"a\":3.125, \"b\":4.0625}]',\"$[*]\" COLUMNS(x float path \"$.a\", y float path \"$.b\")) as tt;",
Query: "SELECT * FROM JSON_TABLE('[{\"a\":1.5, \"b\":2.25},{\"a\":3.125, \"b\":4.0625}]','$[*]' COLUMNS(x float path '$.a', y float path '$.b')) as tt;",
Expected: []sql.Row{
{1.5, 2.25},
{3.125, 4.0625},
},
},
{
Query: "SELECT * FROM JSON_TABLE(concat('[{},','{}]'),\"$[*]\" COLUMNS(x varchar(100) path \"$.a\",y varchar(100) path \"$.b\")) as t;",
Query: "SELECT * FROM JSON_TABLE(concat('[{},','{}]'),'$[*]' COLUMNS(x varchar(100) path '$.a',y varchar(100) path '$.b')) as t;",
Expected: []sql.Row{
{nil, nil},
{nil, nil},
},
},
{
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) as t1 join JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) as t2;",
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) as t1 join JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) as t2;",
Expected: []sql.Row{
{1, 1},
{1, 2},
Expand All @@ -61,7 +61,7 @@ var JSONTableQueryTests = []QueryTest{
},
},
{
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) as t1 join one_pk order by x;",
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) as t1 join one_pk order by x;",
Expected: []sql.Row{
{1, 0, 0, 1, 2, 3, 4},
{1, 1, 10, 11, 12, 13, 14},
Expand All @@ -74,7 +74,7 @@ var JSONTableQueryTests = []QueryTest{
},
},
{
Query: "select * from one_pk join JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) as t1 order by x;",
Query: "select * from one_pk join JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) as t1 order by x;",
Expected: []sql.Row{
{0, 0, 1, 2, 3, 4, 1},
{1, 10, 11, 12, 13, 14, 1},
Expand All @@ -87,7 +87,7 @@ var JSONTableQueryTests = []QueryTest{
},
},
{
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) as t1 union select * from JSON_TABLE('[{\"b\":3},{\"b\":4}]', \"$[*]\" COLUMNS(y int path \"$.b\")) as t2",
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) as t1 union select * from JSON_TABLE('[{\"b\":3},{\"b\":4}]', '$[*]' COLUMNS(y int path '$.b')) as t2",
Expected: []sql.Row{
{1},
{2},
Expand All @@ -96,20 +96,20 @@ var JSONTableQueryTests = []QueryTest{
},
},
{
Query: "select * from one_pk where pk in (select x from JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) as t)",
Query: "select * from one_pk where pk in (select x from JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) as t)",
Expected: []sql.Row{
{1, 10, 11, 12, 13, 14},
{2, 20, 21, 22, 23, 24},
},
},
{
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', \"$[*]\" COLUMNS(x int path \"$.a\")) t1 where x in (select y from JSON_TABLE('[{\"b\":1},{\"b\":100}]', \"$[*]\" COLUMNS(y int path \"$.b\")) as t2)",
Query: "select * from JSON_TABLE('[{\"a\":1},{\"a\":2}]', '$[*]' COLUMNS(x int path '$.a')) t1 where x in (select y from JSON_TABLE('[{\"b\":1},{\"b\":100}]', '$[*]' COLUMNS(y int path '$.b')) as t2)",
Expected: []sql.Row{
{1},
},
},
{
Query: "SELECT * FROM JSON_TABLE((select t from json_table_tables),\"$[*]\" COLUMNS(i int path \"$.a\", j int path \"$.b\", k int path \"$.c\", l int path \"$.d\")) as tt;",
Query: "SELECT * FROM JSON_TABLE((select t from json_table_tables),'$[*]' COLUMNS(i int path '$.a', j int path '$.b', k int path '$.c', l int path '$.d')) as tt;",
Expected: []sql.Row{
{1, nil, nil, nil},
{nil, 2, nil, nil},
Expand Down

0 comments on commit fd72a9e

Please sign in to comment.