You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "huangzhir (via GitHub)" <gi...@apache.org> on 2023/06/02 03:55:20 UTC

[GitHub] [kyuubi] huangzhir commented on a diff in pull request #4813: Add the fetchorientation parameter to the /v1/operations/:operationId/log interface

huangzhir commented on code in PR #4813:
URL: https://github.com/apache/kyuubi/pull/4813#discussion_r1213889339


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/operation/log/OperationLog.scala:
##########
@@ -154,14 +167,25 @@ class OperationLog(path: Path) {
     tRow
   }
 
+  def read(maxRows: Int): TRowSet = synchronized {
+    read(FETCH_NEXT, maxRows)
+  }
+
   /**
    * Read to log file line by line
    *
    * @param maxRows maximum result number can reach
+   * @param order   the  fetch orientation of the result, can be FETCH_NEXT, FETCH_FIRST
    */
-  def read(maxRows: Int): TRowSet = synchronized {
+  def read(order: FetchOrientation = FETCH_NEXT, maxRows: Int): TRowSet = synchronized {
     if (!initialized) return ThriftUtils.newEmptyRowSet
-    val (logs, lines) = readLogs(reader, maxRows, maxRows)
+    if (order != FETCH_NEXT && order != FETCH_FIRST) {
+      throw KyuubiSQLException(s"$order in operation log is not supported")
+    }
+    if (order == FETCH_FIRST) {
+      resetReader()

Review Comment:
   I think just closing the ‘seekableReader’ and creating a new ‘seekableReader’ may not work because ‘seekableReader’ and ‘reader’ are different objects. Unless all instances of ‘reader’ are also replaced with ‘seekableReader’,



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org