[ 
https://issues.apache.org/jira/browse/SPARK-30830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

humengyu updated SPARK-30830:
-----------------------------
    Description: 
I found 
{code:java}
statement.setQueryTimeout(options.queryTimeout)
{code}
in org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD.$resolveTable 

but the default version for hive-jdbc in spark2.x is 1.2.1.spark2:
{code:java}
@Override
public void setQueryTimeout(int seconds) throws SQLException {
  throw new SQLException("Method not supported");
}
{code}
thus when I use hive-jdbc in spark, it will not work:
{code:java}
diagnostics: User class threw exception: java.sql.SQLException: Method not 
supporteddiagnostics: User class threw exception: java.sql.SQLException: Method 
not supported at 
org.apache.hive.jdbc.HiveStatement.setQueryTimeout(HiveStatement.java:739) at 
org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:60)
 at 
org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation$.getSchema(JDBCRelation.scala:210)
 at 
org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:35)
 at 
org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318)
 at 
org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223) at 
org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211) at 
org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:167) 
{code}
 I fixed this problem by repackaging hive-jdbc-1.2.1.spark2 :
{code:java}
  @Override
  public void setQueryTimeout(int seconds) throws SQLException {
//    throw new SQLException("Method not supported");
  }
{code}
Do we have a better way?

  was:
I found 
{code:java}
statement.setQueryTimeout(options.queryTimeout)
{code}
in org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD.$resolveTable 

but the default version for hive-jdbc in spark2.x is 1.2.1.spark2:
{code:java}
@Override
public void setQueryTimeout(int seconds) throws SQLException {
  throw new SQLException("Method not supported");
}
{code}
thus when I use hive-jdbc in spark, it will not work:
{code:java}
diagnostics: User class threw exception: java.sql.SQLException: Method not 
supporteddiagnostics: User class threw exception: java.sql.SQLException: Method 
not supported at 
org.apache.hive.jdbc.HiveStatement.setQueryTimeout(HiveStatement.java:739) at 
org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:60)
 at 
org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation$.getSchema(JDBCRelation.scala:210)
 at 
org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:35)
 at 
org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318)
 at 
org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223) at 
org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211) at 
org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:167) at 
com.zhihu.za3.duration.Za3BeginEndDev$.main(Za3BeginEndDev.scala:31) at 
com.zhihu.za3.duration.Za3BeginEndDev.main(Za3BeginEndDev.scala) at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498) at 
org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:684)
{code}
 I fixed this problem by repackaging hive-jdbc-1.2.1.spark2 :
{code:java}
  @Override
  public void setQueryTimeout(int seconds) throws SQLException {
//    throw new SQLException("Method not supported");
  }
{code}
Do we have a better way?


> method getQueryTimeout not support
> ----------------------------------
>
>                 Key: SPARK-30830
>                 URL: https://issues.apache.org/jira/browse/SPARK-30830
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.0
>            Reporter: humengyu
>            Priority: Minor
>
> I found 
> {code:java}
> statement.setQueryTimeout(options.queryTimeout)
> {code}
> in org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD.$resolveTable 
> but the default version for hive-jdbc in spark2.x is 1.2.1.spark2:
> {code:java}
> @Override
> public void setQueryTimeout(int seconds) throws SQLException {
>   throw new SQLException("Method not supported");
> }
> {code}
> thus when I use hive-jdbc in spark, it will not work:
> {code:java}
> diagnostics: User class threw exception: java.sql.SQLException: Method not 
> supporteddiagnostics: User class threw exception: java.sql.SQLException: 
> Method not supported at 
> org.apache.hive.jdbc.HiveStatement.setQueryTimeout(HiveStatement.java:739) at 
> org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:60)
>  at 
> org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation$.getSchema(JDBCRelation.scala:210)
>  at 
> org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:35)
>  at 
> org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318)
>  at 
> org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223) 
> at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211) at 
> org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:167) 
> {code}
>  I fixed this problem by repackaging hive-jdbc-1.2.1.spark2 :
> {code:java}
>   @Override
>   public void setQueryTimeout(int seconds) throws SQLException {
> //    throw new SQLException("Method not supported");
>   }
> {code}
> Do we have a better way?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to