Re: [Maria-developers] MDEV-17399: JSON_TABLE: Crash with nested path

2021-02-28 Thread Alexey Botchkov
Found one more ps-protocol issue to fix...

On Thu, Feb 25, 2021 at 5:27 PM Sergey Petrunia  wrote:

> Hi Alexey,
>
> I was looking at Json_table_nested_path::set_position(), wondering why
> does
> it have an assignment
>
>   np->m_null= TRUE;
>
> but doesn't clear the NULL values and trying to come up with an example of
> this
> going wrong when I've hit this crash:
>
> select * from
> json_table(
> '[
>   {"name": "X",
> "colors":["blue"], "sizes": [1,2,3,4],  "prices" : [10,20]},
>   {"name": "Y",
> "colors":["red"], "sizes": [10,11],  "prices" : [100,200,300]}
> ]',
> '$[*]' columns
> (
>   seq0 for ordinality,
>   name varchar(4) path '$.name',
>   nested path '$.colors[*]' columns (
> seq1 for ordinality,
> color text path '$'
>   ),
>   nested path '$.sizes[*]' columns (
> seq2 for ordinality,
> size int path '$'
>   ),
>   nested path '$.prices[*]' columns (
> seq3 for ordinality,
> price int path '$'
>   )
> )
> ) as T order by seq0, name;
>
> Note this==NULL:
>
> (gdb) wher
>   #0  0x560edf72 in Json_table_nested_path::set_position
> (this=0x0, j_start=0x7ffeb0016e68 "[ \n  {\"name\": \"X\", \n
> \"colors\":[\"blue\"], \"sizes\": [1,2,3,4],  \"prices\" : [10,20]},\n
> {\"name\": \"Y\", \n\"colors\":[\"red\"], \"sizes\": [10,11],
> \"prices\" : [100,200,300]}\n]", j_end=0x7ffeb0016f12 "",
> pos=0x7ffeb0035e51 "\245\245\245\245\245\245\245\245\006") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:239
>   #1  0x560ee12f in Json_table_nested_path::set_position
> (this=0x7ffeb0017060, j_start=0x7ffeb0016e68 "[ \n  {\"name\": \"X\", \n
> \"colors\":[\"blue\"], \"sizes\": [1,2,3,4],  \"prices\" : [10,20]},\n
> {\"name\": \"Y\", \n\"colors\":[\"red\"], \"sizes\": [10,11],
> \"prices\" : [100,200,300]}\n]", j_end=0x7ffeb0016f12 "",
> pos=0x7ffeb0035e48 "") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:262
>   #2  0x560ee9f0 in ha_json_table::rnd_pos (this=0x7ffeb0014f00,
> buf=0x7ffeb0025570 "\377", pos=0x7ffeb0035e48 "") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:434
>   #3  0x561ca6a4 in handler::ha_rnd_pos (this=0x7ffeb0014f00,
> buf=0x7ffeb0025570 "\377", pos=0x7ffeb0035e48 "") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/handler.cc:3101
>   #4  0x563852e3 in rr_from_pointers (info=0x7ffeb001f9e0) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/records.cc:615
>   #5  0x55da4a75 in READ_RECORD::read_record (this=0x7ffeb001f9e0)
> at /home/psergey/dev-git2/10.6-hf-review6/sql/records.h:81
>   #6  0x55ee1876 in join_init_read_record (tab=0x7ffeb001f918) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:21644
>   #7  0x55edf35a in sub_select (join=0x7ffeb001d948,
> join_tab=0x7ffeb001f918, end_of_records=false) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:20666
>   #8  0x55ede8e6 in do_select (join=0x7ffeb001d948, procedure=0x0)
> at /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:20216
>   #9  0x55eb24e7 in JOIN::exec_inner (this=0x7ffeb001d948) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:4484
>   #10 0x55eb1613 in JOIN::exec (this=0x7ffeb001d948) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:4264
>
> Please fix.
>
> BR
>  Sergei
> --
> Sergei Petrunia, Software Developer
> MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net
>
>
>
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] MDEV-17399: JSON_TABLE: Crash with nested path

