You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/01/23 07:16:14 UTC

[GitHub] zhongjiajie commented on a change in pull request #4560: [AIRFLOW-3733] Don't raise NameError in HQL hook when no rows returned

zhongjiajie commented on a change in pull request #4560: [AIRFLOW-3733] Don't raise NameError in HQL hook when no rows returned
URL: https://github.com/apache/airflow/pull/4560#discussion_r250076652
 
 

 ##########
 File path: airflow/hooks/hive_hooks.py
 ##########
 @@ -878,6 +878,7 @@ def to_csv(
         header = next(results_iter)
         message = None
 
+        i = 0
 
 Review comment:
   @ashb I run some code below in Python2.7.15 and Python3.6.7, both of them ware asserted
   ```python
   i = 0
   lst = list(range(10))
   for i, v in enumerate(lst, 1):
       pass
   assert i == len(lst), "counter {} not equel to len {}".format(i, len(lst))
   ```
   Which mean that work on py2 and py3.
   
   But I found some thing wrong when I write test code in 
   https://github.com/apache/airflow/blob/c8891454fd95ca21d5131ff26e597f475e4f54f6/airflow/hooks/hive_hooks.py#L891-L894
   We should use `enumerate(results_iter, 1)` instead of `enumerate(results_iter, 1)` to count the correct row number. Am I right?
   
   So I should fix it in this PR or submit new PR to do that?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services