首页 > 代码库 > hive 中与mysql 中函数同名不同意的方法记录

hive 中与mysql 中函数同名不同意的方法记录

max 函数 在hive中max函数是一个聚合函数,所以,而且返回值是double ,而且后面必须跟group by ,这个和mysql差异很大

Built-in Aggregate Functions (UDAF)

DOUBLE
max(col)
Returns the maximum value of the column in the group.

mysql 中

Returns the maximum value of expr. MAX() may take a string argument; in
such cases, it returns the maximum string value. See
http://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html. The DISTINCT
keyword can be used to find the maximum of the distinct values of expr,
however, this produces the same result as omitting DISTINCT.

MAX() returns NULL if there were no matching rows.

 

hive 中与mysql 中函数同名不同意的方法记录