You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2023/04/14 01:06:00 UTC

[jira] [Commented] (IMPALA-11974) Fix range/xrange/map/filter/ifilter/zip/izip issues regarding iterators being lazy

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

ASF subversion and git services commented on IMPALA-11974:
----------------------------------------------------------

Commit 175dae33d9a224ef69decc2d3887e847755d4c9e in impala's branch refs/heads/master from Tamas Mate
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=175dae33d ]

IMPALA-11974: Fix xrange call in collect_minidumps.py

Python3 deprecates xrange operator, this commit replaces it with the new
range operator similar to earlier replacements in IMPALA-11974.

Testing:
 - Tested that Python3 parses this file successfully

Change-Id: I155725d8edac9222064c88912b19f0591c690afe
Reviewed-on: http://gerrit.cloudera.org:8080/19727
Reviewed-by: Riza Suminto <ri...@cloudera.com>
Reviewed-by: Joe McDonnell <jo...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> Fix range/xrange/map/filter/ifilter/zip/izip issues regarding iterators being lazy
> ----------------------------------------------------------------------------------
>
>                 Key: IMPALA-11974
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11974
>             Project: IMPALA
>          Issue Type: Sub-task
>          Components: Infrastructure
>    Affects Versions: Impala 4.3.0
>            Reporter: Joe McDonnell
>            Assignee: Joe McDonnell
>            Priority: Major
>             Fix For: Impala 4.3.0
>
>
> Python 3 made map, range, zip, and filter lazy. That means that existing Python code that relies on this turning into a list immediately need adjustments:
> {noformat}
> # Python 2:
> range(5) == [0,1,2,3,4]
> True
> # Python 3:
> range(5) == [0,1,2,3,4]
> False
> # Python 3 fix:
> list(range(5)) == [0,1,2,3,4]
> True
> # Same deal with map, zip, filter, etc.{noformat}
> This example is basic, but this applies across the board. 
> Since the ordinary operators like range, filter, etc are now lazy, the old lazy ones have been removed (xrange, ifilter, izip). Those need to be replaced, and the future package provides implementations of range, zip, map, filter, etc.
> See:
> [https://python-future.org/compatible_idioms.html#xrange]
> [https://python-future.org/compatible_idioms.html#range]
> [https://python-future.org/compatible_idioms.html#map]
> [https://python-future.org/compatible_idioms.html#imap]
> etc
> This corresponds to these pylint checks:
> xrange-builtin
> range-builtin-not-iterating
> map-builtin-not-iterating
> zip-builtin-not-iterating
> filter-builtin-not-iterating
> reduce-builtin
> deprecated-itertools-function
> Futurize has some tools to help:
> libfuturize.fixes.fix_xrange_with_import
> lib2to3.fixes.fix_map
> lib2to3.fixes.fix_filter



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org