You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/07/07 17:58:13 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #6887: `make_array` does not properly support nulls

alamb opened a new issue, #6887:
URL: https://github.com/apache/arrow-datafusion/issues/6887

   ### Describe the bug
   
   The `make_array` function doesn't appear to properly support nulls for string arrays
   
   ### To Reproduce
   
   When I run this script
   
   ```sql
   create table foo as values ('foo', null), ('bar', null), (null, 'baz');
   select * from foo;
   select
     make_array(column1, column2)[1],
     make_array(column1, column2)[1] IS NULL
   from foo;
   
   select
     make_array(column1, column2)[2],
     make_array(column1, column2)[2] IS NULL
   from foo;
   ```
   
   I get the following output (note that the output of make_array that had a null input does not have a null output):
   ```
   0 rows in set. Query took 0.004 seconds.
   +---------+---------+
   | column1 | column2 |
   +---------+---------+
   | foo     |         |
   | bar     |         |
   |         | baz     |
   +---------+---------+
   3 rows in set. Query took 0.002 seconds.
   +----------------------------------------+------------------------------------------------+
   | make_array(foo.column1,foo.column2)[1] | make_array(foo.column1,foo.column2)[1] IS NULL |
   +----------------------------------------+------------------------------------------------+
   | foo                                    | false                                          |
   | bar                                    | false                                          |
   |                                        | false                                          |
   +----------------------------------------+------------------------------------------------+
   3 rows in set. Query took 0.007 seconds.
   +----------------------------------------+------------------------------------------------+
   | make_array(foo.column1,foo.column2)[2] | make_array(foo.column1,foo.column2)[2] IS NULL |
   +----------------------------------------+------------------------------------------------+
   |                                        | false                                          |
   |                                        | false                                          |
   | baz                                    | false                                          |
   +----------------------------------------+------------------------------------------------+
   3 rows in set. Query took 0.007 seconds.
   ```
   
   ### Expected behavior
   
   This is what used to happen (note the true/false):
   
   ```
   (arrow_dev) alamb@MacBook-Pro-8:~/Software/arrow-datafusion2/benchmarks$ datafusion-cli -f /tmp/repro.sql
   DataFusion CLI v27.0.0
   0 rows in set. Query took 0.002 seconds.
   +---------+---------+
   | column1 | column2 |
   +---------+---------+
   | foo     |         |
   | bar     |         |
   |         | baz     |
   +---------+---------+
   3 rows in set. Query took 0.001 seconds.
   +----------------------------------------+------------------------------------------------+
   | make_array(foo.column1,foo.column2)[1] | make_array(foo.column1,foo.column2)[1] IS NULL |
   +----------------------------------------+------------------------------------------------+
   | foo                                    | false                                          |
   | bar                                    | false                                          |
   |                                        | true                                           |
   +----------------------------------------+------------------------------------------------+
   3 rows in set. Query took 0.002 seconds.
   +----------------------------------------+------------------------------------------------+
   | make_array(foo.column1,foo.column2)[2] | make_array(foo.column1,foo.column2)[2] IS NULL |
   +----------------------------------------+------------------------------------------------+
   |                                        | true                                           |
   |                                        | true                                           |
   | baz                                    | false                                          |
   +----------------------------------------+------------------------------------------------+
   3 rows in set. Query took 0.001 seconds.
   ```
   
   ### Additional context
   
   I found this while trying to update IOx to use the latest datafusion: https://github.com/influxdata/influxdb_iox/pull/8127


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] izveigor commented on issue #6887: `make_array` does not properly support nulls

Posted by "izveigor (via GitHub)" <gi...@apache.org>.
izveigor commented on issue #6887:
URL: https://github.com/apache/arrow-datafusion/issues/6887#issuecomment-1625882035

   @alamb Yes, you are right.
   I'll take this issue again, the more I need to embed `NullBuilder` in `make_array`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb closed issue #6887: `make_array` does not properly support nulls

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #6887: `make_array` does not properly support nulls 
URL: https://github.com/apache/arrow-datafusion/issues/6887


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #6887: `make_array` does not properly support nulls

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6887:
URL: https://github.com/apache/arrow-datafusion/issues/6887#issuecomment-1628789992

   I have created https://github.com/apache/arrow-datafusion/pull/6900 with a proposed fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #6887: `make_array` does not properly support nulls

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6887:
URL: https://github.com/apache/arrow-datafusion/issues/6887#issuecomment-1629623184

   @izveigor  or @tustvold  if you have time to review this PR I would be most appreciative


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #6887: `make_array` does not properly support nulls

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6887:
URL: https://github.com/apache/arrow-datafusion/issues/6887#issuecomment-1627773340

   I am going to try and fix this


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #6887: `make_array` does not properly support nulls

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6887:
URL: https://github.com/apache/arrow-datafusion/issues/6887#issuecomment-1625844012

   I believe this was introduced by https://github.com/apache/arrow-datafusion/pull/6662 - my tests pass with  46752163bd4f30f778850160513e8ca7f15fcf14  but fail with https://github.com/apache/arrow-datafusion/commit/9edfcdc72a97ed8322d9ae6d9670c99abf3ab2f7 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org