2021-02-28 Thread Alexey Botchkov
Things are fixed now as far as i can see.

Best regards.
HF


On Thu, Feb 25, 2021 at 5:27 PM Sergey Petrunia  wrote:

> Hi Alexey,
>
> I was looking at Json_table_nested_path::set_position(), wondering why
> does
> it have an assignment
>
>   np->m_null= TRUE;
>
> but doesn't clear the NULL values and trying to come up with an example of
> this
> going wrong when I've hit this crash:
>
> select * from
> json_table(
> '[
>   {"name": "X",
> "colors":["blue"], "sizes": [1,2,3,4],  "prices" : [10,20]},
>   {"name": "Y",
> "colors":["red"], "sizes": [10,11],  "prices" : [100,200,300]}
> ]',
> '$[*]' columns
> (
>   seq0 for ordinality,
>   name varchar(4) path '$.name',
>   nested path '$.colors[*]' columns (
> seq1 for ordinality,
> color text path '$'
>   ),
>   nested path '$.sizes[*]' columns (
> seq2 for ordinality,
> size int path '$'
>   ),
>   nested path '$.prices[*]' columns (
> seq3 for ordinality,
> price int path '$'
>   )
> )
> ) as T order by seq0, name;
>
> Note this==NULL:
>
> (gdb) wher
>   #0  0x560edf72 in Json_table_nested_path::set_position
> (this=0x0, j_start=0x7ffeb0016e68 "[ \n  {\"name\": \"X\", \n
> \"colors\":[\"blue\"], \"sizes\": [1,2,3,4],  \"prices\" : [10,20]},\n
> {\"name\": \"Y\", \n\"colors\":[\"red\"], \"sizes\": [10,11],
> \"prices\" : [100,200,300]}\n]", j_end=0x7ffeb0016f12 "",
> pos=0x7ffeb0035e51 "\245\245\245\245\245\245\245\245\006") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:239
>   #1  0x560ee12f in Json_table_nested_path::set_position
> (this=0x7ffeb0017060, j_start=0x7ffeb0016e68 "[ \n  {\"name\": \"X\", \n
> \"colors\":[\"blue\"], \"sizes\": [1,2,3,4],  \"prices\" : [10,20]},\n
> {\"name\": \"Y\", \n\"colors\":[\"red\"], \"sizes\": [10,11],
> \"prices\" : [100,200,300]}\n]", j_end=0x7ffeb0016f12 "",
> pos=0x7ffeb0035e48 "") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:262
>   #2  0x560ee9f0 in ha_json_table::rnd_pos (this=0x7ffeb0014f00,
> buf=0x7ffeb0025570 "\377", pos=0x7ffeb0035e48 "") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:434
>   #3  0x561ca6a4 in handler::ha_rnd_pos (this=0x7ffeb0014f00,
> buf=0x7ffeb0025570 "\377", pos=0x7ffeb0035e48 "") at
> /home/psergey/dev-git2/10.6-hf-review6/sql/handler.cc:3101
>   #4  0x563852e3 in rr_from_pointers (info=0x7ffeb001f9e0) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/records.cc:615
>   #5  0x55da4a75 in READ_RECORD::read_record (this=0x7ffeb001f9e0)
> at /home/psergey/dev-git2/10.6-hf-review6/sql/records.h:81
>   #6  0x55ee1876 in join_init_read_record (tab=0x7ffeb001f918) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:21644
>   #7  0x55edf35a in sub_select (join=0x7ffeb001d948,
> join_tab=0x7ffeb001f918, end_of_records=false) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:20666
>   #8  0x55ede8e6 in do_select (join=0x7ffeb001d948, procedure=0x0)
> at /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:20216
>   #9  0x55eb24e7 in JOIN::exec_inner (this=0x7ffeb001d948) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:4484
>   #10 0x55eb1613 in JOIN::exec (this=0x7ffeb001d948) at
> /home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:4264
>
> Please fix.
>
> BR
>  Sergei
> --
> Sergei Petrunia, Software Developer
> MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net
>
>
>
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] MDEV-17399: JSON_TABLE: Crash with nested path

