spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LinQili <lin_q...@outlook.com>
Subject how to select the first row in each group by group?
Date Mon, 12 Jan 2015 09:23:15 GMT
Hi all:I am using spark sql to read and write hive tables. But There is a issue that how to
select the first row in each group by group?In hive, we could write hql like this:SELECT imei
       FROM (            SELECT imei,            row_number() over (PARTITION BY imei ORDER
BY login_time ASC) AS row_num            FROM login_log_2015010914        ) a          WHERE
row_num = 1

In spark sql, how to write the sql equal to the hql? 		 	   		  
Mime
View raw message