我试图在 hive 中执行查询并得到错误。我一遍又一遍地检查,但看不到任何问题。

CREATE view sta_v_clean_phrase_longtext (system, `function`, loglockmod, extinfo
, primarykey, foreignkey, flgprimkey, flgfrgnkey, ref_recn, text_line, copied,
inserted )
AS
  SELECT system,
         `function`,
         loglockmod,
         extinfo,
         primarykey,
         foreignkey,
         flgprimkey,
         flgfrgnkey,
         ref_recn,
         Concat_ws('', Collect_list(text_line))AS TEXT_LINE,
         copied
  FROM  (SELECT system,
                `function`,
                loglockmod,
                extinfo,
                primarykey,
                foreignkey,
                flgprimkey,
                flgfrgnkey,
                ref_recn,
                text_line,
                copied
         FROM   phrase_longtext_orc_orc
         WHERE  primarykey IS NOT NULL
         GROUP  BY system,
                   `function`,
                   loglockmod,
                   extinfo,
                   primarykey,
                   foreignkey,
                   flgprimkey,
                   flgfrgnkey,
                   ref_recn,
                   text_line,
                   copied)
  GROUP  BY system,
            `function`,
            loglockmod,
            extinfo,
            primarykey,
            foreignkey,
            flgprimkey,
            flgfrgnkey,
            ref_recn,
            text_line,
            copied

最佳答案

保留您的 subquery 的别名,并在创建 View 语句中显示额外列 inserted,该列在您的选择查询中不存在(我从下面的查询中删除了多余的列)。

hive> CREATE view sta_v_clean_phrase_longtext (system, `function`, loglockmod, extinfo
, primarykey, foreignkey, flgprimkey, flgfrgnkey, ref_recn, text_line, copied)
AS
  SELECT system,
         `function`,
         loglockmod,
         extinfo,
         primarykey,
         foreignkey,
         flgprimkey,
         flgfrgnkey,
         ref_recn,
         Concat_ws('', Collect_list(text_line))AS TEXT_LINE,
         copied
  FROM  (SELECT system,
                `function`,
                loglockmod,
                extinfo,
                primarykey,
                foreignkey,
                flgprimkey,
                flgfrgnkey,
                ref_recn,
                text_line,
                copied
         FROM   phrase_longtext_orc_orc
         WHERE  primarykey IS NOT NULL
         GROUP  BY system,
                   `function`,
                   loglockmod,
                   extinfo,
                   primarykey,
                   foreignkey,
                   flgprimkey,
                   flgfrgnkey,
                   ref_recn,
                   text_line,
                   copied) t1
  GROUP  BY system,
            `function`,
            loglockmod,
            extinfo,
            primarykey,
            foreignkey,
            flgprimkey,
            flgfrgnkey,
            ref_recn,
            text_line,
            copied

关于hadoop - ParseException第6:5行无法识别joinSource中 '(' 'SELECT' 'system'附近的输入,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56925917/

10-13 04:32