Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Struct datatype column with spaces

Highlighted

Struct datatype column with spaces

New Contributor

Hi,

I am able to create a table having column name with white spaces.

CREATE EXTERNAL TABLE IF NOT EXISTS EXT_MILOGS(`Country of Visits` string);

But when I try same thing with struct datatype

CREATE EXTERNAL TABLE IF NOT EXISTS EXT_MILOGS(dimensions struct<`Country of Visits`: string>);

I am not able to create the same. Am I missing something here?

Thanks,

Amol

3 REPLIES 3
Highlighted

Re: Struct datatype column with spaces

@Amol Kulkarni

This is working as designed. Hive does not support literals for complex types (array, map, struct, union).

Re: Struct datatype column with spaces

New Contributor

How can I achieve this as I am getting data in JSON format and change in the column name does not read the field data with 'org.openx.data.jsonserde.JsonSerDe' parser.

Highlighted

Re: Struct datatype column with spaces

Hi @Amol Kulkarni

You can try loading the JSON file into hive stage table with JSON as storage type. After that you can alter the column as you wish and store it as any other complex data type. But still you cannot use string literal for complex data types rather you have an option of altering the column name as you have a stage table before with JSON storage.

Hope it helps!!

Don't have an account?
Coming from Hortonworks? Activate your account here