Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-18141

jdbc datasource read fails when quoted columns (eg:mixed case, reserved words) in source table are used in the filter.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0, 2.0.1
    • 2.1.0
    • SQL
    • None

    Description

      create table t1("Name" text, "Id" integer)
      insert into t1 values('Mike', 1)

      val df = sqlContext.read.jdbc(jdbcUrl, "t1", new Properties)

      df.filter("Id = 1").show()

      df.filter("`Id` = 1").show()

      Error :
      Cause: org.postgresql.util.PSQLException: ERROR: column "id" does not exist
      Position: 35
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173)
      at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:622)
      at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:472)
      at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:386)
      at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD.compute(JDBCRDD.scala:295)
      at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:319)
      at org.apache.spark.rdd.RDD.iterator(RDD.scala:283)
      at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)

      I am working on fix for this issue, will submit PR soon.

      Attachments

        Issue Links

          Activity

            People

              tsuresh Suresh Thalamati
              tsuresh Suresh Thalamati
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: