0

I am trying to connect to a remote hive thrift server using cloudera hive driver: com.cloudera.hive.jdbc4.HS2Driver. I am able to connect to it but while running any sql query I am not getting data in result, but only column names. The code which I am using is:

df = spark.read \
        .format("jdbc") \
        .option("driver", "com.cloudera.hive.jdbc4.HS2Driver") \
        .option("url", "jdbc:hive2://host:port") \
        .option("dbtable", db_name.table_name) \
        .option("user", usr) \
        .option("password", pwd) \
        .option("properties",{"UseNativeQuery": 1}) \
        .load()
    df.show()

I know from logs that it is transforming queries and adding a condition where 1=0. I think it is because of that. But i am not able to remove that. How do i resolve this?

  • can you post full logs ? – Srinivas May 25 '20 at 08:24
  • `== SQL == SELECT * FROM (select 'table_name'.'col1' from db_name.table_name) foo WHERE 1=0 ---------^^^ , Query: SELECT * FROM (select 'table_name'.'col1' from db_name.table_name) foo WHERE 1=0.` – Sanket Tantia May 25 '20 at 09:59
  • https://stackoverflow.com/questions/48087779/sqlcontext-hivedriver-error-on-sqlexception-method-not-supported/48157865 I was going through this post, there it is mentioned that it converts column names to string literals. – Sanket Tantia May 25 '20 at 10:00

0 Answers0