David Knupp has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/12960 )

Change subject: IMPALA-8390: clean up test vectors in test_cancellation.py
......................................................................


Patch Set 2:

(1 comment)

Looks good to me

http://gerrit.cloudera.org:8080/#/c/12960/2/tests/common/test_vector.py
File tests/common/test_vector.py:

http://gerrit.cloudera.org:8080/#/c/12960/2/tests/common/test_vector.py@79
PS2, Line 79: ValueError
Pedantic nit: ValueError is probably the wrong thing to raise here. From 
https://docs.python.org/2/library/exceptions.html, a ValueError applies when 
"an operation or function receives an argument that has the right type but an 
inappropriate value." I'd probably raise the more generic RuntimeError. (Note 
to self: submit a patch to python core for a new WtfError class.)

You can also argue that using next() in this instance is kinda weird (it is) 
and pointlessly clever. The original intent is to stop iterating over 
vector_values when the desired value is found, but to do it in a one-liner. How 
about a more verbose but way more legible for/else loop?

  for vector_values in self.vector_values:
    if vector_value.name == name:
      return vector_value.name   # stops iteration
  else:
    do something else if not found

Regardless, I assume that there's no code that actually catches this anywhere? 
We just want things to blow up noisily, rather than silently failing as with 
StopIteration.



--
To view, visit http://gerrit.cloudera.org:8080/12960
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9673fe82bda5314aff6a51d1961759ff286fbf6f
Gerrit-Change-Number: 12960
Gerrit-PatchSet: 2
Gerrit-Owner: Thomas Marshall <tmarsh...@cloudera.com>
Gerrit-Reviewer: David Knupp <dkn...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Thomas Marshall <tmarsh...@cloudera.com>
Gerrit-Comment-Date: Thu, 11 Apr 2019 23:57:18 +0000
Gerrit-HasComments: Yes

Reply via email to