Skip to content

Instantly share code, notes, and snippets.

@bcambel
Last active December 1, 2015 20:45
Show Gist options
  • Select an option

  • Save bcambel/507c889a6440f6785b8d to your computer and use it in GitHub Desktop.

Select an option

Save bcambel/507c889a6440f6785b8d to your computer and use it in GitHub Desktop.
Apache Drill query to group by in Apache HBase
0: jdbc:drill:zk=local> SELECT CONVERT_FROM(row_key, 'UTF8') AS clickid,
. . . . . . . . . . . > CONVERT_FROM(clicks.clickinfo.studentid, 'UTF8') AS studentid,
. . . . . . . . . . . > CONVERT_FROM(clicks.clickinfo.`time`, 'UTF8') AS `time`,
. . . . . . . . . . . > CONVERT_FROM(clicks.clickinfo.url, 'UTF8') AS url
. . . . . . . . . . . > FROM hbase.clicks WHERE clicks.clickinfo.url LIKE '%google%';
+----------+------------+---------------------------+------------------------+
| clickid | studentid | time | url |
+----------+------------+---------------------------+------------------------+
| click1 | student1 | 2014-01-01 12:01:01.0001 | http://www.google.com |
| click3 | null | 2014-01-01 01:02:01.0001 | http://www.google.com |
| click6 | null | 2013-02-01 12:01:01.0001 | http://www.google.com |
+----------+------------+---------------------------+------------------------+
3 rows selected (2.24 seconds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment