[ 
https://issues.apache.org/jira/browse/IMPALA-11974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joe McDonnell resolved IMPALA-11974.
------------------------------------
    Fix Version/s: Impala 4.3.0
         Assignee: Joe McDonnell
       Resolution: Fixed

> 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-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to