Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/16440#discussion_r94495291
--- Diff:
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala
---
@@ -111,9 +115,15 @@ private[hive] class SparkExecuteStatementOperation(
// Reset iter to header when fetching start from first row
if (order.equals(FetchOrientation.FETCH_FIRST)) {
- val (ita, itb) = iterHeader.duplicate
- iter = ita
- iterHeader = itb
+ iter = if (useIncrementalCollect) {
+ resultList = None
+ result.toLocalIterator.asScala
+ } else {
+ if (resultList.isEmpty) {
--- End diff --
`collect()` is still intended to be called once logically. The following is
the reason why there exists two `collect()`.
When `useIncrementalCollect=false`, `collect()` is called at [line
244](https://github.com/apache/spark/pull/16440/files#diff-72dcd8f81a51c8a815159fdf0332acdcR244)
**once** and `resultList` will not be `None`.
However, if users executes a query with `useIncrementalCollect=true` and
they changes their mind to turn off as `useIncrementalCollect=false`. The next
`getNextRowSet(FetchOrientation.FETCH_FIRST)` should check `resultList` and
fill that by calling `collect()` **once** in [line
123](https://github.com/apache/spark/pull/16440/files#diff-72dcd8f81a51c8a815159fdf0332acdcR123).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]