You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jayzhan211 (via GitHub)" <gi...@apache.org> on 2023/06/24 12:26:19 UTC

[GitHub] [arrow-datafusion] jayzhan211 opened a new pull request, #6759: Support fixed_size_list for make_array

jayzhan211 opened a new pull request, #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Ref https://github.com/apache/arrow-datafusion/issues/6560
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   Add FixedSizeList support for array methods
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   Only MakeArray is done for this PR.
   
   1. Add casting from fixedSizeList to list in analyzer (type_coercion).
   2. Support ScalarValue::FixedSizeList, not all feature is implemented
   3. Able to parse List for sqllogictest.
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   4. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   1. sqllogictest
   array.slt
   
   2. unit test in type_coercion.rs
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   
   # Task
   - [X] MakeArray
   - [ ] Other array methods
   


-- 
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 pull request #6759: Support fixed_size_list for make_array

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#issuecomment-1611874588

   Marking as a draft as it looks like this PR is not waiting on review -- it is waiting on an upstream release (scheduled early next week) as well as to address some other comments


-- 
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 pull request #6759: Support fixed_size_list for make_array

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#issuecomment-1622196347

   cc @izveigor 


-- 
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 a diff in pull request #6759: Support fixed_size_list for make_array

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#discussion_r1242772947


##########
Cargo.toml:
##########
@@ -53,6 +53,14 @@ arrow-array = { version = "42.0.0", default-features = false, features = ["chron
 parquet = { version = "42.0.0", features = ["arrow", "async", "object_store"] }
 sqlparser = { version = "0.35", features = ["visitor"] }
 
+[patch.crates-io]

Review Comment:
   I think we will have to wait for this code to be released to crates.io (in about 10 days) before merging this PR



##########
datafusion/core/tests/data/fixed_size_list_array.parquet:
##########


Review Comment:
   Did you look at the data sets available in https://github.com/apache/parquet-testing (which is a submodule of this repo)
   
   e.g. https://github.com/apache/parquet-testing/tree/a11fc8f148f8a7a89d9281cc0da3eb9d56095fbf/data



##########
datafusion/core/tests/sqllogictests/test_files/array.slt:
##########
@@ -357,3 +357,33 @@ query ?
 select make_array(x, y) from foo2;
 ----
 [1.0, 1]
+
+statement ok
+CREATE EXTERNAL TABLE fixed_size_list_array STORED AS PARQUET LOCATION 'tests/data/fixed_size_list_array.parquet';
+
+query ?
+select * from fixed_size_list_array;

Review Comment:
   Could you also add a query that is like `arrow_typeof(f0)` to show in the test what the type of the column is?



##########
datafusion/sql/src/expr/arrow_cast.rs:
##########
@@ -486,6 +497,8 @@ impl<'a> Tokenizer<'a> {
             "Date32" => Token::SimpleType(DataType::Date32),
             "Date64" => Token::SimpleType(DataType::Date64),
 
+            "List" => Token::List,

Review Comment:
   👍 



##########
datafusion/common/src/scalar.rs:
##########
@@ -3646,29 +3675,9 @@ impl fmt::Display for ScalarValue {
             ScalarValue::TimestampNanosecond(e, _) => format_option!(f, e)?,
             ScalarValue::Utf8(e) => format_option!(f, e)?,
             ScalarValue::LargeUtf8(e) => format_option!(f, e)?,
-            ScalarValue::Binary(e) => match e {

Review Comment:
   ❤️ 



-- 
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] jayzhan211 commented on a diff in pull request #6759: Support fixed_size_list for make_array

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#discussion_r1252440680


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -125,7 +125,7 @@ fn array_array(args: &[ArrayRef], data_type: DataType) -> Result<ArrayRef> {
             }
 
             let list_data_type =
-                DataType::List(Arc::new(Field::new("item", data_type, false)));
+                DataType::List(Arc::new(Field::new("item", data_type, true)));

Review Comment:
   Revert the change from #6662 to avoid failure on the schema mismatch



-- 
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] jayzhan211 commented on a diff in pull request #6759: Support fixed_size_list for make_array

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#discussion_r1240975260


##########
datafusion/core/tests/data/fixed_size_list_array.parquet:
##########


Review Comment:
   I create fixedsizelist parquet from my own script.
   Is there any existing way for us to easily create/update this kind of test case?



-- 
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] jayzhan211 commented on a diff in pull request #6759: Support fixed_size_list for make_array

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#discussion_r1252440680


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -125,7 +125,7 @@ fn array_array(args: &[ArrayRef], data_type: DataType) -> Result<ArrayRef> {
             }
 
             let list_data_type =
-                DataType::List(Arc::new(Field::new("item", data_type, false)));
+                DataType::List(Arc::new(Field::new("item", data_type, true)));

Review Comment:
   Revert the change from #666



-- 
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 merged pull request #6759: Support fixed_size_list for make_array

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759


-- 
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 pull request #6759: Support fixed_size_list for make_array

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6759:
URL: https://github.com/apache/arrow-datafusion/pull/6759#issuecomment-1608274771

   FYI @izveigor 


-- 
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