Search code examples
apache-sparkapache-spark-sqlprestotrinopresto-jdbc

Spark Trino Connection


Currently I am using Spark 3.2.0 with Trino 363. I am trying to connect to Trino but I am getting an error. Error message is as below.

Exception in thread "main" java.sql.SQLException: Unrecognized connection property 'url'

Please find below code which I am using.

    val sparkSession = SparkSession.builder().appName("Trino-Spark")
                                    .master("local[*]")
                                    .getOrCreate()

    val properties = new Properties()
    properties.setProperty("SSL", "true")
    properties.setProperty("SSLVerification", "NONE")
    properties.setProperty("user", "USERNAME")
    properties.setProperty("password", "PWD")

    val df = sparkSession.read.jdbc("jdbc:trino://HOST:PORT/hive", "hive.TABLE_NAME", properties)

    println(s"Count: ${df.count()}")

Please could anyone help me to point out what is wrong here. Thanks in advance.


Solution

  • I was able to run spark 3.2.0 with Trino 363. I have commented out below mentioned line and re build JDBC driver.

    Trino 363 JDBC Driver