You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/13 04:31:11 UTC

[GitHub] [arrow-datafusion] comphead opened a new pull request, #2893: Scalar list preserve element name

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

   # 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.
   -->
   
   Closes #2450 .
   
    # 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.  
   -->
   
   # 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.
   -->
   Preserve list element name
   # 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.
   -->


-- 
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 #2893: Preserve field name in `ScalarValue::List`

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1187428909

   > @alamb you mentioned in https://github.com/apache/arrow-datafusion/pull/2840 the encoding/decoding issue still exists, please give more details, I'll try to fix it in this PR
   
   For the record, we discussed on slack and found the appropriate test coverage was here: https://github.com/apache/arrow-datafusion/blob/3f4aaabc74796fe8c538981c259d79da789b96ae/datafusion/proto/src/lib.rs#L345
   
   


-- 
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 #2893: Preserve field name in `ScalarValue::List`

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1187418845

   Thanks @comphead  -- I took the liberty of merging up from master again (to resolve yet another conflict I introduced in https://github.com/apache/arrow-datafusion/pull/2875). I plan to merge this PR once the tests pass


-- 
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] comphead commented on pull request #2893: Scalar list preserve element name

Posted by GitBox <gi...@apache.org>.
comphead commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1186592996

   > I think this PR looks good to go now -- we just need to rebase it against master. If that is having problems @comphead I will be happy to do so.
   > 
   > Thank you
   
   Hi @alamb I have merged it, please have a look again


-- 
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 #2893: Preserve field name in `ScalarValue::List`

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#discussion_r923371084


##########
datafusion/proto/src/to_proto.rs:
##########
@@ -835,109 +835,127 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
                     Value::LargeUtf8Value(s.to_owned())
                 })
             }
-            scalar::ScalarValue::List(value, datatype) => {
-                println!("Current datatype of list: {:?}", datatype);
+            scalar::ScalarValue::List(value, boxed_field) => {
+                println!("Current field of list: {:?}", boxed_field);
                 match value {
                     Some(values) => {
                         if values.is_empty() {
                             protobuf::ScalarValue {
                                 value: Some(protobuf::scalar_value::Value::ListValue(
                                     protobuf::ScalarListValue {
-                                        datatype: Some(datatype.as_ref().try_into()?),
+                                        field: Some(boxed_field.as_ref().into()),
                                         values: Vec::new(),
                                     },
                                 )),
                             }
                         } else {
-                            let scalar_type = match datatype.as_ref() {
+                            let scalar_type = match boxed_field.data_type() {
                                 DataType::List(field) => field.as_ref().data_type(),
-                                _ => todo!("Proper error handling"),
+                                unsupported => {
+                                    todo!("Proper error handling {}", unsupported)
+                                }
                             };
                             println!("Current scalar type for list: {:?}", scalar_type);
+
                             let type_checked_values: Vec<protobuf::ScalarValue> = values
                                 .iter()
-                                .map(|scalar| match (scalar, scalar_type) {
-                                    (
-                                        scalar::ScalarValue::List(_, list_type),
-                                        DataType::List(field),
-                                    ) => {
-                                        if let DataType::List(list_field) =
-                                            list_type.as_ref()
-                                        {
-                                            let scalar_datatype = field.data_type();
-                                            let list_datatype = list_field.data_type();
-                                            if std::mem::discriminant(list_datatype)
-                                                != std::mem::discriminant(scalar_datatype)
+                                .map(|scalar| {
+                                    dbg!(scalar);

Review Comment:
   ```suggestion
   ```



##########
datafusion/proto/src/to_proto.rs:
##########
@@ -835,109 +835,127 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
                     Value::LargeUtf8Value(s.to_owned())
                 })
             }
-            scalar::ScalarValue::List(value, datatype) => {
-                println!("Current datatype of list: {:?}", datatype);
+            scalar::ScalarValue::List(value, boxed_field) => {
+                println!("Current field of list: {:?}", boxed_field);
                 match value {
                     Some(values) => {
                         if values.is_empty() {
                             protobuf::ScalarValue {
                                 value: Some(protobuf::scalar_value::Value::ListValue(
                                     protobuf::ScalarListValue {
-                                        datatype: Some(datatype.as_ref().try_into()?),
+                                        field: Some(boxed_field.as_ref().into()),
                                         values: Vec::new(),
                                     },
                                 )),
                             }
                         } else {
-                            let scalar_type = match datatype.as_ref() {
+                            let scalar_type = match boxed_field.data_type() {
                                 DataType::List(field) => field.as_ref().data_type(),
-                                _ => todo!("Proper error handling"),
+                                unsupported => {
+                                    todo!("Proper error handling {}", unsupported)
+                                }
                             };
                             println!("Current scalar type for list: {:?}", scalar_type);
+
                             let type_checked_values: Vec<protobuf::ScalarValue> = values
                                 .iter()
-                                .map(|scalar| match (scalar, scalar_type) {
-                                    (
-                                        scalar::ScalarValue::List(_, list_type),
-                                        DataType::List(field),
-                                    ) => {
-                                        if let DataType::List(list_field) =
-                                            list_type.as_ref()
-                                        {
-                                            let scalar_datatype = field.data_type();
-                                            let list_datatype = list_field.data_type();
-                                            if std::mem::discriminant(list_datatype)
-                                                != std::mem::discriminant(scalar_datatype)
+                                .map(|scalar| {
+                                    dbg!(scalar);
+                                    match (scalar, scalar_type) {
+                                        (
+                                            scalar::ScalarValue::List(_, list_type),
+                                            DataType::List(field),
+                                        ) => {
+                                            dbg!(list_type);

Review Comment:
   ```suggestion
   ```



-- 
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 #2893: Preserve field name in `ScalarValue::List`

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#discussion_r923369831


##########
datafusion/common/src/scalar.rs:
##########
@@ -77,8 +77,8 @@ pub enum ScalarValue {
     /// large binary
     LargeBinary(Option<Vec<u8>>),
     /// list of nested ScalarValue
-    List(Option<Vec<ScalarValue>>, Box<DataType>),
-    /// Date stored as a signed 32bit int days since UNIX epoch 1970-01-01
+    List(Option<Vec<ScalarValue>>, Box<Field>),
+    /// Date stored as a signed 32bit int

Review Comment:
   ```suggestion
       /// Date stored as a signed 32bit int days since UNIX epoch 1970-01-01
   ```
   
   Seems to have gotten lost in the merge



-- 
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] ursabot commented on pull request #2893: Preserve field name in `ScalarValue::List`

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1187876874

   Benchmark runs are scheduled for baseline = 305e2650522e40a3704ef0e2b4e069b94f1c1e15 and contender = 90e5fd0480ca30d19d1b638e050e3a4da60df9cc. 90e5fd0480ca30d19d1b638e050e3a4da60df9cc is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/f3d7e1108862493b82ecfa93b61c50a3...261390244cff4d2c8ead4292429de639/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/8aca09652b724cc5950a817c69e0899d...452bfb9815f34d31bfdd0de417119078/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/884827bca93e413692abf65cc1f4b7e8...8c82f51a5863484fbd3b2e21ed7c0ae7/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/2c2c7c33435a4ad9b7fc1de887602e0e...d02da56fca2a41babdedb7ba77f2c58a/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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] comphead commented on pull request #2893: Scalar list preserve element name

Posted by GitBox <gi...@apache.org>.
comphead commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1184915227

   @alamb please check this PR again


-- 
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] codecov-commenter commented on pull request #2893: Scalar list preserve element name

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1182771886

   # [Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/2893?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2893](https://codecov.io/gh/apache/arrow-datafusion/pull/2893?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0a45547) into [master](https://codecov.io/gh/apache/arrow-datafusion/commit/6a5de4fe08597896ab6375e3e4b76c5744dcfba7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6a5de4f) will **increase** coverage by `0.06%`.
   > The diff coverage is `90.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #2893      +/-   ##
   ==========================================
   + Coverage   85.34%   85.41%   +0.06%     
   ==========================================
     Files         276      276              
     Lines       49294    49236      -58     
   ==========================================
   - Hits        42071    42055      -16     
   + Misses       7223     7181      -42     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-datafusion/pull/2893?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [datafusion/sql/src/planner.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9zcWwvc3JjL3BsYW5uZXIucnM=) | `81.38% <50.00%> (ø)` | |
   | [datafusion/proto/src/to\_proto.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9wcm90by9zcmMvdG9fcHJvdG8ucnM=) | `53.64% <63.15%> (-2.83%)` | :arrow_down: |
   | [.../physical-expr/src/aggregate/array\_agg\_distinct.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9hZ2dyZWdhdGUvYXJyYXlfYWdnX2Rpc3RpbmN0LnJz) | `80.18% <93.75%> (ø)` | |
   | [datafusion/common/src/scalar.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9jb21tb24vc3JjL3NjYWxhci5ycw==) | `75.74% <100.00%> (-0.04%)` | :arrow_down: |
   | [datafusion/core/src/scalar.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9jb3JlL3NyYy9zY2FsYXIucnM=) | `99.61% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...atafusion/physical-expr/src/aggregate/array\_agg.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9hZ2dyZWdhdGUvYXJyYXlfYWdnLnJz) | `95.87% <100.00%> (-0.05%)` | :arrow_down: |
   | [...sion/physical-expr/src/aggregate/count\_distinct.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9hZ2dyZWdhdGUvY291bnRfZGlzdGluY3QucnM=) | `94.73% <100.00%> (+0.01%)` | :arrow_up: |
   | [...fusion/physical-expr/src/aggregate/sum\_distinct.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9hZ2dyZWdhdGUvc3VtX2Rpc3RpbmN0LnJz) | `92.72% <100.00%> (+0.06%)` | :arrow_up: |
   | [datafusion/physical-expr/src/aggregate/tdigest.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9waHlzaWNhbC1leHByL3NyYy9hZ2dyZWdhdGUvdGRpZ2VzdC5ycw==) | `91.30% <100.00%> (+0.05%)` | :arrow_up: |
   | [datafusion/proto/src/from\_proto.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9wcm90by9zcmMvZnJvbV9wcm90by5ycw==) | `35.84% <100.00%> (+1.20%)` | :arrow_up: |
   | ... and [7 more](https://codecov.io/gh/apache/arrow-datafusion/pull/2893/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/2893?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/2893?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [6a5de4f...0a45547](https://codecov.io/gh/apache/arrow-datafusion/pull/2893?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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 #2893: Preserve field name in `ScalarValue::List`

Posted by GitBox <gi...@apache.org>.
alamb merged PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893


-- 
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] comphead commented on pull request #2893: Scalar list preserve element name

Posted by GitBox <gi...@apache.org>.
comphead commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1184758436

   @alamb I have reenabled commented test, and build is ok. Do you think we can proceed?


-- 
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] comphead commented on pull request #2893: Scalar list preserve element name

Posted by GitBox <gi...@apache.org>.
comphead commented on PR #2893:
URL: https://github.com/apache/arrow-datafusion/pull/2893#issuecomment-1182756614

   @alamb you mentioned in #2840 the encoding/decoding issue still exists, please give more details, I'll try to fix it in this PR


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