Commit 4ee63ac
[SPARK-55020][PYTHON][FOLLOW-UP] Use
### What changes were proposed in this pull request?
Get the iterator from `ExecutePlan`, instead of using it as an iterator directly.
### Why are the changes needed?
In #54248 we did `gen = self._stub.ExecutePlan(req, metadata=self._builder.metadata())` to replace `for b in self._stub.ExecutePlan(req, metadata=self._builder.metadata())`. This is theoretically inequivalent. We use the iterable to be the iterator. For the actual `ExecutePlan` it works fine because the class can be both an iterator and an iterable. However, we do some mock test in our test suite and we should not have to worry too much about our mock. I fixed the test in the previous PR but I think it's better to stick to the actual semantics for the for loop, which is getting the iterator out of the iterable and do `next` on it.
I also reverted the change I made to the mock test. It still works with `iter()`, but I don't want to mislead people to believe that's necessary.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
The changed test passed locally.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #54351 from gaogaotiantian/fix-iter-problem.
Authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>iter() to get an iterator from ExecutePlan1 parent a5f064f commit 4ee63ac
2 files changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1701 | 1701 | | |
1702 | 1702 | | |
1703 | 1703 | | |
1704 | | - | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
1705 | 1707 | | |
1706 | 1708 | | |
1707 | 1709 | | |
1708 | | - | |
| 1710 | + | |
1709 | 1711 | | |
1710 | 1712 | | |
1711 | 1713 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
0 commit comments