Skip to content

Commit

Permalink
add isHive21OrLower method
Browse files Browse the repository at this point in the history
  • Loading branch information
lsm1 committed Nov 1, 2024
1 parent 0c77c6f commit 9fbe1ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ abstract class AbstractOperation(session: Session) extends Operation with Loggin
// this will cause the client of the lower version to get stuck.
// Check thrift protocol version <= HIVE_CLI_SERVICE_PROTOCOL_V8(Hive 2.1.0),
// convert TIMEDOUT_STATE to CANCELED.
if (getProtocolVersion.getValue <=
TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8.getValue) {
if (isHive21OrLower) {
cleanup(OperationState.CANCELED)
} else {
cleanup(OperationState.TIMEOUT)
Expand Down Expand Up @@ -287,4 +286,8 @@ abstract class AbstractOperation(session: Session) extends Operation with Loggin
}
}
}

protected def isHive21OrLower: Boolean = {
getProtocolVersion.getValue <= TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8.getValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.apache.kyuubi.metrics.{MetricsConstants, MetricsSystem}
import org.apache.kyuubi.operation.FetchOrientation.FETCH_NEXT
import org.apache.kyuubi.operation.log.OperationLog
import org.apache.kyuubi.session.Session
import org.apache.kyuubi.shaded.hive.service.rpc.thrift.{TGetOperationStatusResp, TOperationState, TProtocolVersion}
import org.apache.kyuubi.shaded.hive.service.rpc.thrift.{TGetOperationStatusResp, TOperationState}
import org.apache.kyuubi.shaded.hive.service.rpc.thrift.TOperationState._

class ExecuteStatement(
Expand Down Expand Up @@ -124,9 +124,7 @@ class ExecuteStatement(
// this will cause the client of the lower version to get stuck.
// Check thrift protocol version <= HIVE_CLI_SERVICE_PROTOCOL_V8(Hive 2.1.0),
// convert TIMEDOUT_STATE to CANCELED.
if getProtocolVersion.getValue <=
TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8.getValue =>
setState(OperationState.CANCELED)
if isHive21OrLower => setState(OperationState.CANCELED)

case TIMEDOUT_STATE =>
setState(OperationState.TIMEOUT)
Expand Down

0 comments on commit 9fbe1ac

Please sign in to comment.