yiheng commented on a change in pull request #197: [LIVY-574][THRIFT 
SERVER][TEST] Add tests for metadata operations
URL: https://github.com/apache/incubator-livy/pull/197#discussion_r315027255
 
 

 ##########
 File path: 
thriftserver/server/src/main/scala/org/apache/livy/thriftserver/operation/MetadataOperation.scala
 ##########
 @@ -42,8 +46,14 @@ abstract class MetadataOperation(sessionHandle: 
SessionHandle, opType: Operation
     assertState(Seq(OperationState.FINISHED))
     validateFetchOrientation(orientation)
     if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
-      rowSet.setRowOffset(0)
+      offset = 0
+    }
+
+    if (offset >= rowSet.numRows) {
 
 Review comment:
   @jerryshao 
   
   1. Return an empty ResultSet when needed
   **pros**: No data copy. It's efficient
   **cons**: Not straight forward. And we need to maintain the `row offset` in 
the `MetadataOperation`.
   
   2. extractSubset()
   **pros**: Straight forward. Maintain the `row offset` in the `ResultSet` 
itself. It's what spark thriftserver do.
   **cons**: Data copy every time. Honestly, I think it's not a big issue as 
the metadata is small.  However, `ResultSet` is also used in other places, e.g. 
fetch table data. Not sure if it will be misused in the future.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to