You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/11/08 13:53:14 UTC

[GitHub] [spark] peter-toth commented on pull request #28953: [SPARK-32013][SQL] Support query execution before reading DataFrame and before/after writing DataFrame over JDBC

peter-toth commented on PR #28953:
URL: https://github.com/apache/spark/pull/28953#issuecomment-1307255587

   @abhishekboga, sorry I can't test this feature with Snowflake, but I added the following simple unittest using H2 into `sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala`: 
   ```
     test("SPARK-32013: option sessionInitStatement, call stored function") {
       val initSQL =
         """CREATE ALIAS NEXT_PRIME AS '
           |String nextPrime(String value) {
           |  return new BigInteger(value).nextProbablePrime().toString();
           |}';
           |INSERT INTO TEST.seq VALUES(NEXT_PRIME(1000))
           |""".stripMargin
       val df = spark.read.format("jdbc")
         .option("url", urlWithUserAndPass)
         .option("query", "SELECT * FROM TEST.seq WHERE ID > 1000")
         .option("sessionInitStatement", initSQL)
         .load()
       assert(df.collect() === Array(Row(1009)))
     }
   ```
   and it does 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