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/06/06 22:59:24 UTC
[PR] fix: support read Struct by user schema [datafusion-comet]
comphead opened a new pull request, #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860
## 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 #1843 .
## 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] fix: support read Struct by user schema [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#discussion_r2133038738
##########
native/core/src/parquet/parquet_support.rs:
##########
@@ -239,14 +242,24 @@ fn cast_struct_to_struct(
parquet_options,
)?;
cast_fields.push(cast_field);
+ field_overlap = true;
} else {
cast_fields.push(new_null_array(to_fields[i].data_type(), array.len()));
}
}
+
+ // If target schema doesn't contain any of the existing fields
+ // mark such a column in array as NULL
+ let nulls = if field_overlap {
Review Comment:
this is an actual 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@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] fix: support read Struct by user schema [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#discussion_r2133038151
##########
spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala:
##########
@@ -862,6 +862,7 @@ abstract class CometTestBase
testName: String = "test",
tableName: String = "tbl",
sqlConf: Seq[(String, String)] = Seq.empty,
+ readSchema: Option[StructType] = None,
Review Comment:
to support reading Comet with custom schema
--
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] fix: support read Struct by user schema [datafusion-comet]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#issuecomment-2951225627
## [Codecov](https://app.codecov.io/gh/apache/datafusion-comet/pull/1860?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 32.18%. 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 [(`616b2f7`)](https://app.codecov.io/gh/apache/datafusion-comet/commit/616b2f7557ec2dc29fa0003f3bab1eac6d10ee70?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 246 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #1860 +/- ##
=============================================
- Coverage 56.12% 32.18% -23.95%
+ Complexity 976 651 -325
=============================================
Files 119 130 +11
Lines 11743 12659 +916
Branches 2251 2359 +108
=============================================
- Hits 6591 4074 -2517
- Misses 4012 7792 +3780
+ Partials 1140 793 -347
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/datafusion-comet/pull/1860?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] fix: support read Struct by user schema [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#discussion_r2133040038
##########
native/core/src/execution/planner.rs:
##########
@@ -3331,4 +3347,146 @@ mod tests {
Ok(())
}
+
+ #[tokio::test]
+ async fn test_nested_types_extract_missing_struct_names() -> Result<(), DataFusionError> {
Review Comment:
I'm planning to refactor rust planner tests into separate file and factor out common parts, like test parquet creation, test preparation, etc
--
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] fix: support read Struct by user schema [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#discussion_r2139136916
##########
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala:
##########
@@ -2728,4 +2728,35 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
assert(cometWindowExecs.isEmpty)
}
+ test("vectorized reader: missing all struct fields") {
+ Seq(true, false).foreach { offheapEnabled =>
+ withSQLConf(
+ SQLConf.USE_V1_SOURCE_LIST.key -> "parquet",
+ CometConf.COMET_EXEC_ENABLED.key -> "true",
+ CometConf.COMET_ENABLED.key -> "false",
Review Comment:
nice catch, enabling it back
--
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] fix: support read Struct by user schema [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860
--
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] fix: support read Struct by user schema [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#discussion_r2138035209
##########
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala:
##########
@@ -2728,4 +2728,35 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
assert(cometWindowExecs.isEmpty)
}
+ test("vectorized reader: missing all struct fields") {
+ Seq(true, false).foreach { offheapEnabled =>
+ withSQLConf(
+ SQLConf.USE_V1_SOURCE_LIST.key -> "parquet",
+ CometConf.COMET_EXEC_ENABLED.key -> "true",
+ CometConf.COMET_ENABLED.key -> "false",
Review Comment:
Why is Comet disabled 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] fix: support read Struct by user schema [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #1860:
URL: https://github.com/apache/datafusion-comet/pull/1860#issuecomment-2964357089
miri failure due to https://github.com/apache/datafusion-comet/issues/1871
--
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