You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "planga82 (via GitHub)" <gi...@apache.org> on 2024/02/26 15:08:23 UTC

[PR] [SPARK-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

planga82 opened a new pull request, #45261:
URL: https://github.com/apache/spark/pull/45261

   <!--
   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.
   -->
   Considering the following case 
   
   ```
   ./bin/spark-shell --packages org.postgresql:postgresql:9.4.1211 --conf spark.sql.timestampType=TIMESTAMP_NTZ
   
   spark.sql("create table tz3 using jdbc options('url' 'jdbc:postgresql://localhost:5432/postgres?user=postgres&password=postgres', 'dbtable' 'public.tz', 'driver' 'org.postgresql.Driver', 'preferTimestampNTZ' 'true') as select 1 as id, to_timestamp('2021-04-01 00:00:00', 'yyyy-MM-dd HH:mm:ss') as ts")
   
   spark.sql("select * from tz3 where ts=to_timestamp('2021-04-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')").show
   
   ```
   
   The generated query is incorrect because the literal is not quoted
   
   ```
   ERROR:  syntax error at or near "T00" at character 81
   STATEMENT:  SELECT "id","ts" FROM public.tz  WHERE ("ts" IS NOT NULL) AND ("ts" = 2021-04-01T00:00)
   
   ```
   TimestampNTZConverter generates a LocalDateTime value that we do not consider in JdbcDialect.compileValue
   
   
   ### 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.
   -->
   It solves the bug explained
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   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'.
   -->
   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.
   -->
   With unit tests and manually
   
   ### 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.
   -->
   No


-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -289,6 +289,7 @@ abstract class JdbcDialect extends Serializable with Logging {
   def compileValue(value: Any): Any = value match {
     case stringValue: String => s"'${escapeSql(stringValue)}'"
     case timestampValue: Timestamp => "'" + timestampValue + "'"
+    case timestampValue: LocalDateTime => "'" + timestampValue + "'"

Review Comment:
   Could you format in the same way as `Instant`, and use the fraction formatter.



##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,8 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        LocalDateTime.parse("2007-12-03T10:15:30"))) === """"col0" < '2007-12-03T10:15:30'""")

Review Comment:
   Shouldn't be consistent to the above, and don't have `T` between date and time?



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,9 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        Timestamp.valueOf("2007-12-03 10:15:30").toLocalDateTime))

Review Comment:
   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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

Posted by "planga82 (via GitHub)" <gi...@apache.org>.
planga82 commented on PR #45261:
URL: https://github.com/apache/spark/pull/45261#issuecomment-1965134090

   Thanks @MaxGekk ! 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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,8 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        LocalDateTime.of(2007, 12, 3, 10, 15, 30))) === """"col0" < '2007-12-03 10:15:30'""")

Review Comment:
   Yes. This is more readable. A readable string to generate to correct class instance is preferred in test code.



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,8 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        LocalDateTime.of(2007, 12, 3, 10, 15, 30))) === """"col0" < '2007-12-03 10:15:30'""")

Review Comment:
   @amaliujia Are you talking about something like `Timestamp.valueOf("2007-12-03 10:15:30").toLocalDateTime` ?



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,8 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        LocalDateTime.of(2007, 12, 3, 10, 15, 30))) === """"col0" < '2007-12-03 10:15:30'""")

Review Comment:
   Yes. This is more readable. A readable string to generate correct class instance is preferred in test code.



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,8 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        LocalDateTime.parse("2007-12-03T10:15:30"))) === """"col0" < '2007-12-03T10:15:30'""")

Review Comment:
   Here `LocalDateTime.parse("2007-12-03T10:15:30")` is the default format for the parser and fail without the 'T'. I have change it to other constructor to avoid confusion



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,9 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        Timestamp.valueOf("2007-12-03 10:15:30").toLocalDateTime))

Review Comment:
   SGTM



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

