pan3793 commented on code in PR #5851: URL: https://github.com/apache/kyuubi/pull/5851#discussion_r1427584021
########## externals/kyuubi-chat-engine/src/main/scala/org/apache/kyuubi/engine/chat/schema/RowSetGenerator.scala: ########## @@ -0,0 +1,61 @@ +/* + * 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.engine.chat.schema + +import org.apache.kyuubi.engine.chat.schema.RowSetGenerator._ +import org.apache.kyuubi.engine.schema.AbstractRowSetGenerator +import org.apache.kyuubi.shaded.hive.service.rpc.thrift._ +import org.apache.kyuubi.shaded.hive.service.rpc.thrift.TTypeId._ + +class RowSetGenerator Review Comment: can we have a different name for each module? e.g. `ChatRowSetGenerator` `TrinoRowSetGenerator`, `KyuubiRowSetGenerator`(for server module) ########## externals/kyuubi-chat-engine/src/main/scala/org/apache/kyuubi/engine/chat/operation/ChatOperation.scala: ########## @@ -45,8 +46,11 @@ abstract class ChatOperation(session: Session) extends AbstractOperation(session iter.fetchAbsolute(0) } - val taken = iter.take(rowSetSize) - val resultRowSet = RowSet.toTRowSet(taken.toSeq, 1, getProtocolVersion) + val taken = iter.take(rowSetSize).map(_.toSeq) + val resultRowSet = new RowSetGenerator().toTRowSet( Review Comment: why should create a new instance each time? is it stateful? if not, I suppose we can define `object RowSetGenerator` instead of `class RowSetGenerator` ########## kyuubi-common/src/main/scala/org/apache/kyuubi/engine/schema/AbstractRowSetGenerator.scala: ########## @@ -0,0 +1,217 @@ +/* + * 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.engine.schema +import java.nio.ByteBuffer +import java.util.{ArrayList => JArrayList, BitSet => JBitSet, List => JList} + +import scala.collection.JavaConverters._ + +import org.apache.kyuubi.shaded.hive.service.rpc.thrift._ +import org.apache.kyuubi.shaded.hive.service.rpc.thrift.TTypeId._ +import org.apache.kyuubi.util.RowSetUtils.bitSetToBuffer + +/** + * RowSetGenerator for TRowSet generation + * of either row-based or column-based + * @tparam SchemaT the class type of schema + * @tparam RowT the class type of row + * @tparam ColumnT the class type of column Review Comment: such a description won't provide more information than the variable names themselves. remove it or explain in detail -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
