[ 
https://issues.apache.org/jira/browse/SPARK-22113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16180238#comment-16180238
 ] 

Michael Fu commented on SPARK-22113:
------------------------------------

Hi [~viirya], Thanks for investigating. I did my test according 
[sql-programming-guide|http://spark.apache.org/docs/latest/sql-programming-guide.html]

Obviously I will talk to Hive by init session with _enableHiveSupport_ in 
production which is recommended by document. I raise this issue because there's 
a need of reading data from other databases using JDBC(oracle).

I raised a [question in 
stackoverflow|https://stackoverflow.com/questions/46355882/dataset-shows-in-hive-is-inconsistent-with-jdbc]
 before I come here. There's another failed scenario in the comment. Please 
take a look.

However, If you cloud not reproduce the same issue. I will close this.




> Dataset shows in Hive is inconsistent with JDBC
> -----------------------------------------------
>
>                 Key: SPARK-22113
>                 URL: https://issues.apache.org/jira/browse/SPARK-22113
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>         Environment: version 2.2.0
>            Reporter: Michael Fu
>
> I am trying to query data from Hive in spark. According spark-sql document, 
> there're two ways to do this:
> The first way is Init session with _enableHiveSupport_
> {code:java}
> SparkSession session = 
> SparkSession.builder().enableHiveSupport().getOrCreate();
> session.sql("select dw_date from tfdw.dwd_dim_date limit 10").show();
> {code}
> the dataset shows the correct result
> !https://i.stack.imgur.com/gBJCj.png!
> The second way is through JDBC
> {code:java}
> Dataset<Row> ds = session.read()
>                   .format("jdbc")
>                   .option("driver", "org.apache.hive.jdbc.HiveDriver")
>                   .option("url", 
> "jdbc:hive2://iZ11syxr6afZ:21050/;auth=noSasl")
>                   .option("dbtable", "tfdw.dwd_dim_date")
>                   .load();
> ds.select("dw_date").limit(10).show();
> {code}
> But the dataset only show the column name in the result rather than the data 
> in the column
> !https://i.stack.imgur.com/FBMDN.png!
> The two pictures should be consistent I think. Any outstanding I missed ? 
> Many thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to