title: Spark SQL JDBC empty dataframe
body: <p>I'm trying to load the query result from one table to another. It connects fine and execute a query to get the metadata but no data is returned.</p>
  
  <pre><code>from pyspark.sql import SQLContext, Row, SparkSession
  
  spark = SparkSession.builder.config("spark.driver.extraClassPath", "C:\\spark\SQL\\sqljdbc_7.0\\enu\\mssql-jdbc-7.0.0.jre10.jar").getOrCreate()
  
  SQL = "Select [InvoiceID],[CustomerID],[BillToCustomerID],[OrderID],[DeliveryMethodID],[ContactPersonID],[AccountsPersonID],[SalespersonPersonID],[PackedByPersonID],[InvoiceDate],[CustomerPurchaseOrderNumber],[IsCreditNote],[CreditNoteReason],[Comments],[DeliveryInstructions],[InternalComments],[TotalDryItems],[TotalChillerItems],[DeliveryRun],[RunPosition],[ReturnedDeliveryData],[ConfirmedDeliveryTime],[ConfirmedReceivedBy],[LastEditedBy],[LastEditedWhen] FROM [Sales].[Invoices]"
  
  pgDF = spark.read \
      .format("jdbc") \
      .option("url", "jdbc:sqlserver://Localhost") \
      .option("query", SQL) \
      .option("user", "dp_admin") \
      .option("Database", "WideWorldImporters") \
      .option("password", "password") \
      .option("fetchsize", 1000) \
      .load(SQL)
  
  pgDF.write \
  .format("jdbc") \
  .option("url", "jdbc:sqlserver://Localhost") \
  .option("dbtable", "wwi.Sales_InvoiceLines") \
  .option("user", "dp_admin") \
  .option("Database", "DW_Staging") \
  .option("password", "password") \
  .option("mode", "overwrite")
  </code></pre>
  
  <p>Looking at the sql server profiler :</p>
  
  <pre><code>exec sp_executesql N'SELECT * FROM (Select [InvoiceID],[CustomerID],[BillToCustomerID],[OrderID],[DeliveryMethodID],[ContactPersonID],[AccountsPersonID],[SalespersonPersonID],[PackedByPersonID],[InvoiceDate],[CustomerPurchaseOrderNumber],[IsCreditNote],[CreditNoteReason],[Comments],[DeliveryInstructions],[InternalComments],[TotalDryItems],[TotalChillerItems],[DeliveryRun],[RunPosition],[ReturnedDeliveryData],[ConfirmedDeliveryTime],[ConfirmedReceivedBy],[LastEditedBy],[LastEditedWhen] FROM [Sales].[Invoices]) __SPARK_GEN_JDBC_SUBQUERY_NAME_0 WHERE 1=0'
  </code></pre>
  
  <p>the where 1= 0 gets added and no data is returned, why and how to remove it?</p>