spark访问hive表: 在spark/conf目录下:引入hive配置文件
ln -sf /soft/hive/conf/hive-site.xml /soft/spark/conf/
错误1:
Hive Schema version 1.2.0 does not match metastore’s schema version 2.3.0
原因: hive版本不一致, 查看hive在mysql中的注册信息如下
解决办法: 降低hive的版本, 修改 SCHEMA_VERSION的值为2.1.1
错误2:
Exception thrown obtaining schema column information from datastore
org.datanucleus.exceptions.NucleusDataStoreException: Exception thrown obtaining schema column information from datastore…
Caused by: java.sql.SQLException: Column name pattern can not be NULL or empty.
原因: 是mysql驱动版本太高,删除后重新导入低版本的驱动
重启spark-shell, 加载hive文件成功!