hive-query

Primary keys and indexes in Hive query language is poosible or not?

限于喜欢 提交于 2021-02-05 08:50:08
问题 We are trying to migrate oracle tables to hive and process them. Currently the tables in oracle has primary key,foreign key and unique key constraints. Can we replicate the samein hiveql? We are doing some analysis on how to implement it. 回答1: Hive indexing was introduced in Hive 0.7.0 (HIVE-417) and removed in Hive 3.0 (HIVE-18448) Please read comments in this Jira. The feature was completely useless in Hive. These indexes was too expensive for big data, RIP. As of Hive 2.1.0 (HIVE-13290)

Calculate time difference between two columns of string type in hive without changing the data type string

天大地大妈咪最大 提交于 2019-12-22 18:06:51
问题 I am trying to calculate the time difference between two columns of a row which are of string data type. If the time difference between them is less than 2 hours then select the first column of that row else if the time difference is greater than 2 hours then select the second column of that row. It can be done by converting the columns to datetime format, but I want the result to be in string only. How can I do that? The data looks like this: col1(string type) 2018-07-16 02:23:00 2018-07-26

Convert String to Timestamp in Hive HQL

十年热恋 提交于 2019-12-12 17:25:32
问题 I'm having a string like "08/03/2018 02:00:00" which i'm trying to convert into a timestamp value. I'm using the below code: unix_timestamp("08/03/2018 02:00:00", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") when i use the above code it's throwing a NULL value. How can i convert this string to Timestamp in Hive/Hue Editor? 回答1: The format you specified does not match to the actual timestamp. If 08/03 in your example is dd/MM then: select unix_timestamp("08/03/2018 02:00:00", "dd/MM/yyyy HH:mm:ss") OK