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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]