Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements.  See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership.  The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License.  You may obtain a copy of the License at
0009  *
0010  *     http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing, software
0013  * distributed under the License is distributed on an "AS IS" BASIS,
0014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0015  * See the License for the specific language governing permissions and
0016  * limitations under the License.
0017  */
0018 
0019 package org.apache.hive.service.cli;
0020 
0021 import org.apache.hive.service.rpc.thrift.TProtocolVersion;
0022 import org.apache.hive.service.rpc.thrift.TRowSet;
0023 import org.apache.thrift.TException;
0024 
0025 import static org.apache.hive.service.rpc.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6;
0026 
0027 public class RowSetFactory {
0028 
0029   public static RowSet create(TableSchema schema, TProtocolVersion version, boolean isBlobBased) {
0030     if (version.getValue() >= HIVE_CLI_SERVICE_PROTOCOL_V6.getValue()) {
0031       return new ColumnBasedSet(schema, isBlobBased);
0032     }
0033     return new RowBasedSet(schema);
0034   }
0035 
0036   public static RowSet create(TRowSet results, TProtocolVersion version) throws TException {
0037     if (version.getValue() >= HIVE_CLI_SERVICE_PROTOCOL_V6.getValue()) {
0038       return new ColumnBasedSet(results);
0039     }
0040     return new RowBasedSet(results);
0041   }
0042 }