在蜂巢中爆炸功能

Pav*_*thy 5 hive hiveql

我有以下示例数据,我试图在蜂巢中爆炸它..我使用拆分但我知道我错过了一些东西..

["[[-80.742426,35.23248],[-80.740424,35.23184],[-80.739583,35.231562],[-80.735935,35.23041],[-80.728624,35.228069],[-80.727753,35.227836],[-80.727294,35.227741],[-80.726762,35.227647],[-80.726321,35.227594],[-80.725687,35.227544],[-80.725134,35.227535],[-80.721502,35.227615],[-80.691298,35.216202],[-80.688009,35.215396],[-80.686516,35.215016],[-80.598433,35.234307]]"]
Run Code Online (Sandbox Code Playgroud)

我使用了以下查询

从sample2中选择explode(split(col,','));
结果是这样的

        ["[[-80.742426
        35.23248]
        [-80.740424
        35.23184]
        [-80.739583
        35.231562]
        [-80.735935
        35.23041]
        [-80.728624
        35.228069]
        [-80.727753
        35.227836]
        [-80.71143
        35.227831]
        [-80.711007
        35.227795]
        [-80.710638
        35.227741]
        [-80.673884
        35.21014]
        [-80.672358
        35.209481]
        [-80.672036
        35.209356]
        [-80.671686
        35.209234]
        [-80.67124
        35.209099]
        [-80.670815
        35.209006]
        [-80.670267
        35.208906]
        [-80.669612
        35.208833]
        [-80.668924
        35.208806]
        [-80.598433
        35.234307]]"]
Run Code Online (Sandbox Code Playgroud)

我需要以下格式

    [-80.742426,35.23248]
    [-80.740424,35.23184]
    [-80.739583,35.231562]
    [-80.735935,35.23041]
    [-80.728624,35.228069]
    [-80.727753,35.227836]
    [-80.727294,35.227741]
    [-80.726762,35.227647]
    [-80.726321,35.227594]
    [-80.725687,35.227544]
    [-80.725134,35.227535]
    [-80.721502,35.227615]
    [-80.691298,35.216202]
    [-80.688009,35.215396]
    [-80.686516,35.215016]
    [-80.684281,35.214466]
    [-80.68396,35.214395]
    [-80.683375,35.214231]
    [-80.682908,35.214079]
    [-80.682444,35.213905]
    [-80.682045,35.213733]
    [-80.68062,35.213112]
    [-80.678078,35.211983]
    [-80.676836,35.211447]
    [-80.598433,35.234307]
Run Code Online (Sandbox Code Playgroud)

这边有什么帮助..?

Far*_*que 7

您将数据集设置为数组数组,并且只想在第一级分解数据,因此请使用LATERAL VIEW explode(colname)在第一级分解。

以下是SELECT查询explode():

select col1 from sample2 LATERAL VIEW explode(col) explodeVal AS col1;
Run Code Online (Sandbox Code Playgroud)

从您的输入数据集生成的输出如下:

[-80.742426,35.23248]  
[-80.740424,35.23184]  
[-80.739583,35.231562]  
[-80.735935,35.23041]  
[-80.728624,35.228069]  
[-80.727753,35.227836]  
[-80.727294,35.227741]  
[-80.726762,35.227647]  
[-80.726321,35.227594]  
[-80.725687,35.227544]  
[-80.725134,35.227535]  
[-80.721502,35.227615]  
[-80.691298,35.216202]  
[-80.688009,35.215396]  
[-80.686516,35.215016]  
[-80.684281,35.214466]  
[-80.68396,35.214395]  
[-80.683375,35.214231]  
[-80.682908,35.214079]  
[-80.682444,35.213905]  
[-80.682045,35.213733]  
[-80.68062,35.213112]  
[-80.678078,35.211983]  
[-80.676836,35.211447]  
[-80.598433,35.234307]  
Run Code Online (Sandbox Code Playgroud)