This commit is contained in:
Kent Yao 2020-10-21 18:19:33 +08:00
parent 85321b920d
commit c319c9f7b4
4 changed files with 184 additions and 0 deletions

View File

@ -0,0 +1,42 @@
/*
* 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.operation
import org.apache.hive.service.rpc.thrift.{TRowSet, TTableSchema}
import org.apache.kyuubi.operation.FetchOrientation.FetchOrientation
import org.apache.kyuubi.session.Session
class NoopOperation(session: Session)
extends AbstractOperation(OperationType.UNKNOWN_OPERATION, session) {
override protected def runInternal(): Unit = {}
override protected def beforeRun(): Unit = {}
override protected def afterRun(): Unit = {}
override def cancel(): Unit = {}
override def close(): Unit = {}
override def getResultSetSchema: TTableSchema = new TTableSchema()
override def getNextRowSet(order: FetchOrientation, rowSetSize: Int): TRowSet = new TRowSet()
override def shouldRunAsync: Boolean = false
}

View File

@ -0,0 +1,73 @@
/*
* 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.operation
import org.apache.hive.service.rpc.thrift.TRowSet
import org.apache.kyuubi.operation.FetchOrientation.FetchOrientation
import org.apache.kyuubi.session.Session
class NoopOperationManager extends OperationManager("noop") {
override def newExecuteStatementOperation(
session: Session,
statement: String,
runAsync: Boolean,
queryTimeout: Long): Operation = new NoopOperation(session)
override def newGetTypeInfoOperation(session: Session): Operation = new NoopOperation(session)
override def newGetCatalogsOperation(session: Session): Operation = new NoopOperation(session)
override def newGetSchemasOperation(
session: Session,
catalog: String,
schema: String): Operation = {
new NoopOperation(session)
}
override def newGetTablesOperation(
session: Session,
catalogName: String,
schemaName: String,
tableName: String,
tableTypes: java.util.List[String]): Operation = {
new NoopOperation(session)
}
override def newGetTableTypesOperation(session: Session): Operation = {
new NoopOperation(session)
}
override def newGetColumnsOperation(
session: Session,
catalogName: String,
schemaName: String,
tableName: String,
columnName: String): Operation = new NoopOperation(session)
override def newGetFunctionsOperation(
session: Session,
catalogName: String,
schemaName: String,
functionName: String): Operation = new NoopOperation(session)
override def getOperationLogRowSet(
opHandle: OperationHandle,
order: FetchOrientation,
maxRows: Int): TRowSet = new TRowSet()
}

View File

@ -0,0 +1,34 @@
/*
* 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.session
import org.apache.hive.service.rpc.thrift.TProtocolVersion
class NoopSessionImpl(
protocol: TProtocolVersion,
user: String,
password: String,
ipAddress: String,
conf: Map[String, String],
sessionManager: SessionManager)
extends AbstractSession(protocol, user, password, ipAddress, conf, sessionManager) {
override def handle: SessionHandle = SessionHandle(protocol)
override def open(): Unit = {}
}

View File

@ -0,0 +1,35 @@
/*
* 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.session
import org.apache.hive.service.rpc.thrift.TProtocolVersion
import org.apache.kyuubi.operation.{NoopOperationManager, OperationManager}
class NoopSessionManager extends SessionManager("noop") {
override val operationManager: OperationManager = new NoopOperationManager()
override def openSession(
protocol: TProtocolVersion,
user: String,
password: String,
ipAddress: String,
conf: Map[String, String]): SessionHandle = {
new NoopSessionImpl(protocol, user, password, ipAddress, conf, this).handle
}
}