urosstan-db commented on code in PR #58621:
URL: https://github.com/apache/spark/pull/58621#discussion_r3958254882
##########
connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala:
##########
@@ -43,6 +43,12 @@ import org.apache.spark.tags.DockerTest
class PostgresIntegrationSuite extends SharedJDBCIntegrationSuite {
override val db = new PostgresDatabaseOnDocker
+ private val restrictedUser = "restricted_user"
+ private val restrictedPassword = "restricted_password"
+
+ private def restrictedJdbcUrl: String =
Review Comment:
Inline these variables in test
##########
connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala:
##########
@@ -168,6 +174,9 @@ class PostgresIntegrationSuite extends
SharedJDBCIntegrationSuite {
"CREATE FUNCTION test_null() RETURNS VOID AS $$ BEGIN RETURN; END; $$
LANGUAGE plpgsql")
.executeUpdate()
+ conn.prepareStatement(s"CREATE USER $restrictedUser PASSWORD
'$restrictedPassword'")
Review Comment:
Move creation to the test, since it is used just by one test
##########
connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala:
##########
@@ -382,6 +391,18 @@ class PostgresIntegrationSuite extends
SharedJDBCIntegrationSuite {
assert(sql("select c1, c3 from queryOption").collect().toSet ==
expectedResult)
}
+ test("SPARK-57780: do not classify insufficient privilege as a syntax
error") {
+ val properties = new Properties()
+ properties.setProperty("user", restrictedUser)
+ properties.setProperty("password", restrictedPassword)
+
+ val postgresError = intercept[SQLException] {
+ spark.read.jdbc(restrictedJdbcUrl, "bar", properties)
Review Comment:
We should use spark.read.format("jdbc")
--
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]