为什么Spark SQL失败了“NumberFormatException:For input string:”1s“”with hive-site.xml来自Hive?

时间:2015-03-24 09:45:21

标签: hive apache-spark apache-spark-sql

15/03/24 23:06:45 INFO ParseDriver: Parse Completed
Exception in thread "main" java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "1s"
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:346)
        at org.apache.spark.sql.hive.HiveContext$$anonfun$4.apply(HiveContext.scala:235)
        at org.apache.spark.sql.hive.HiveContext$$anonfun$4.apply(HiveContext.scala:231)
        at scala.Option.orElse(Option.scala:257)
        at org.apache.spark.sql.hive.HiveContext.x$3$lzycompute(HiveContext.scala:231)
        at org.apache.spark.sql.hive.HiveContext.x$3(HiveContext.scala:229)
        at org.apache.spark.sql.hive.HiveContext.hiveconf$lzycompute(HiveContext.scala:229)
        at org.apache.spark.sql.hive.HiveContext.hiveconf(HiveContext.scala:229)
        at org.apache.spark.sql.hive.HiveMetastoreCatalog.<init>(HiveMetastoreCatalog.scala:55)
        at org.apache.spark.sql.hive.HiveContext$$anon$1.<init>(HiveContext.scala:253)
        at org.apache.spark.sql.hive.HiveContext.catalog$lzycompute(HiveContext.scala:253)
        at org.apache.spark.sql.hive.HiveContext.catalog(HiveContext.scala:253)
        at org.apache.spark.sql.hive.HiveContext$$anon$3.<init>(HiveContext.scala:263)
        at org.apache.spark.sql.hive.HiveContext.analyzer$lzycompute(HiveContext.scala:263)

我已将hive-site.xml从hive conf复制到spark conf,我可以在Hive提示符下运行并执行sql。

1 个答案:

答案 0 :(得分:2)

请删除hive-site.xml文件中的字符'。

例如实际属性

<property>
    <name>hive.metastore.client.connect.retry.delay</name>
    <value>1s</value>
    <description>
      1s Expects a time value with unit (d/day, h/hour, m/min, s/sec, ms/msec, us/usec, ns/nsec), which is sec if not specified.
      Number of seconds for the client to wait between consecutive connection attempts
    </description>
  </property>

更改了属性

<property>
        <name>hive.metastore.client.connect.retry.delay</name>
        <value>1</value>
        <description>
          1s Expects a time value with unit (d/day, h/hour, m/min, s/sec, ms/msec, us/usec, ns/nsec), which is sec if not specified.
          Number of seconds for the client to wait between consecutive connection attempts
        </description>
      </property>

这适用于所有值s /秒和ms /毫秒等。此更改仅适用于spark。