2021-02-25 Thread Sergey Petrunia
Hi Alexey,

I was looking at Json_table_nested_path::set_position(), wondering why does 
it have an assignment 
  
  np->m_null= TRUE;

but doesn't clear the NULL values and trying to come up with an example of this
going wrong when I've hit this crash:

select * from
json_table(
'[ 
  {"name": "X", 
"colors":["blue"], "sizes": [1,2,3,4],  "prices" : [10,20]},
  {"name": "Y", 
"colors":["red"], "sizes": [10,11],  "prices" : [100,200,300]}
]',
'$[*]' columns
(
  seq0 for ordinality,
  name varchar(4) path '$.name',
  nested path '$.colors[*]' columns (
seq1 for ordinality,
color text path '$'
  ),
  nested path '$.sizes[*]' columns (
seq2 for ordinality,
size int path '$'
  ),
  nested path '$.prices[*]' columns (
seq3 for ordinality, 
price int path '$'
  )
)
) as T order by seq0, name;

Note this==NULL:

(gdb) wher
  #0  0x560edf72 in Json_table_nested_path::set_position (this=0x0, 
j_start=0x7ffeb0016e68 "[ \n  {\"name\": \"X\", \n\"colors\":[\"blue\"], 
\"sizes\": [1,2,3,4],  \"prices\" : [10,20]},\n  {\"name\": \"Y\", \n
\"colors\":[\"red\"], \"sizes\": [10,11],  \"prices\" : [100,200,300]}\n]", 
j_end=0x7ffeb0016f12 "", pos=0x7ffeb0035e51 
"\245\245\245\245\245\245\245\245\006") at 
/home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:239
  #1  0x560ee12f in Json_table_nested_path::set_position 
(this=0x7ffeb0017060, j_start=0x7ffeb0016e68 "[ \n  {\"name\": \"X\", \n
\"colors\":[\"blue\"], \"sizes\": [1,2,3,4],  \"prices\" : [10,20]},\n  
{\"name\": \"Y\", \n\"colors\":[\"red\"], \"sizes\": [10,11],  \"prices\" : 
[100,200,300]}\n]", j_end=0x7ffeb0016f12 "", pos=0x7ffeb0035e48 "") at 
/home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:262
  #2  0x560ee9f0 in ha_json_table::rnd_pos (this=0x7ffeb0014f00, 
buf=0x7ffeb0025570 "\377", pos=0x7ffeb0035e48 "") at 
/home/psergey/dev-git2/10.6-hf-review6/sql/table_function.cc:434
  #3  0x561ca6a4 in handler::ha_rnd_pos (this=0x7ffeb0014f00, 
buf=0x7ffeb0025570 "\377", pos=0x7ffeb0035e48 "") at 
/home/psergey/dev-git2/10.6-hf-review6/sql/handler.cc:3101
  #4  0x563852e3 in rr_from_pointers (info=0x7ffeb001f9e0) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/records.cc:615
  #5  0x55da4a75 in READ_RECORD::read_record (this=0x7ffeb001f9e0) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/records.h:81
  #6  0x55ee1876 in join_init_read_record (tab=0x7ffeb001f918) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:21644
  #7  0x55edf35a in sub_select (join=0x7ffeb001d948, 
join_tab=0x7ffeb001f918, end_of_records=false) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:20666
  #8  0x55ede8e6 in do_select (join=0x7ffeb001d948, procedure=0x0) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:20216
  #9  0x55eb24e7 in JOIN::exec_inner (this=0x7ffeb001d948) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:4484
  #10 0x55eb1613 in JOIN::exec (this=0x7ffeb001d948) at 
/home/psergey/dev-git2/10.6-hf-review6/sql/sql_select.cc:4264

Please fix.

BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net



___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp