Skip to content

Commit

Permalink
[SPARK-46325][CONNECT] Remove unnecessary override functions when con…
Browse files Browse the repository at this point in the history
…structing `WrappedCloseableIterator` in `ResponseValidator#wrapIterator`

### What changes were proposed in this pull request?
This pr removes the overridden `hasNext` and `close` functions in the construction of `WrappedCloseableIterator` in `ResponseValidator#wrapIterator`, as these functions are identical to those defined in `WrappedCloseableIterator`.

- WrappedCloseableIterator

https://github.com/apache/spark/blob/9ffdcc398ed5560f34778d005da697f6ad0a15ee/connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/CloseableIterator.scala#L30-L42

- ResponseValidator#wrapIterator

https://github.com/apache/spark/blob/9ffdcc398ed5560f34778d005da697f6ad0a15ee/connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/ResponseValidator.scala#L62-L85

### Why are the changes needed?
Remove unnecessary override functions.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass GitHub Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #44255 from LuciferYang/SPARK-46325.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
  • Loading branch information
LuciferYang authored and dongjoon-hyun committed Dec 8, 2023
1 parent d9f0fcc commit 75cb370
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,11 @@ class ResponseValidator extends Logging {

override def innerIterator: Iterator[T] = inner

override def hasNext: Boolean = {
innerIterator.hasNext
}

override def next(): T = {
verifyResponse {
innerIterator.next()
}
}

override def close(): Unit = {
innerIterator match {
case it: CloseableIterator[T] => it.close()
case _ => // nothing
}
}
}
}

Expand Down

0 comments on commit 75cb370

Please sign in to comment.