我有以下表结构:
Table name: test
表结构:col1和col2是字符串。
"col1","col2"
"abc","15/04/2016"
"def","31/05/2016"
当我尝试执行以下操作时,结果显示为NULL。 从test中选择to_date(col2);
知道为什么它没有显示col2结果。
答案 0 :(得分:0)
请尝试以下操作:
Method | Usage
------------------------------------------------------------------
queryLimitedToFirst Sets the maximum number of items to return from the beginning of the ordered list of results.
queryLimitedToLast Sets the maximum number of items to return from the end of the ordered list of results.
queryStartingAtValue Return items greater than or equal to the specified key, value, or priority, depending on the order-by method chosen.
queryEndingAtValue Return items less than or equal to the specified key, value, or priority, depending on the order-by method chosen.
queryEqualToValue Return items equal to the specified key, value, or priority, depending on the order-by method chosen.
SELECT to_date(FROM_UNIXTIME(UNIX_TIMESTAMP(col2,'dd/MM/yyyy')))
预计时间戳格式如下: yyyy-mm-dd hh:mm:ss
有关详细信息,请参阅Hive Date Functions。