SparkSQL【1.x版本】字段敏感不敏感问题

时间:2023-03-08 22:06:15
SparkSQL【1.x版本】字段敏感不敏感问题

一.特征

  1.SqlContext默认大小写不敏感,如果DataFrame中有字段相同,大小写不同,在使用字段的时候不会引起歧义。

  2.HiveContext提供更多的Hive预置函数,可以更高效的进行数据分析,默认大小写不敏感。

  注意:在spark2.x中没有出现SqlContext大小写敏感问题!

sqlContext.sql("select * from user").filter("age is not null").filter("age != ''").show()sqlContext.sql("select * from USER").filter("AGE is not null").filter("AGE != ''").show()

  SparkSQL【1.x版本】字段敏感不敏感问题