none
not able to create column in hive table(Azure HDinsight) RRS feed

  • Question

  • Dear All.

    how we can create hive table(column as name) for below data:-


    "name": [
                {
                    "use": "official",
                    "family": "family",
                    "given": [
                        "first1",
                        "last1"
                    ]
                },
                {
                    "use": "usual",
                    "given": [
                        "first1 last1"
                    ]
                }
            ]

    i want to create a single column as name with all above columns and load data from some other table.

    Note :- use,family,given is columns and "first1 and last1 is coming from column FNAME AND LNAME FROM TABLE"

    Thanks

    HadoopHelp

    Tuesday, January 7, 2020 1:12 PM

All replies

  • Hello HadoopHelp, 

    My understanding is that you will have to use the Union Types 

    https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-ComplexTypes

    Union Types

    UNIONTYPE support is incomplete

    The UNIONTYPE datatype was introduced in Hive 0.7.0 (HIVE-537), but full support for this type in Hive remains incomplete. Queries that reference UNIONTYPE fields in JOIN (HIVE-2508), WHERE, and GROUP BY clauses will fail, and Hive does not define syntax to extract the tag or value fields of a UNIONTYPE. This means that UNIONTYPEs are effectively pass-through-only.

    Union types can at any one point hold exactly one of their specified data types. You can create an instance of this type using the create_union UDF:

    CREATE TABLE union_test(foo UNIONTYPE<int, double, array<string>, struct<a:int,b:string>>);
    SELECT foo FROM union_test;
    
    {0:1}
    {1:2.0}
    {2:["three","four"]}
    {3:{"a":5,"b":"five"}}
    {2:["six","seven"]}
    {3:{"a":8,"b":"eight"}}
    {0:9}
    {1:10.0}



    Thanks Himanshu

    Tuesday, January 7, 2020 11:14 PM
  • Hello , 

    We have not received a response from you.  Are you still facing the issue?  If you found a solution, would you please share it here with the community?  Otherwise, let us know and we will continue to engage with you on the issue.

    Thursday, January 9, 2020 7:24 PM
  • Since we have still not heard back from you, we will assume you found your own resolution.  If you found a solution, would you please share it here with the community?

    Thanks Himanshu

    Wednesday, January 15, 2020 8:42 PM