Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
469 views
in Technique[技术] by (71.8m points)

hiveql - Schema UNION ALL HIVE should match condition

so I have been trying to make union on 2 tables like this.

All those subquerys, qwz and qwx run successfully in separated ways. Are they any ways to proceed this ? I mean like using other join ? Or what kind of fixing I should make?

 SELECT CURR_CODE,
    EF_DATE,
    EF_HOUR,
    EF_MINUTE,
    EXPI_DATE,
    MRR,
    CURR_MARKET
FROM
 (
  SELECT CURR_CODE,
    EF_DATE,
    EF_HOUR,
    EF_MINUTE,
    NVL((DA.EFFECTIVE_DATER),(DB.EFFECTIVE_DATER)) AS EXPI_DATE,
    M.MRR,
    M.CURR_MARKET
  FROM 
            TEMP.DM_QUERY_1_M_FICANT M,
            TEMP.DM_QUERY_1_4_AB_FICANT A,
            TEMP.DM_1_ZEXPIDA_FICANT DA,
            TEMP.DM_1_ZEXPIDB_FICANT DB,
            TEMP.DM_2_ZEXPIDC_FICANT DC
    WHERE M.CURRENCY_HIS_CODE = A.CURR_CODE
    ||';'
    ||A.CURR_NO
    AND M.MRR IS NOT NULL
    ORDER BY CURR_CODE ASC,
    EF_DATE ASC
 )
  qwz
UNION ALL
SELECT CURR_CODE,
EF_DATE,
EF_HOUR,
EF_MINUTE,
EXPI_DATE,
MRR,
CURR_MARKET
FROM
 (
  SELECT M.CURRENCY_CODE AS CURR_CODE,
    EF_DATE,
    EF_HOUR,
    EF_MINUTE,
    DC.EFFECTIVE_DATER AS EXPI_DATE,
    M.MRR,
    M.CURR_MARKET
  FROM 
            TEMP.DM_QUERY_2_M_FICANT M ,
            TEMP.DM_QUERY_2_4_AB_FICANT A,
            TEMP.DM_1_ZEXPIDA_FICANT DA,
            TEMP.DM_1_ZEXPIDB_FICANT DB,
            TEMP.DM_2_ZEXPIDC_FICANT DC
  WHERE M.CURRENCY_CODE =A.CURR_CODE
  AND M.MRR IS NOT NULL
  ORDER BY CURR_CODE ASC,
  EF_DATE ASC
  )
 qwx

Also, I already testing on some ways : hide the || part, (bar part), still it cannot run well.

Thank you for your time!

question from:https://stackoverflow.com/questions/65644900/schema-union-all-hive-should-match-condition

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...