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

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

Commit b90d636407dc8562b72e7d15542ffe45cc45036f in impala's branch 
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=b90d63640 ]

IMPALA-14104: Fix TestDecimalFuzz on Python 3

TestDecimalFuzz uses division to calculate the number of
iterations for certain tests. On Python 3, division produces
a float and range() will not take a float as an argument.
In theory, the "from __future__ import division" was supposed
to produce the same behavior on Python 2 and 3, but in practice,
the "from builtins import range" allows a float argument to
range() on Python 2 but not Python 3.

This fixes the issue by explicitly casting to an integer.

Testing:
 - Ran TestDecimalFuzz with Python 3

Change-Id: I4cd4daecde690bf41a4e412c02c23cbb6ae5a14c
Reviewed-on: http://gerrit.cloudera.org:8080/22955
Reviewed-by: Riza Suminto <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> TestDecimalFuzz fails on Python 3 due to division producing a float
> -------------------------------------------------------------------
>
>                 Key: IMPALA-14104
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14104
>             Project: IMPALA
>          Issue Type: Sub-task
>          Components: Test
>    Affects Versions: Impala 5.0.0
>            Reporter: Joe McDonnell
>            Assignee: Joe McDonnell
>            Priority: Major
>
> When using IMPALA_USE_PYTHON3_TESTS=true, query_test/test_decimal_fuzz.py 
> fails with the following error:
> {noformat}
> query_test/test_decimal_fuzz.py:253: in test_decimal_ops
>     for _ in range(self.iterations):
> E   TypeError: 'float' object cannot be interpreted as an integer{noformat}
> It uses division to produce the number of iterations, and on Python3, 
> division produces a float rather than an int. This works on Python 2, because 
> the range that we import from builtins seems to handle range() calls with 
> float as argument. This can easily be fixed by specifically converting to int.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to