Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21590#discussion_r197620455
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCOptions.scala
 ---
    @@ -109,6 +134,20 @@ class JDBCOptions(
         s"When reading JDBC data sources, users need to specify all or none 
for the following " +
           s"options: '$JDBC_PARTITION_COLUMN', '$JDBC_LOWER_BOUND', 
'$JDBC_UPPER_BOUND', " +
           s"and '$JDBC_NUM_PARTITIONS'")
    +
    +  require(!(query.isDefined && partitionColumn.isDefined),
    +    s"""
    +       |Options '$JDBC_QUERY_STRING' and '$JDBC_PARTITION_COLUMN' can not 
be specified together.
    +       |Please define the query using `$JDBC_TABLE_NAME` option instead 
and make sure to qualify
    +       |the partition columns using the supplied subquery alias to resolve 
any ambiguity.
    +       |Example :
    +       |spark.read.format("jdbc")
    +       |        .option("dbtable", "(select c1, c2 from t1) as subq")
    +       |        .option("partitionColumn", "subq.c1"
    +       |        .load()
    --- End diff --
    
    Great! Please add them to the doc as I mentioned above?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to