You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "comphead (via GitHub)" <gi...@apache.org> on 2025/08/01 19:45:56 UTC
[PR] feat: Support Array Literal [datafusion-comet]
comphead opened a new pull request, #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057
## 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 #1977.
Replaces accidentally closed #1978
## 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.
-->
## How 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
2. 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)?
-->
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2261309699
##########
native/proto/src/proto/types.proto:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+syntax = "proto3";
+
+package spark.spark_expression;
+
+option java_package = "org.apache.comet.serde";
+
+message ListLiteral {
+ // Only one of these fields should be populated based on the array type
+ repeated bool boolean_values = 1;
+ repeated int32 byte_values = 2;
+ repeated int32 short_values = 3;
+ repeated int32 int_values = 4;
+ repeated int64 long_values = 5;
+ repeated float float_values = 6;
+ repeated double double_values = 7;
+ repeated string string_values = 8;
+ repeated bytes bytes_values = 9;
+ repeated bytes decimal_values = 10;
+ repeated ListLiteral list_values = 11;
Review Comment:
correct
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2264507470
##########
native/proto/src/proto/types.proto:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+syntax = "proto3";
+
+package spark.spark_expression;
+
+option java_package = "org.apache.comet.serde";
+
+message ListLiteral {
Review Comment:
Thanks @parthchandra for the review, please help me to understand enum proposal? enum can define types variants
```
enum Type {
BOOLEAN = 0,
etc
}
```
and to send data across boundaries as bytes?
If it is, can it be considered as follow up 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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2267479920
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +481,123 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(BooleanArray::new(BooleanBuffer::from(vals.boolean_values), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int8 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int8Array::new(vals.byte_values.iter().map(|&x| x as i8).collect::<Vec<_>>().into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int16 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int16Array::new(vals.short_values.iter().map(|&x| x as i16).collect::<Vec<_>>().into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int32 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int32Array::new(vals.int_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int64 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int64Array::new(vals.long_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Float32 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Float32Array::new(vals.float_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Float64 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Float64Array::new(vals.double_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Timestamp(TimeUnit::Microsecond, None) => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(TimestampMicrosecondArray::new(vals.long_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Timestamp(TimeUnit::Microsecond, Some(tz)) => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(TimestampMicrosecondArray::new(vals.long_values.into(), Some(vals.null_mask.into())).with_timezone(Arc::clone(tz))))
+ .build_list_scalar()
+ }
+ DataType::Date32 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Date32Array::new(vals.int_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Binary => {
+ // Using a builder here as it is quite complicated to create StringArray from a vector with nulls
Review Comment:
Nit: "BinaryArray" in this one, not "StringArray".
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +481,123 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(BooleanArray::new(BooleanBuffer::from(vals.boolean_values), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int8 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int8Array::new(vals.byte_values.iter().map(|&x| x as i8).collect::<Vec<_>>().into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int16 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int16Array::new(vals.short_values.iter().map(|&x| x as i16).collect::<Vec<_>>().into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int32 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int32Array::new(vals.int_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Int64 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Int64Array::new(vals.long_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Float32 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Float32Array::new(vals.float_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Float64 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Float64Array::new(vals.double_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Timestamp(TimeUnit::Microsecond, None) => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(TimestampMicrosecondArray::new(vals.long_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Timestamp(TimeUnit::Microsecond, Some(tz)) => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(TimestampMicrosecondArray::new(vals.long_values.into(), Some(vals.null_mask.into())).with_timezone(Arc::clone(tz))))
+ .build_list_scalar()
+ }
+ DataType::Date32 => {
+ let vals = values.clone();
+ SingleRowListArrayBuilder::new(Arc::new(Date32Array::new(vals.int_values.into(), Some(vals.null_mask.into()))))
+ .build_list_scalar()
+ }
+ DataType::Binary => {
+ // Using a builder here as it is quite complicated to create StringArray from a vector with nulls
+ // to calculate correct offsets
+ let vals = values.clone();
+ let len = vals.bytes_values.len();
+ let mut arr = BinaryBuilder::with_capacity(len, len);
+
+ for (i, v) in vals.bytes_values.into_iter().enumerate() {
+ if vals.null_mask[i] {
+ arr.append_value(v);
+ } else {
+ arr.append_null();
+ }
+ }
+
+ SingleRowListArrayBuilder::new(Arc::new(arr.finish()))
+ .build_list_scalar()
+ }
+ DataType::Utf8 => {
+ // Using a builder here as it is quite complicated to create StringArray from a vector with nulls
+ // to calculate correct offsets
+ let vals = values.clone();
+ let len = vals.string_values.len();
+ let mut arr = StringBuilder::with_capacity(len, len);
Review Comment:
Maybe add a TODO that there could be a better heuristic for the second arg than `len` or maybe even serialize over the number of bytes _a priori_.
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#issuecomment-3145741036
## [Codecov](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `3.27869%` with `59 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 34.13%. Comparing base ([`f09f8af`](https://app.codecov.io/gh/apache/datafusion-comet/commit/f09f8af64c6599255e116a376f4f008f2fd63b43?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`dac4cb6`](https://app.codecov.io/gh/apache/datafusion-comet/commit/dac4cb621928d92fdd687d8047f4aa683d0f0e3c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 342 commits behind head on main.
| [Files with missing lines](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [.../scala/org/apache/comet/serde/QueryPlanSerde.scala](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?src=pr&el=tree&filepath=spark%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fcomet%2Fserde%2FQueryPlanSerde.scala&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3Bhcmsvc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9jb21ldC9zZXJkZS9RdWVyeVBsYW5TZXJkZS5zY2FsYQ==) | 3.44% | [52 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...scala/org/apache/comet/expressions/CometCast.scala](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?src=pr&el=tree&filepath=spark%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fcomet%2Fexpressions%2FCometCast.scala&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3Bhcmsvc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9jb21ldC9leHByZXNzaW9ucy9Db21ldENhc3Quc2NhbGE=) | 0.00% | [1 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #2057 +/- ##
=============================================
- Coverage 56.12% 34.13% -21.99%
+ Complexity 976 855 -121
=============================================
Files 119 137 +18
Lines 11743 13155 +1412
Branches 2251 2390 +139
=============================================
- Hits 6591 4491 -2100
- Misses 4012 7733 +3721
+ Partials 1140 931 -209
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/datafusion-comet/pull/2057?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#issuecomment-3172748210
@parthchandra @mbutrovich please take another look
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#issuecomment-3164570023
@andygrove @mbutrovich @parthchandra please take a look
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2261258597
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
Can we skip builders entirely? Does this get you equivalent behavior?
```
DataType::Boolean => {
let arr = BooleanArray::new(values.clone().boolean_values.into(),Some(values.clone().null_mask.into()));
SingleRowListArrayBuilder::new(Arc::new(arr)).build_list_scalar()
}
```
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2261455745
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
Addressed
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2325023860
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -711,8 +715,53 @@ object QueryPlanSerde extends Logging with CometExprShim {
binding,
(builder, binaryExpr) => builder.setNeqNullSafe(binaryExpr))
+ case GreaterThan(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setGt(binaryExpr))
+
+ case GreaterThanOrEqual(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setGtEq(binaryExpr))
+
+ case LessThan(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setLt(binaryExpr))
+
+ case LessThanOrEqual(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setLtEq(binaryExpr))
+
case Literal(value, dataType)
- if supportedDataType(dataType, allowComplex = value == null) =>
+ if supportedDataType(
+ dataType,
+ allowComplex = value == null ||
+ // Nested literal support for native reader
+ // can be tracked https://github.com/apache/datafusion-comet/issues/1937
+ // now supports only Array of primitive
+ (Seq(CometConf.SCAN_NATIVE_ICEBERG_COMPAT, CometConf.SCAN_NATIVE_DATAFUSION)
Review Comment:
Why is nested literal noly supported for native reader?
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2255314164
##########
spark/src/test/scala/org/apache/comet/CometArrayExpressionSuite.scala:
##########
@@ -272,8 +273,7 @@ class CometArrayExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelp
}
}
- // https://github.com/apache/datafusion-comet/issues/1929
- ignore("array_contains - array literals") {
+ test("array_contains - array literals") {
Review Comment:
runs now
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead merged PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2264887885
##########
native/proto/src/proto/types.proto:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+syntax = "proto3";
+
+package spark.spark_expression;
+
+option java_package = "org.apache.comet.serde";
+
+message ListLiteral {
Review Comment:
Correct. If the ListLiteral is an enum type then you will need only one field instead of multiple fields only one of which can be populated.
So
```
enum LiteralValueType {
BOOLEAN = 0,
...
}
message ListLiteral {
LiteralValueType value
}
```
Just realized that I'm not sure if it will work with nested lists though.
Maybe you can try this is in a follow up 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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2325377904
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -711,8 +715,53 @@ object QueryPlanSerde extends Logging with CometExprShim {
binding,
(builder, binaryExpr) => builder.setNeqNullSafe(binaryExpr))
+ case GreaterThan(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setGt(binaryExpr))
+
+ case GreaterThanOrEqual(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setGtEq(binaryExpr))
+
+ case LessThan(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setLt(binaryExpr))
+
+ case LessThanOrEqual(left, right) =>
+ createBinaryExpr(
+ expr,
+ left,
+ right,
+ inputs,
+ binding,
+ (builder, binaryExpr) => builder.setLtEq(binaryExpr))
+
case Literal(value, dataType)
- if supportedDataType(dataType, allowComplex = value == null) =>
+ if supportedDataType(
+ dataType,
+ allowComplex = value == null ||
+ // Nested literal support for native reader
+ // can be tracked https://github.com/apache/datafusion-comet/issues/1937
+ // now supports only Array of primitive
+ (Seq(CometConf.SCAN_NATIVE_ICEBERG_COMPAT, CometConf.SCAN_NATIVE_DATAFUSION)
Review Comment:
I'm working on this @wForget it works but has some issues with Spark 4.0 which I found in https://github.com/apache/datafusion-comet/pull/2181
Hope it would be fixed soon
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2254659597
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
TODO: create macros here
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2261263456
##########
native/proto/src/proto/types.proto:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+syntax = "proto3";
+
+package spark.spark_expression;
+
+option java_package = "org.apache.comet.serde";
+
+message ListLiteral {
+ // Only one of these fields should be populated based on the array type
+ repeated bool boolean_values = 1;
+ repeated int32 byte_values = 2;
+ repeated int32 short_values = 3;
+ repeated int32 int_values = 4;
+ repeated int64 long_values = 5;
+ repeated float float_values = 6;
+ repeated double double_values = 7;
+ repeated string string_values = 8;
+ repeated bytes bytes_values = 9;
+ repeated bytes decimal_values = 10;
+ repeated ListLiteral list_values = 11;
Review Comment:
Is this for future supported of lists within lists?
##########
native/proto/src/proto/types.proto:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+syntax = "proto3";
+
+package spark.spark_expression;
+
+option java_package = "org.apache.comet.serde";
+
+message ListLiteral {
+ // Only one of these fields should be populated based on the array type
+ repeated bool boolean_values = 1;
+ repeated int32 byte_values = 2;
+ repeated int32 short_values = 3;
+ repeated int32 int_values = 4;
+ repeated int64 long_values = 5;
+ repeated float float_values = 6;
+ repeated double double_values = 7;
+ repeated string string_values = 8;
+ repeated bytes bytes_values = 9;
+ repeated bytes decimal_values = 10;
+ repeated ListLiteral list_values = 11;
Review Comment:
Is this for future support of lists within lists?
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2264063147
##########
native/proto/src/proto/types.proto:
##########
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+syntax = "proto3";
+
+package spark.spark_expression;
+
+option java_package = "org.apache.comet.serde";
+
+message ListLiteral {
Review Comment:
Use an enum here. maybe?
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2254659597
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
TODO: create macros here
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2261258597
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
Can we skip builders entirely? Does this get you equivalent behavior?
```
DataType::Boolean => {
let arr = BooleanArray::new(values.clone().boolean_values.into(),Some(values.clone().null_mask.into()));
SingleRowListArrayBuilder::new(Arc::new(arr))
.build_list_scalar()
}
```
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
Can we skip builders entirely? Does this get you equivalent behavior?
```
DataType::Boolean => {
let arr = BooleanArray::new(values.clone().boolean_values.into(),Some(values.clone().null_mask.into()));
SingleRowListArrayBuilder::new(Arc::new(arr)) .build_list_scalar()
}
```
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Support Array Literal [datafusion-comet]
Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #2057:
URL: https://github.com/apache/datafusion-comet/pull/2057#discussion_r2261258597
##########
native/core/src/execution/planner.rs:
##########
@@ -474,6 +480,240 @@ impl PhysicalPlanner {
)))
}
}
+ },
+ Value::ListVal(values) => {
+ if let DataType::List(f) = data_type {
+ match f.data_type() {
+ DataType::Null => {
+ SingleRowListArrayBuilder::new(Arc::new(NullArray::new(values.clone().null_mask.len())))
+ .build_list_scalar()
+ }
+ DataType::Boolean => {
Review Comment:
Can we skip builders entirely? Does this get you equivalent behavior?
```
DataType::Boolean => {
let arr = BooleanArray::new(values.clone().boolean_values.into(),Some(values.clone().null_mask.into()));
SingleRowListArrayBuilder::new(Arc::new(arr)).build_list_scalar()
}
```
The Builders can be slow (a lot of recent work to remove them in arrow kernels), though they will improve with this PR: https://github.com/apache/arrow-rs/pull/7984
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org