从hue或r查询时的不同结果

uz75evzq  于 2021-06-24  发布在  Hive
关注(0)|答案(0)|浏览(218)

我正试图从一个Hive数据库中提取一些数据。通常我会开发/测试关于色调的查询,当我可以快速编写它们时(自动完成等),然后测试以查看结果。然后我转到我的rstudio,复制查询并使用rjdbc运行它。
最近我发现了一个令人费解的结果。如果我对hue和r运行完全相同的查询,我会得到不同的结果(更具体地说,我从r得到的结果更少)。知道为什么吗?由于我现在时间很短,我无法创建一个可复制的示例(实际的查询复制到下面)。

SELECT OT3.id_ot id_ot,
       AP2.ID_SGM ua_sgm,
       OT3.DATA_VENDA DATA_VENDA,
       res_ot.RESULT resultado,
       OT3.TECNOLOGY TECNOLOGY,
       res_ot.RAZAO1 RAZAO1,
       res_ot.RAZAO2 RAZAO2,
       OT3.PLC PLC,
       OT3.tap tap,
       OT3.pd pd,
       OT3.COMENTARIO COMENTARIO
FROM
  (SELECT OT2.id_ot id_ot,
          OT2.ua_cod ua_cod,
          OT2.DATA_VENDA DATA_VENDA,
          OT2.CLOSE_REASON_ID CLOSE_REASON_ID,
          OT2.TECNOLOGY TECNOLOGY,
          OT2.DATA_OT DATA_OT,
          OT2.COMENTARIO COMENTARIO,
          OT2.PLC PLC,
          OT2.tap tap,
          OT2.pd pd,
          ROW_NUMBER() OVER (PARTITION BY OT2.id_ot
                             ORDER BY OT2.DATA_VENDA DESC, OT2.DATA_OT DESC) AS ROW_NUMBER,
          ROW_NUMBER() OVER (PARTITION BY OT2.ua_cod, OT2.DATA_VENDA, OT2.TECNOLOGY
                             ORDER BY OT2.DATA_OT DESC) AS ROW_NUMBER_2
   FROM
     (SELECT OT1.work_order_id id_ot,
             OT1.ua_cod ua_cod,
             cast(OT1.work_order_dat AS DATE) DATA_VENDA,
             OT1.CLOSE_REASON_ID CLOSE_REASON_ID,
             CASE
                 WHEN OT1.techonology_dsc = 'FTTH' THEN 'FTTH'
                 WHEN OT1.techonology_dsc = 'CABO' THEN 'HFC'
             END AS TECNOLOGY,
             cast(OT1.WORK_ORDER_REAL_END_DAT AS DATE) DATA_OT,
             OT1.PLC_COD PLC,
             OT1.Tap_dsc tap,
             OT1.pd_dsc pd,
             concat(OT1.comments_txt, OT1.cancelation_comment_txt) COMENTARIO
      FROM dev_ads_dw.f_work_order OT1
      INNER JOIN dev_ads_dw.e_work_order_type TYPE ON OT1.work_order_type_id = TYPE.work_order_type_id
      INNER JOIN dev_ads_dw.e_task_type TASK ON OT1.task_type_id = TASK.task_type_id
      LEFT JOIN wb_cobr.mp_historico HIST ON OT1.work_order_id = HIST.id_ot
      WHERE OT1.CLOSE_REASON_ID <> -1
        AND OT1.techonology_dsc IN ('FTTH',
                                    'CABO')
        AND OT1.ua_cod IS NOT NULL
        AND OT1.CLICK_CLIENT_CLASSIF_DSC IN ('RESIDENCIAL',
                                             'NORMAL/RESIDENCIAL')
        AND (TYPE.work_order_type_dsc LIKE '%Instalação%'
             OR TASK.task_type_dsc LIKE '%ALTERACAO_TECNOLOGIA%')
        AND HIST.id_ot IS NULL ) OT2) OT3
INNER JOIN
  (SELECT DISTINCT AP1.access_point_id AP_ID,
                   AP1.id_alojamento ID_SGM,
                   cast(regexp_replace(concat('20', AP1.valid_from), '\\.', '-') AS DATE) ap_valid_from,
                   cast(regexp_replace(concat('20', AP1.valid_to), '\\.', '-') AS DATE) ap_valid_to
   FROM wb_cobr.h_access_point AP1) AP2 ON OT3.ua_cod = AP2.AP_ID
INNER JOIN
  (SELECT DISTINCT RES_OT_TEMP.CLOSE_REASON_ID CLOSE_REASON_ID,
                   UPPER(RES_OT_TEMP.close_reason_hier_lvl_1_txt) RESULT,
                                                                  UPPER(RES_OT_TEMP.close_reason_hier_lvl_2_txt) RAZAO1,
                                                                  UPPER(RES_OT_TEMP.close_reason_hier_lvl_3_txt) RAZAO2
   FROM dev_ads_dw.e_close_reason RES_OT_TEMP
   WHERE cast(RES_OT_TEMP.valid_to AS DATE) > CURRENT_DATE() ) res_ot ON ot3.CLOSE_REASON_ID = res_ot.CLOSE_REASON_ID

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题