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/09/02 13:35:05 UTC

[PR] fix always true/false literals for jdbc connectors [spark]

PetarVasiljevic-DB opened a new pull request, #52198:
URL: https://github.com/apache/spark/pull/52198

   <!--
   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?
   <!--
   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?
   <!--
   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?
   <!--
   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?
   <!--
   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?
   <!--
   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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2332917054


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   Just to clarify, are you suggesting to just translate AlwaysTrue/AlwaysFalse to `WHERE 1=1`/`WHERE 1=0` always? This way we don't need to change the API



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #52198: [SPARK-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors
URL: https://github.com/apache/spark/pull/52198


-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2322361443


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   Makes sense. Thanks to both. But that means that someone, that is working with older versions of Oracle, will need to override the visitLiteral and use their own dialect instead of just changing the sql conf. Is this expected from the users?



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2316415024


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   it doesn't work for all dialects. For example, Oracle dialect doesn't support `WHERE 1` in some older versions.



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2318583607


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   how about `WHERE 1=1/1=0`? Does it work anywhere?



##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   how about `WHERE 1=1/1=0`? Does it work every where?



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2318065845


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   no, sorry, `WHERE TRUE` does not work in older versions of Oracle.



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2332946535


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   yes



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2322417962


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   > Oracle dialect doesn't support WHERE 1 in some older versions
   
   @PetarVasiljevic-DB I got confused, I mean always translate `TURE` to `1=1` in the default implementation, as you said 
   
   >  It should be working everywhere.
   
   What's the issue 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: 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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #52198:
URL: https://github.com/apache/spark/pull/52198#issuecomment-3672865370

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2317651783


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   do you mean `WHERE 1=1` does not work in old Oracle versions?



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "PetarVasiljevic-DB (via GitHub)" <gi...@apache.org>.
PetarVasiljevic-DB commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2318626235


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   Good question. It should be working everywhere. In case it doesn't, I think there are more cases where `WHERE 1/0` doesn't work then where `WHERE 1=1/1=0` doesn't work.



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2318790237


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   Adding new dialect APIs means more mental overhead for dialect developers, it's better to not add it if it's not necessary.



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2322191982


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   I also think this method is unnecessary.
   
   In case the underlying RDBMS does not support `WHERE 1=1/1=0`, developers still get a chance to override the method `def visitLiteral(literal: Literal[_]): String`



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2316169383


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -391,10 +391,27 @@ abstract class JdbcDialect extends Serializable with Logging {
     protected def predicateToIntSQL(input: String): String =
       "CASE WHEN " + input + " THEN 1 ELSE 0 END"
 
+    /**
+     * For third-party JDBC dialects, we are not sure if WHERE ([TRUE/FALSE]) can be
+     * executed. Therefore, by default, it will be replaced with WHERE ([1 = 1 / 1 = 0]).
+     */
+    protected def translateBooleanLiteralsAsComparison: Boolean = true

Review Comment:
   Do we need this dialect API if `1=1`/`1=0` works for all dialects?



-- 
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-53454][SQL] Fix AlwaysTrue/AlwaysFalse predicate translation in JDBC connectors [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52198:
URL: https://github.com/apache/spark/pull/52198#discussion_r2334669033


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -5141,6 +5141,16 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_JDBC_CONNECTOR_BOOLEAN_LITERAL_TRANSLATION =
+    buildConf("spark.sql.legacy.jdbc.connectorBooleanLiteralTranslation")
+      .internal()
+      .doc("When set to true, boolean literals (true, false) will be translated as " +
+        "such (true, false). When false, boolean 'true' will be translated to '1=1' and" +
+        " boolean 'false' will be translated to 'false'. Some JDBC drivers don't support" +
+        " 'WHERE true' syntax that can be the result of AQE.")

Review Comment:
   how about?
   ```suggestion
       buildConf("spark.sql.legacy.jdbc.booleanLiteralCondition.enabled")
         .internal()
         .doc("When false, boolean literal 'TRUE' condition will be translated to '1=1' " +
           "and boolean literal 'FALSE' condition will be translated to '1=0'. " +
           "Otherwise, boolean literal condition will be kept, this might cause issues " +
           "when the JDBC driver does not support 'WHERE TRUE' syntax.")
   ```
   
   and this needs to be documented in the migration guide.



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