You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Amiri Barksdale <am...@gmail.com> on 2019/01/25 14:05:07 UTC
“Argument type mismatch” when constructing maps in hive
While running Hive 2.3.4, Pig 0.17.0, Hue 4.3.0, Tez 0.9.1, HBase 1.4.8,
HCatalog 2.3.4 on Amazon EMR, I am unable to make a hive map wherein one of
the keys has values of multiple types, namely map and string. The error is
SemanticException [Error 10016]: Line 3:28 Argument type mismatch ''$'':
Value type "string" is different from preceding value types. Previous value
type was "map<string,string>"
I am attempting to make json from a map from a hive table:
create temporary function to_json AS 'brickhouse.udf.json.ToJsonUDF';
SELECT to_json(map(
"first_key",map("s","default_value")
, "second_key", get_json_object(my_table.`_special_column`,'$')
)) FROM my_table LIMIT 100;
_special_column can contain either a string or a map.
Is there any way to configure hive to ignore this? Any other way around it?
Clearly, json doesn't require that all values under a given key are of the
same type, so this seems a bit draconian and unreasonable.
Amiri