CDAP – DataSets Design Issues

How to write group by and order by query in CDAP?

Working Hive Query:
select it, count(result) from (
SELECT from_unixtime(insert_time,’yyyy-MM-dd’) it, result
FROM default.dataset_table1) t1 group by it sort by it

In Oracle we have Order By. In Hive we have Sort By.

from_unittime() function takes seconds. Not milliseconds.
While writing data into datasets, we need to use;

This wont work with from_unixtime

Column values must be of a primitive type. A primitive type is one of boolean, int, long, float, double, bytes, or string.
Column names must be valid Hive column names. This means they cannot be reserved keywords such as drop. Please refer to the Hive language manual for more information about Hive.

Data types are from Avro.
Data is stored in Hive. Supporting Hive Query.

This imposes constraints on how to design datasets and how to write queries.
Also this will impact performance of queries, because of date and time conversions.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s