将Cast语法从PostgreSQL转换为Hive

时间:2017-02-22 05:13:54

标签: postgresql hadoop hive

以下语法来自更大的Vertica查询(postgreSQL)。是否可以将此语法转换为Hive?运营商是一致的。如果是这样,怎么样?

当前错误是: FAILED:ParseException 22:19无法识别' |'附近的输入' CAST' '('在表达式规范中

 ST_GeomFromText('POLYGON((' || 
    CAST(TRUNC(request_lng / {{zoom_factor}},2) AS numeric) * {{zoom_factor}} + sign(request_lng)*(.01 * {{zoom_factor}})
    || ' ' ||
    CAST(TRUNC(request_lat / ({{zoom_factor}} * {{stretch_factor}}),2) AS numeric) * ({{zoom_factor}}*{{stretch_factor}}) + sign(request_lat)*(.01 * {{zoom_factor}} * {{stretch_factor}})
    || ', ' ||
    CAST(TRUNC(request_lng / {{zoom_factor}},2) AS numeric) * {{zoom_factor}} + sign(request_lng)*(.01 * {{zoom_factor}})
    || ' ' ||
    CAST(TRUNC(request_lat / ({{zoom_factor}} * {{stretch_factor}}),2) AS numeric) * ({{zoom_factor}}*{{stretch_factor}}) 
    || ', ' ||
    CAST(TRUNC(request_lng / {{zoom_factor}},2) AS numeric) * {{zoom_factor}}  
    || ' ' ||
    CAST(TRUNC(request_lat / ({{zoom_factor}} * {{stretch_factor}}),2) AS numeric) * ({{zoom_factor}}*{{stretch_factor}}) 
    || ', ' ||
    CAST(TRUNC(request_lng / {{zoom_factor}},2) AS numeric) * {{zoom_factor}}  
    || ' ' ||
    CAST(TRUNC(request_lat / ({{zoom_factor}} * {{stretch_factor}}),2) AS numeric) * ({{zoom_factor}}*{{stretch_factor}}) + sign(request_lat)*(.01 * {{zoom_factor}} * {{stretch_factor}})
    || ', ' ||
    CAST(TRUNC(request_lng / {{zoom_factor}},2) AS numeric) * {{zoom_factor}} + sign(request_lng)*(.01 * {{zoom_factor}})
    || ' ' ||
    CAST(TRUNC(request_lat / ({{zoom_factor}} * {{stretch_factor}}),2) AS numeric) * ({{zoom_factor}}*{{stretch_factor}}) + sign(request_lat)*(.01 * {{zoom_factor}} * {{stretch_factor}})
    ||'))') as geography

1 个答案:

答案 0 :(得分:0)