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

ASF GitHub Bot commented on AIRFLOW-3054:
-----------------------------------------

r39132 closed pull request #3940: [AIRFLOW-3054] Add show statements to hql 
filtering
URL: https://github.com/apache/incubator-airflow/pull/3940
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/hooks/hive_hooks.py b/airflow/hooks/hive_hooks.py
index ffa1c863a2..178606aa4e 100644
--- a/airflow/hooks/hive_hooks.py
+++ b/airflow/hooks/hive_hooks.py
@@ -810,6 +810,7 @@ def _get_results(self, hql, schema='default', 
fetch_size=None, hive_conf=None):
                 lowered_statement = statement.lower().strip()
                 if (lowered_statement.startswith('select') or
                     lowered_statement.startswith('with') or
+                    lowered_statement.startswith('show') or
                     (lowered_statement.startswith('set') and
                      '=' not in lowered_statement)):
                     description = [c for c in cur.description]


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Show statements don't work in Hive hook 
> ----------------------------------------
>
>                 Key: AIRFLOW-3054
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3054
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: hive_hooks
>            Reporter: Anton Protopopov
>            Assignee: Anton Protopopov
>            Priority: Minor
>
> Currently in airflow.hooks.hive_hooks.py in HiveServer2Hook class in 
> _get_results method there are filter for incoming hql:
> source code: 
> https://github.com/apache/incubator-airflow/blob/a79b92ae40c005d8239dfc7711ff44ae69b9c65b/airflow/hooks/hive_hooks.py#L809-L814
> {code:java}
>                 # we only get results of statements that returns
>                 lowered_statement = statement.lower().strip()
>                 if (lowered_statement.startswith('select') or
>                     lowered_statement.startswith('with') or
>                     (lowered_statement.startswith('set') and
>                     '=' not in lowered_statement)):
> {code}
> Queries which starts with show also returning results (like "show tables in 
> default", or "show partitions in default.table_name").
> So I'm thinking it worth to add another statement which starts with "show":
> {code:java}
> lowered_statement.startswith('show')
> {code}
>  
>  



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

Reply via email to