编译语句时出错:失败:ParseException行4:0无法识别select子句中'(''select''applicationprofileid'附近的输入

时间:2019-09-16 23:10:40

标签: sql hive

create table sandbox_p_measurable_security.temp_calc_myaccess_privilegeddata1
stored as parquet as (
    select 
        applicationprofileid, 
        'OneBridge' as 'IsOnebridge' 
    from bigdata_normalized.myaccess_tblapplicationprofile apro
    where apro.applicationprofileid in (
        select apd.applicationprofileid 
        from bigdata_normalized.myaccess_tblapplicationprofiledependencies apd
        inner join bigdata_normalized.myaccess_tblsecuritygroup sg 
            on sg.securitygroupid = apd.securitygroupid
        where sg.businessrefcde = 'CDSOneBridge'
    )
);

1 个答案:

答案 0 :(得分:0)

我能够解决与您相同的错误,并且在移除(之后使用的圆括号stored as parquet as后,问题得以解决

测试结果:

失败:

Create table customers1
as (select * from customers)

错误为:

Error while compiling statement: FAILED: ParseException line 2:3 cannot recognize input near '(' 'select' '*' in select clause

成功:

Create table customers1
as select * from customers
 Success.

尝试按以下方式运行查询(去掉了括号)

create table sandbox_p_measurable_security.temp_calc_myaccess_privilegeddata1
as
    select 
        applicationprofileid, 
        'OneBridge' as 'IsOnebridge' 
    from bigdata_normalized.myaccess_tblapplicationprofile apro
    where apro.applicationprofileid in (
        select apd.applicationprofileid 
        from bigdata_normalized.myaccess_tblapplicationprofiledependencies apd
        inner join bigdata_normalized.myaccess_tblsecuritygroup sg 
            on sg.securitygroupid = apd.securitygroupid
        where sg.businessrefcde = 'CDSOneBridge')
stored as parquet;