Apache spark 如何在Spark SQL中查询Avro表

Apache spark 如何在Spark SQL中查询Avro表,apache-spark,hiveql,apache-spark-sql,Apache Spark,Hiveql,Apache Spark Sql,我在Hive0.13中有键/值表(键和值是avro类型)。 当我尝试在Spark SQL 1.1中运行查询时,我遇到以下错误(在配置单元中它可以工作) sparksql>描述构造; ... 来自反序列化程序的密钥结构 反序列化程序中的值结构 ... spark sql>选择key.constructtype,按key.constructtype从构造组中计数(*); ... 2016年9月4日03:19:30错误thriftserver.SparkSQLDriver:在[select key.c

我在Hive0.13中有键/值表(键和值是avro类型)。 当我尝试在Spark SQL 1.1中运行查询时,我遇到以下错误(在配置单元中它可以工作)

sparksql>描述构造;
...
来自反序列化程序的密钥结构
反序列化程序中的值结构
...
spark sql>选择key.constructtype,按key.constructtype从构造组中计数(*);
...
2016年9月4日03:19:30错误thriftserver.SparkSQLDriver:在[select key.constructtype,count(*)中失败
org.apache.spark.sql.catalyst.errors.package$TreeNodeException:未解析属性:“key.constructtype”、“key.constructtype”和树:
聚合['key.constructtype],'key.constructtype,计数(1)为c#u 1#0L]

查看spark avro库,看看它是否有效:

spark-sql> describe construct;
...
key struct<constructtype:string,...> from deserializer
value struct<...> from deserializer
...

spark-sql> select key.constructtype, count(*) from construct group by key.constructtype;
...

4/09/16 03:19:30 ERROR thriftserver.SparkSQLDriver: Failed in [select key.constructtype, count(*) from  construct group by key.constructtype]
org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Unresolved attributes: 'key.constructtype,'key.constructtype, tree:
Aggregate ['key.constructtype], ['key.constructtype,COUNT(1) AS c_1#0L]