You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org> on 2025/07/30 06:58:26 UTC
[PR] [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule [spark]
PetarVasiljevic-DB opened a new pull request, #51720:
URL: https://github.com/apache/spark/pull/51720
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
Added logs in DSv2 Join pushdown to improve debugability.
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
If the join pushdown fails, it should be easier for user to see what entry points have been touched and where it failed.
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
No.
<!--
Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
No need for tests as it is logging only change.
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
### Was this patch authored or co-authored using generative AI tooling?
No.
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for 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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3139965279
The YARN test failure is unrelated, thanks, merging to master!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2242094170
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCScanBuilder.scala:
##########
@@ -234,6 +239,8 @@ case class JDBCScanBuilder(
jdbcOptions = new JDBCOptions(newJdbcOptionsMap)
finalSchema = requiredSchema
+ logInfo(log"Updated JDBC schema due to join pushdown. " +
+ log"New schema: ${MDC(SCHEMA, finalSchema.simpleString)}")
Review Comment:
BTW is this log useful? it's only column name and data type
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2244218551
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala:
##########
@@ -220,8 +236,16 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
leftHolder.output = node.output.asInstanceOf[Seq[AttributeReference]]
leftHolder.pushedJoinOutputMap = pushedJoinOutputMap
+ // TODO: for cascade joins, already joined relations will still have the name of the
+ // original(leaf) relation. It should be thought of if we want to change the name of the
+ // relation when join is pushed down.
+ logInfo(log"DSv2 Join pushdown - successfully pushed down join between relations " +
+ log"${MDC(RELATION_NAME, leftHolder.relation.name)} and " +
+ log"${MDC(RELATION_NAME, rightHolder.relation.name)}.")
+
leftHolder
} else {
+ logInfo(log"DSV2 Join pushdown - failed to push down join.")
Review Comment:
nit
```suggestion
logInfo(log"DSv2 Join pushdown - failed to push down join.")
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3137751472
@cloud-fan can we 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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3139446305
Seems like `YarnClusterSuite ` is flaky. Yesterday it was failing as well, then I pushed empty commit to retrigger it and it passed. Now it fails again. This shouldn't be a blocker.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3139265930
@pan3793 done
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2242371827
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCScanBuilder.scala:
##########
@@ -234,6 +239,8 @@ case class JDBCScanBuilder(
jdbcOptions = new JDBCOptions(newJdbcOptionsMap)
finalSchema = requiredSchema
+ logInfo(log"Updated JDBC schema due to join pushdown. " +
+ log"New schema: ${MDC(SCHEMA, finalSchema.simpleString)}")
Review Comment:
The way I see it being useful is in scenario where we generate `columnWithAlias` on Spark side, but then the output of connector (JDBC) doesn't match that. LMK your thoughts, if you find it useless, I can remove it.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2242087592
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala:
##########
@@ -204,6 +204,36 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
normalizedCondition.flatMap(DataSourceV2Strategy.translateFilterV2(_))
val translatedJoinType = DataSourceStrategy.translateJoinType(joinType)
+ logInfo(log"DSv2 Join pushdown - translated join condition " +
+ log"${MDC(JOIN_CONDITION, translatedCondition)}")
+ logInfo(log"DSv2 Join pushdown - translated join type " +
+ log"${MDC(JOIN_TYPE, translatedJoinType)}")
+
+ val prettyLeftSideRequiredColumnsWithAliases = leftSideRequiredColumnsWithAliases
+ .map(e => s"(${e.colName()}, ${e.alias()})")
Review Comment:
how about `"${e.colName()} AS ${e.alias()}"`
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2242092596
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCScanBuilder.scala:
##########
@@ -234,6 +239,8 @@ case class JDBCScanBuilder(
jdbcOptions = new JDBCOptions(newJdbcOptionsMap)
finalSchema = requiredSchema
+ logInfo(log"Updated JDBC schema due to join pushdown. " +
+ log"New schema: ${MDC(SCHEMA, finalSchema.simpleString)}")
Review Comment:
shall we use `toDDL`? `simpleString` may truncate.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3135097793
@cloud-fan may I get review?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2242088304
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala:
##########
@@ -204,6 +204,36 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
normalizedCondition.flatMap(DataSourceV2Strategy.translateFilterV2(_))
val translatedJoinType = DataSourceStrategy.translateJoinType(joinType)
+ logInfo(log"DSv2 Join pushdown - translated join condition " +
+ log"${MDC(JOIN_CONDITION, translatedCondition)}")
+ logInfo(log"DSv2 Join pushdown - translated join type " +
+ log"${MDC(JOIN_TYPE, translatedJoinType)}")
+
+ val prettyLeftSideRequiredColumnsWithAliases = leftSideRequiredColumnsWithAliases
+ .map(e => s"(${e.colName()}, ${e.alias()})")
Review Comment:
if alias is null, then just `e.colName()`
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3139891609
@cloud-fan @pan3793 can we merge? Failures are not related to the change
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #51720: [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule
URL: https://github.com/apache/spark/pull/51720
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #51720:
URL: https://github.com/apache/spark/pull/51720#discussion_r2242374010
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala:
##########
@@ -204,6 +204,36 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
normalizedCondition.flatMap(DataSourceV2Strategy.translateFilterV2(_))
val translatedJoinType = DataSourceStrategy.translateJoinType(joinType)
+ logInfo(log"DSv2 Join pushdown - translated join condition " +
+ log"${MDC(JOIN_CONDITION, translatedCondition)}")
+ logInfo(log"DSv2 Join pushdown - translated join type " +
+ log"${MDC(JOIN_TYPE, translatedJoinType)}")
+
+ val prettyLeftSideRequiredColumnsWithAliases = leftSideRequiredColumnsWithAliases
+ .map(e => s"(${e.colName()}, ${e.alias()})")
Review Comment:
sure, I have added `prettyString` method to `ColumnWithAlias` to do it.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #51720:
URL: https://github.com/apache/spark/pull/51720#issuecomment-3138376086
It seems unnecessary to mention log4j in the PR title, would you mind changing it?
```patch
- [SPARK-53017][SQL][FOLLOWUP] Add log4j logs in DSv2 Join pushdown rule
+ [SPARK-53017][SQL][FOLLOWUP] Add logs in DSv2 Join pushdown rule
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org