04.大型数据库应用技术课堂测试05-日志数据分析-错误总结

错误总结:

1.Expression not in GROUP BY key 'id'

解决:

在group by子句中,select 查询的列,要么需要是 group by中的列,要么得是用聚合函数(比如 sum、count 等)加工过的列。不支持直接引用非 group by的列。这一点和 MySQL 有所区别。

1.Hive不允许直接访问非group by字段;
2.对于非group by字段,可以用Hive的collect_set函数收集这些字段,返回一个数组;
3.使用数字下标,可以直接访问数组中的元素;
————————————————
原文链接:https://blog.csdn.net/qq_44033208/article/details/121255316

 

2.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

解决:

这里注意,以后在写sql 语句的时候,在表名,字段,加上 ` ,  ` 的位置在键盘esc下面

 

3.ParseException line 4:24 cannot recognize input near '18' '02' ':' in constant

解决:

这个实际上是因为hive中的保留关键字引起的,例如我写的字段是date。
在date加上反引号date即可。反引号:`  ,和上面一样多加注意

 

4.java.lang.RuntimeException: Can't parse input data: 'video240232'

解决:

网上解决方案如下:(并没有解决问题)

bin/sqoop export \
--connect "jdbc:mysql://hadoop102:3306/sqoop?useUnicode=true&characterEncoding=utf-8" \
--username root \
--password 123456 \
--table table1 \
--num-mappers 1 \
--export-dir /user/hive/warehouse/hivetest.db/table1 \
--input-fields-terminated-by ","

--input-null-string ‘\N’

--input-null-non-string ‘\N’

--input-fields-terminated-by ‘\001’

 

我解决的:

经过一番查看,由于自己的疏忽,将数据目录的路径写错了,这里大家注意一下这一点。

 

5.org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version

解决:
jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true
把这句话加在连接 字符串

 

大家如有其他想法,评论区留言

 

posted @ 2022-10-18 23:02  kuaiquxie  阅读(69)  评论(0编辑  收藏  举报