pan3793 commented on code in PR #6642: URL: https://github.com/apache/kyuubi/pull/6642#discussion_r1729252237
########## kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiGrpcBackendService.scala: ########## @@ -0,0 +1,176 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.kyuubi.server + +import io.grpc.stub.StreamObserver + +import org.apache.kyuubi.Logging +import org.apache.kyuubi.service.AbstractBackendService +import org.apache.kyuubi.session.{GrpcSessionHandle, KyuubiGrpcSession, KyuubiGrpcSessionManager} +import org.apache.kyuubi.shaded.spark.connect.proto + +class KyuubiGrpcBackendService extends AbstractBackendService("KyuubiGrpcBackendService") + with proto.SparkConnectServiceGrpc.AsyncService with Logging { + + override val sessionManager: KyuubiGrpcSessionManager = new KyuubiGrpcSessionManager() + + override def executePlan( + req: proto.ExecutePlanRequest, + respObserver: StreamObserver[proto.ExecutePlanResponse]): Unit = { + info(s"executePlan - session_id: ${req.getSessionId}, operation_id: ${req.getOperationId}") + val previousSessionId = if (req.hasClientObservedServerSideSessionId) { + Some(req.getClientObservedServerSideSessionId) + } else None + val session = sessionManager.getOrCreateSession( + new GrpcSessionHandle(req.getUserContext.getUserId, req.getSessionId), + previousSessionId) + session.client.astub.executePlan(req, respObserver) + } + + override def analyzePlan( + req: proto.AnalyzePlanRequest, + respObserver: StreamObserver[proto.AnalyzePlanResponse]): Unit = { + warn(s"analyzePlan - session_id: ${req.getSessionId}") + val previousSessionId = if (req.hasClientObservedServerSideSessionId) { + Some(req.getClientObservedServerSideSessionId) + } else None + val session = sessionManager.getOrCreateSession( + new GrpcSessionHandle(req.getUserContext.getUserId, req.getSessionId), + previousSessionId) + session.client.astub.analyzePlan(req, respObserver) + } + + override def config( + req: proto.ConfigRequest, + respObserver: StreamObserver[proto.ConfigResponse]): Unit = { + warn(s"config - session_id: ${req.getSessionId}") + val previousSessionId = if (req.hasClientObservedServerSideSessionId) { + Some(req.getClientObservedServerSideSessionId) + } else None + val session = sessionManager.getOrCreateSession( + new GrpcSessionHandle(req.getUserContext.getUserId, req.getSessionId), + previousSessionId) + session.client.astub.config(req, respObserver) + } + + // FIXME this is dummy implementation to discard any uploaded artifacts + override def addArtifacts(respObserver: StreamObserver[proto.AddArtifactsResponse]) Review Comment: this is the only unimplemented method, so uploading artifacts does not work now. it must be fixed before moving on to the next step. -- 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-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org