1、hivesql没有update、insert into类的更新表或插入表的操作。
2、hiveSQL特殊字符拼接问题,如分号要先进行八进制的ASCII码转义。
MySQL:select concat(key,concat(';',key)) from dual;
hivesql:select concat(key,concat('\073',key)) from dual;
3、hivesql不支持等值连接。
MySQL:select * from dual a,dual b where a.key = b.key;
hivesql:select * from dual a join dual b on a.key = b.key;
4、空值判断:MySQL中null表示空值,HiveQL中String类型的字段若是空(empty)字符串, 即长度为0, 那么对它进行IS NULL的判断结果是False。
5、函数使用不同,如分隔字符串:
MySQL:select substring_index("1,2,3",",",1); # 返回结果:1 select substring_index("1,2,3",",",3); # 返回结果:1,2,3
hivesql:select split("1,2,3", ',')[0]; # 返回结果:1 select split("1,2,3", ',')[2]; # 返回结果:3
时间转换函数:
MySQL:select p_id,from_unixtime(p_create_time/1000,'%y-%m-%d') as times from poi where p_parent_id= 4782760
hivesql:select p_id,from_unixtime(p_create_time div 1000,'YYYY-MM-dd HH:mm:ss') as times from poi where p_parent_id= 4782760
(
1.查询语言不同:hive是hql语言,mysql是sql语言
2.数据存储位置不同:hive是把数据存储到hdfs,而mysql数据存储在自己的系统中
3.数据格式:hive数据格式可以用户自定义,mysql有自己的系统定义格式
4.数据更新:hive不支持数据更新,只可以读,不可以写,sql支持数据的读写
5.延迟性:hive没有索引,因此查询数据的时候通过mapreduce很暴力 的把数据都查询一遍,也造成了hive查询数据速度很慢的原因,而mysql有索引;
6.数据规模:hive存储的数据量超级大,而mysql只是存储一些少量的业务数据
7.底层执行原理:hive底层是用的mapreduce,而mysql是excutor执行器;
)