You could just move the ints outside the Map.
Alternatively you can convert the String to Int : cast (strcolumn to int)
See:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-TypeConversionFunctions

> Am 12.08.2019 um 21:41 schrieb Anup Tiwari <anupsdtiw...@gmail.com>:
> 
> Hi All,
> 
> I have a use case where i wanted to store multiple columns into a single map 
> data type column but while doing so i came across a use case where i have 
> mainly 2 type of column bigint and string so i stored them in a map column 
> defined as <string,string> and then i queried the key which hold integer 
> values in a map column.
> 
> Case 1 :- when i am applying > , < conditional operator then returning output 
> is correct.
> Case 2 :- Taking min/max on integer column and then it is giving me incorrect 
> output.
> 
> Now i understood that it is due datatype of map column which is "string" but 
> just a question, why min/max is working on string and <,> conditions failing ?
> 
> Please note that the column which i am querying, will always contain int 
> value so let me know if you have any suggestions. 
> 
> Combining and storing value in map datatype is necessary because each row can 
> have different-different number of metadata depending upon event name.
> 
> Please find table structure below :-
> 
> CREATE TABLE `anup.test_map`(
>   `SID` string, 
>   `eventName` string, 
>   `timestamp` timestamp, 
>   `merge` map<string,string>)
> STORED AS PARQUET;
> 
> Regards,
> Anup Tiwari

Reply via email to