Posted by "09306677806 (via GitHub)" <gi...@apache.org>.
09306677806 commented on PR #45261:
URL: https://github.com/apache/spark/pull/45261#issuecomment-1971728089

   Dear groups and respected programmers، I open bookmarks as fast as possible
   in Linux or Windows America and the assets of servers are hacked whenever
   possible and I have governments to cooperate fully to protect them
   
   ShahrzadMahro
   
   در تاریخ دوشنبه ۲۶ فوریه ۲۰۲۴،‏ ۱۸:۴۱ Pablo Langa ***@***.***>
   نوشت:
   
   > What changes were proposed in this pull request?
   >
   > Considering the following case
   >
   > ./bin/spark-shell --packages org.postgresql:postgresql:9.4.1211 --conf spark.sql.timestampType=TIMESTAMP_NTZ
   >
   > spark.sql("create table tz3 using jdbc options('url' 'jdbc:postgresql://localhost:5432/postgres?user=postgres&password=postgres', 'dbtable' 'public.tz', 'driver' 'org.postgresql.Driver', 'preferTimestampNTZ' 'true') as select 1 as id, to_timestamp('2021-04-01 00:00:00', 'yyyy-MM-dd HH:mm:ss') as ts")
   >
   > spark.sql("select * from tz3 where ts=to_timestamp('2021-04-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')").show
   >
   >
   > The generated query is incorrect because the literal is not quoted
   >
   > ERROR:  syntax error at or near "T00" at character 81
   > STATEMENT:  SELECT "id","ts" FROM public.tz  WHERE ("ts" IS NOT NULL) AND ("ts" = 2021-04-01T00:00)
   >
   >
   > TimestampNTZConverter generates a LocalDateTime value that we do not
   > consider in JdbcDialect.compileValue
   > Why are the changes needed?
   >
   > It solves the bug explained
   > Does this PR introduce *any* user-facing change?
   >
   > No
   > How was this patch tested?
   >
   > With unit tests and manually
   > Was this patch authored or co-authored using generative AI tooling?
   >
   > No
   > ------------------------------
   > You can view, comment on, or merge this pull request online at:
   >
   >   https://github.com/apache/spark/pull/45261
   > Commit Summary
   >
   >    - 6b50407
   >    <https://github.com/apache/spark/pull/45261/commits/6b50407e892254c7353a3ac1b2d986f40d848e0d>
   >    add test
   >    - f8f6544
   >    <https://github.com/apache/spark/pull/45261/commits/f8f6544c5062d06a9f37be155e8fbe7c89c32e11>
   >    Fix
   >
   > File Changes
   >
   > (2 files <https://github.com/apache/spark/pull/45261/files>)
   >
   >    - *M*
   >    sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
   >    <https://github.com/apache/spark/pull/45261/files#diff-1533255ad629a18e883f8186b303fdf4fae99043551ce20c5b5ea06d085e0b14>
   >    (1)
   >    - *M* sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
   >    <https://github.com/apache/spark/pull/45261/files#diff-f199a0c955304669dded23f71aabd41cd5e69680d91a007f5e3a37fb1d647c59>
   >    (2)
   >
   > Patch Links:
   >
   >    - https://github.com/apache/spark/pull/45261.patch
   >    - https://github.com/apache/spark/pull/45261.diff
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/spark/pull/45261>, or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/ANEZZRFMLBHCYJD6F5Q2GZ3YVSQZ5AVCNFSM6AAAAABD2MADD2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2TINBRGAYTQNA>
   > .
   > You are receiving this because you are subscribed to this thread.Message
   > ID: ***@***.***>
   >
   


-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,9 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        Timestamp.valueOf("2007-12-03 10:15:30").toLocalDateTime))

Review Comment:
   It would be better to don't mix classes of different calendar system. Just use the `parse()` method like:
   ```scala
   LocalDateTime.parse("2007-12-03 10:15:30")
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,9 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        Timestamp.valueOf("2007-12-03 10:15:30").toLocalDateTime))

Review Comment:
   It would be better to don't mix classes of different calendar systems. Just use the `parse()` method like:
   ```scala
   LocalDateTime.parse("2007-12-03 10:15:30")
   ```



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,9 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        Timestamp.valueOf("2007-12-03 10:15:30").toLocalDateTime))

Review Comment:
   @MaxGekk This parse method don't allow this string format
   
   ```
   java.time.format.DateTimeParseException: Text '2007-12-03 10:15:30' could not be parsed at index 10
   ```
   but it would be possible in the following way
   
   ```
   LocalDateTime.parse("2007-12-03 10:15:30", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
   ```



-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk closed pull request #45261: [SPARK-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue.
URL: https://github.com/apache/spark/pull/45261


-- 
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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #45261:
URL: https://github.com/apache/spark/pull/45261#issuecomment-1968474427

   +1, LGTM. Merging to master.
   Thank you, @planga82 and @amaliujia for 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-46077][SQL] Consider the type generated by TimestampNTZConverter in JdbcDialect.compileValue. [spark]

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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -807,6 +807,8 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       assert(doCompileFilter(LessThan(col0, 5)) === """"col0" < 5""")
       assert(doCompileFilter(LessThan(col0,
         Timestamp.valueOf("1995-11-21 00:00:00.0"))) === """"col0" < '1995-11-21 00:00:00.0'""")
+      assert(doCompileFilter(LessThan(col0,
+        LocalDateTime.of(2007, 12, 3, 10, 15, 30))) === """"col0" < '2007-12-03 10:15:30'""")

Review Comment:
   I guess the suggestion also included to use `Timestamp.valueOf("2007-12-03 10:15:30"))`



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