【发布时间】:2019-03-21 23:56:19
【问题描述】:
我创建了一个 DataFrame 来加载 CSV 文件,并创建了一个临时表来获取列统计信息。
但是,当我尝试运行 ANALYZE 命令时,我遇到了以下错误 相同的分析命令在 Hive 中成功运行。
Spark 版本:1.6.3
df = sqlContext.read
.format("com.databricks.spark.csv")
.option("header", "true")
.option("mode", "DROPMALFORMED")
.load("/bn_data/bopis/*.csv")
// To get the statistics of columns
df.registerTempTable("bopis")
val stat=sqlContext.sql("analyze table bopis compute statistics for columns").show()
错误:
java.lang.RuntimeException: [1.1] failure: ``with'' expected but identifier analyze found
analyze table bopis compute statistics for columns
^
请告诉我们如何使用 Spark 实现列统计
谢谢!
【问题讨论】:
标签: scala apache-spark apache-spark-sql