airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ace Haidrey (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-1153) params in HiveOperator constructor can't be passed into Hive execution context
Date Sat, 20 Jan 2018 00:54:10 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16333071#comment-16333071
] 

Ace Haidrey commented on AIRFLOW-1153:
--------------------------------------

The HiveOperator was updated recently: [https://github.com/apache/incubator-airflow/commit/eb994d683f244f63dd191a6640baaee66ffc8e29]

 

In your example it your hql can remain the same and then in your user_defined_macro to the
dag you just pass your kv pair so user_defined_macro = \{'mynumber': 2}

 

Think this ticket can be closed now

> params in HiveOperator constructor can't be passed into Hive execution context
> ------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-1153
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1153
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: hive_hooks, operators
>    Affects Versions: Airflow 2.0, Airflow 1.8
>            Reporter: Xianping lin
>            Priority: Critical
>              Labels: easyfix, newbie
>
> params parameter in HiveOperator can't be imported into Hive executation context.
>     so the following centence won't work, because 'mynumber' doesn't work for sql sentence.
>     test_hiveoperator = HiveOperator(
>         task_id='hive_test',
>         hiveconf_jinja_translate=True,
>         hql = ''' use myDB;
>             INSERT OVERWRITE TABLE t2
>             select * from t1 where t1.x > ' ${hiveconf:mynumber}'
>         ''',
>         params={'mynumber': 2},
>         dag=dag
>     )
>     this modification pass the 'params' in HiveOperator construction to Hive sql execution
context.
>     The the variable definition can pass to hive sql



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message