diff --git itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHiveServer2.java itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHiveServer2.java index eb08628..f3ea07c 100644 --- itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHiveServer2.java +++ itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHiveServer2.java @@ -64,6 +64,6 @@ public void testConnection() throws Exception { serviceClient.executeStatement(sessHandle, "CREATE TABLE " + tabName + " (id INT)", confOverlay); OperationHandle opHandle = serviceClient.executeStatement(sessHandle, "SHOW TABLES", confOverlay); RowSet rowSet = serviceClient.fetchResults(opHandle); - assertFalse(rowSet.getSize() == 0); + assertFalse(rowSet.numRows() == 0); } } diff --git jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java index b02f374..257c88a 100644 --- jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java +++ jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java @@ -44,25 +44,17 @@ import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.Type; -import org.apache.hive.service.cli.thrift.TBoolValue; -import org.apache.hive.service.cli.thrift.TByteValue; -import org.apache.hive.service.cli.thrift.TColumnValue; -import org.apache.hive.service.cli.thrift.TDoubleValue; -import org.apache.hive.service.cli.thrift.TI16Value; -import org.apache.hive.service.cli.thrift.TI32Value; -import org.apache.hive.service.cli.thrift.TI64Value; -import org.apache.hive.service.cli.thrift.TRow; -import org.apache.hive.service.cli.thrift.TStringValue; /** * Data independent base class which implements the common part of * all Hive result sets. */ public abstract class HiveBaseResultSet implements ResultSet { + protected Statement statement = null; protected SQLWarning warningChain = null; protected boolean wasNull = false; - protected TRow row; + protected Object[] row; protected List columnNames; protected List columnTypes; protected List columnAttributes; @@ -380,176 +372,47 @@ public String getNString(String columnLabel) throws SQLException { throw new SQLException("Method not supported"); } - private Boolean getBooleanValue(TBoolValue tBoolValue) { - if (tBoolValue.isSetValue()) { - wasNull = false; - return tBoolValue.isValue(); - } - wasNull = true; - return null; - } - - private Byte getByteValue(TByteValue tByteValue) { - if (tByteValue.isSetValue()) { - wasNull = false; - return tByteValue.getValue(); - } - wasNull = true; - return null; - } - - private Short getShortValue(TI16Value tI16Value) { - if (tI16Value.isSetValue()) { - wasNull = false; - return tI16Value.getValue(); - } - wasNull = true; - return null; - } - - private Integer getIntegerValue(TI32Value tI32Value) { - if (tI32Value.isSetValue()) { - wasNull = false; - return tI32Value.getValue(); - } - wasNull = true; - return null; - } - - private Long getLongValue(TI64Value tI64Value) { - if (tI64Value.isSetValue()) { - wasNull = false; - return tI64Value.getValue(); - } - wasNull = true; - return null; - } - - private Double getDoubleValue(TDoubleValue tDoubleValue) { - if (tDoubleValue.isSetValue()) { - wasNull = false; - return tDoubleValue.getValue(); - } - wasNull = true; - return null; - } - - private String getStringValue(TStringValue tStringValue) { - if (tStringValue.isSetValue()) { - wasNull = false; - return tStringValue.getValue(); - } - wasNull = true; - return null; - } - - private Date getDateValue(TStringValue tStringValue) { - if (tStringValue.isSetValue()) { - wasNull = false; - return Date.valueOf(tStringValue.getValue()); - } - wasNull = true; - return null; - } - - private Timestamp getTimestampValue(TStringValue tStringValue) { - if (tStringValue.isSetValue()) { - wasNull = false; - return Timestamp.valueOf(tStringValue.getValue()); - } - wasNull = true; - return null; - } - - private byte[] getBinaryValue(TStringValue tString) { - if (tString.isSetValue()) { - wasNull = false; - return tString.getValue().getBytes(); - } - wasNull = true; - return null; - } - - private BigDecimal getBigDecimalValue(TStringValue tStringValue) { - if (tStringValue.isSetValue()) { - wasNull = false; - return new BigDecimal(tStringValue.getValue()); - } - wasNull = true; - return null; - } - private Object getColumnValue(int columnIndex) throws SQLException { if (row == null) { throw new SQLException("No row found."); } - List colVals = row.getColVals(); - if (colVals == null) { + if (row.length == 0) { throw new SQLException("RowSet does not contain any columns!"); } - if (columnIndex > colVals.size()) { + if (columnIndex > row.length) { throw new SQLException("Invalid columnIndex: " + columnIndex); } - - TColumnValue tColumnValue = colVals.get(columnIndex - 1); Type columnType = getSchema().getColumnDescriptorAt(columnIndex - 1).getType(); - switch (columnType) { - case BOOLEAN_TYPE: - return getBooleanValue(tColumnValue.getBoolVal()); - case TINYINT_TYPE: - return getByteValue(tColumnValue.getByteVal()); - case SMALLINT_TYPE: - return getShortValue(tColumnValue.getI16Val()); - case INT_TYPE: - return getIntegerValue(tColumnValue.getI32Val()); - case BIGINT_TYPE: - return getLongValue(tColumnValue.getI64Val()); - case FLOAT_TYPE: - return getDoubleValue(tColumnValue.getDoubleVal()); - case DOUBLE_TYPE: - return getDoubleValue(tColumnValue.getDoubleVal()); - case STRING_TYPE: - return getStringValue(tColumnValue.getStringVal()); - case CHAR_TYPE: - return getStringValue(tColumnValue.getStringVal()); - case VARCHAR_TYPE: - return getStringValue(tColumnValue.getStringVal()); - case BINARY_TYPE: - return getBinaryValue(tColumnValue.getStringVal()); - case DATE_TYPE: - return getDateValue(tColumnValue.getStringVal()); - case TIMESTAMP_TYPE: - return getTimestampValue(tColumnValue.getStringVal()); - case DECIMAL_TYPE: - return getBigDecimalValue(tColumnValue.getStringVal()); - case NULL_TYPE: - wasNull = true; - return null; - default: - throw new SQLException("Unrecognized column type:" + columnType); + try { + Object evaluated = evaluate(columnType, row[columnIndex - 1]); + wasNull = evaluated == null; + return evaluated; + } catch (Exception e) { + e.printStackTrace(); + throw new SQLException("Unrecognized column type:" + columnType, e); } + } - /* - switch (tColumnValue.getSetField()) { - case BOOL_VAL: - return getBooleanValue(tColumnValue.getBoolVal()); - case BYTE_VAL: - return getByteValue(tColumnValue.getByteVal()); - case I16_VAL: - return getShortValue(tColumnValue.getI16Val()); - case I32_VAL: - return getIntegerValue(tColumnValue.getI32Val()); - case I64_VAL: - return getLongValue(tColumnValue.getI64Val()); - case DOUBLE_VAL: - return getDoubleValue(tColumnValue.getDoubleVal()); - case STRING_VAL: - return getStringValue(tColumnValue.getStringVal()); - default: - throw new SQLException("Unrecognized column type:" + tColumnValue.getSetField()); + private Object evaluate(Type type, Object value) { + if (value == null) { + return null; + } + switch (type) { + case BINARY_TYPE: + if (value instanceof String) { + return ((String) value).getBytes(); + } + return value; + case TIMESTAMP_TYPE: + return Timestamp.valueOf((String) value); + case DECIMAL_TYPE: + return new BigDecimal((String)value); + case DATE_TYPE: + return Date.valueOf((String) value); + default: + return value; } - */ } public Object getObject(int columnIndex) throws SQLException { diff --git jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java index 4963592..0915171 100644 --- jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java +++ jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java @@ -93,12 +93,13 @@ private final Map hiveVarMap; private final boolean isEmbeddedMode; private TTransport transport; - private TCLIService.Iface client; + private TCLIService.Iface client; // todo should be replaced by CliServiceClient private boolean isClosed = true; private SQLWarning warningChain = null; private TSessionHandle sessHandle = null; private final List supportedProtocols = new LinkedList(); private int loginTimeout = 0; + private TProtocolVersion protocol; public HiveConnection(String uri, Properties info) throws SQLException { setupLoginTimeout(); @@ -138,6 +139,7 @@ public HiveConnection(String uri, Properties info) throws SQLException { supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V3); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V4); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5); + supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6); // open client session openSession(); @@ -268,8 +270,10 @@ private void openSession() throws SQLException { if (!supportedProtocols.contains(openResp.getServerProtocolVersion())) { throw new TException("Unsupported Hive2 protocol"); } + protocol = openResp.getServerProtocolVersion(); sessHandle = openResp.getSessionHandle(); } catch (TException e) { + e.printStackTrace(); throw new SQLException("Could not establish connection to " + jdbcURI + ": " + e.getMessage(), " 08S01", e); } @@ -932,4 +936,7 @@ public boolean isWrapperFor(Class iface) throws SQLException { throw new SQLException("Method not supported"); } + public TProtocolVersion getProtocol() { + return protocol; + } } diff --git jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java index fe39c0c..508db7a 100644 --- jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java +++ jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java @@ -135,7 +135,7 @@ public ResultSet getCatalogs() throws SQLException { } Utils.verifySuccess(catalogResp.getStatus()); - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(catalogResp.getOperationHandle()) @@ -219,7 +219,7 @@ public ResultSet getColumns(String catalog, String schemaPattern, } Utils.verifySuccess(colResp.getStatus()); // build the resultset from response - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(colResp.getOperationHandle()) @@ -331,7 +331,7 @@ public ResultSet getFunctions(String catalogName, String schemaPattern, String f } Utils.verifySuccess(funcResp.getStatus()); - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(funcResp.getOperationHandle()) @@ -344,7 +344,7 @@ public String getIdentifierQuoteString() throws SQLException { public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setEmptyResultSet(true) .setSchema( @@ -486,7 +486,7 @@ public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { // Hive doesn't support primary keys // using local schema with empty resultset - return new HiveQueryResultSet.Builder(null).setClient(client).setEmptyResultSet(true). + return new HiveQueryResultSet.Builder(connection).setClient(client).setEmptyResultSet(true). setSchema(Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME" ), Arrays.asList("STRING", "STRING", "STRING", "STRING", "INT", "STRING")) .build(); @@ -497,7 +497,7 @@ public ResultSet getProcedureColumns(String catalog, String schemaPattern, throws SQLException { // Hive doesn't support primary keys // using local schema with empty resultset - return new HiveQueryResultSet.Builder(null).setClient(client).setEmptyResultSet(true). + return new HiveQueryResultSet.Builder(connection).setClient(client).setEmptyResultSet(true). setSchema( Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME", "COLUMN_NAME", "COLUMN_TYPE", "DATA_TYPE", "TYPE_NAME", "PRECISION", "LENGTH", "SCALE", "RADIX", "NULLABLE", "REMARKS", @@ -518,7 +518,7 @@ public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException { // Hive doesn't support primary keys // using local schema with empty resultset - return new HiveQueryResultSet.Builder(null).setClient(client).setEmptyResultSet(true). + return new HiveQueryResultSet.Builder(connection).setClient(client).setEmptyResultSet(true). setSchema( Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME", "RESERVERD", "RESERVERD", "RESERVERD", "REMARKS", "PROCEDURE_TYPE", "SPECIFIC_NAME"), @@ -572,7 +572,7 @@ public ResultSet getSchemas(String catalog, String schemaPattern) } Utils.verifySuccess(schemaResp.getStatus()); - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(schemaResp.getOperationHandle()) @@ -616,7 +616,7 @@ public ResultSet getTableTypes() throws SQLException { } Utils.verifySuccess(tableTypeResp.getStatus()); - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(tableTypeResp.getOperationHandle()) @@ -649,7 +649,7 @@ public ResultSet getTables(String catalog, String schemaPattern, } Utils.verifySuccess(getTableResp.getStatus()); - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(getTableResp.getOperationHandle()) @@ -705,7 +705,7 @@ public ResultSet getTypeInfo() throws SQLException { throw new SQLException(e.getMessage(), "08S01", e); } Utils.verifySuccess(getTypeInfoResp.getStatus()); - return new HiveQueryResultSet.Builder(null) + return new HiveQueryResultSet.Builder(connection) .setClient(client) .setSessionHandle(sessHandle) .setStmtHandle(getTypeInfoResp.getOperationHandle()) diff --git jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java index 061337d..50207dc 100644 --- jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java +++ jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java @@ -20,6 +20,7 @@ import static org.apache.hive.service.cli.thrift.TCLIServiceConstants.TYPE_NAMES; +import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; @@ -31,6 +32,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hive.common.type.HiveDecimal; +import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.thrift.TCLIService; import org.apache.hive.service.cli.thrift.TCLIServiceConstants; @@ -42,7 +45,8 @@ import org.apache.hive.service.cli.thrift.TGetResultSetMetadataResp; import org.apache.hive.service.cli.thrift.TOperationHandle; import org.apache.hive.service.cli.thrift.TPrimitiveTypeEntry; -import org.apache.hive.service.cli.thrift.TRow; +import org.apache.hive.service.cli.thrift.TProtocolVersion; +import org.apache.hive.service.cli.thrift.TRowSet; import org.apache.hive.service.cli.thrift.TSessionHandle; import org.apache.hive.service.cli.thrift.TTableSchema; import org.apache.hive.service.cli.thrift.TTypeQualifierValue; @@ -63,15 +67,19 @@ private int fetchSize; private int rowsFetched = 0; - private List fetchedRows; - private Iterator fetchedRowsItr; + private RowSet fetchedRows; + private Iterator fetchedRowsItr; private boolean isClosed = false; private boolean emptyResultSet = false; private boolean isScrollable = false; private boolean fetchFirst = false; + private final TProtocolVersion protocol; + + public static class Builder { + private final Connection connection; private final Statement statement; private TCLIService.Iface client = null; private TOperationHandle stmtHandle = null; @@ -91,8 +99,14 @@ private boolean emptyResultSet = false; private boolean isScrollable = false; - public Builder(Statement statement) { + public Builder(Statement statement) throws SQLException { this.statement = statement; + this.connection = statement.getConnection(); + } + + public Builder(Connection connection) { + this.statement = null; + this.connection = connection; } public Builder setClient(TCLIService.Iface client) { @@ -155,6 +169,10 @@ public Builder setScrollable(boolean setScrollable) { public HiveQueryResultSet build() throws SQLException { return new HiveQueryResultSet(this); } + + public TProtocolVersion getProtocolVersion() throws SQLException { + return ((HiveConnection)connection).getProtocol(); + } } protected HiveQueryResultSet(Builder builder) throws SQLException { @@ -178,6 +196,7 @@ protected HiveQueryResultSet(Builder builder) throws SQLException { this.maxRows = builder.maxRows; } this.isScrollable = builder.isScrollable; + this.protocol = builder.getProtocolVersion(); } /** @@ -217,6 +236,7 @@ private static JdbcColumnAttributes getColumnAttributes( * Retrieve schema from the server */ private void retrieveSchema() throws SQLException { + System.err.println("[HiveQueryResultSet/next] 0"); try { TGetResultSetMetadataReq metadataReq = new TGetResultSetMetadataReq(stmtHandle); // TODO need session handle @@ -304,13 +324,14 @@ public boolean next() throws SQLException { fetchedRowsItr = null; fetchFirst = false; } - if (fetchedRows == null || !fetchedRowsItr.hasNext()) { TFetchResultsReq fetchReq = new TFetchResultsReq(stmtHandle, orientation, fetchSize); TFetchResultsResp fetchResp = client.FetchResults(fetchReq); Utils.verifySuccessWithInfo(fetchResp.getStatus()); - fetchedRows = fetchResp.getResults().getRows(); + + TRowSet results = fetchResp.getResults(); + fetchedRows = RowSetFactory.create(results, protocol); fetchedRowsItr = fetchedRows.iterator(); } diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote old mode 100644 new mode 100755 diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/FetchFormatter.java ql/src/java/org/apache/hadoop/hive/ql/exec/FetchFormatter.java index d369e0e..c2ed0d6 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/FetchFormatter.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/FetchFormatter.java @@ -42,8 +42,11 @@ public static class ThriftFormatter implements FetchFormatter { + int protocol; + @Override public void initialize(Configuration hconf, Properties props) throws Exception { + protocol = hconf.getInt(ListSinkOperator.OUTPUT_PROTOCOL, 0); } @Override @@ -56,7 +59,7 @@ public Object convert(Object row, ObjectInspector rowOI) throws Exception { StructField fieldRef = fields.get(i); Object field = structOI.getStructFieldData(row, fieldRef); converted[i] = field == null ? null : - SerDeUtils.toThriftPayload(field, fieldRef.getFieldObjectInspector()); + SerDeUtils.toThriftPayload(field, fieldRef.getFieldObjectInspector(), protocol); } return converted; } diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/ListSinkOperator.java ql/src/java/org/apache/hadoop/hive/ql/exec/ListSinkOperator.java index f64be31..dcc19f7 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/ListSinkOperator.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/ListSinkOperator.java @@ -36,6 +36,7 @@ public class ListSinkOperator extends Operator { public static final String OUTPUT_FORMATTER = "output.formatter"; + public static final String OUTPUT_PROTOCOL = "output.protocol"; private transient List res; private transient FetchFormatter fetcher; diff --git serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java index 18ae044..d972321 100644 --- serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java +++ serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java @@ -198,11 +198,15 @@ public static String lightEscapeString(String str) { * * This method is kept consistent with {@link HiveResultSetMetaData#hiveTypeToSqlType}. */ - public static Object toThriftPayload(Object val, ObjectInspector valOI) { + public static Object toThriftPayload(Object val, ObjectInspector valOI, int version) { if (valOI.getCategory() == ObjectInspector.Category.PRIMITIVE) { + if (val == null) { + return null; + } Object obj = ObjectInspectorUtils.copyToStandardObject(val, valOI, ObjectInspectorUtils.ObjectInspectorCopyOption.JAVA); - if (((PrimitiveObjectInspector)valOI).getPrimitiveCategory() == + // uses string type for binary before HIVE_CLI_SERVICE_PROTOCOL_V6 + if (version < 5 && ((PrimitiveObjectInspector)valOI).getPrimitiveCategory() == PrimitiveObjectInspector.PrimitiveCategory.BINARY) { // todo HIVE-5269 return new String((byte[])obj); diff --git service/if/TCLIService.thrift service/if/TCLIService.thrift index 0f22745..692d49b 100644 --- service/if/TCLIService.thrift +++ service/if/TCLIService.thrift @@ -51,6 +51,9 @@ enum TProtocolVersion { // V5 adds error details when GetOperationStatus returns in error state HIVE_CLI_SERVICE_PROTOCOL_V5 + + // V6 uses binary type for binary payload (was string) and uses columnar result set + HIVE_CLI_SERVICE_PROTOCOL_V6 } enum TTypeId { @@ -88,9 +91,9 @@ const set PRIMITIVE_TYPES = [ TTypeId.TIMESTAMP_TYPE, TTypeId.BINARY_TYPE, TTypeId.DECIMAL_TYPE, - TTypeId.NULL_TYPE - TTypeId.DATE_TYPE - TTypeId.VARCHAR_TYPE + TTypeId.NULL_TYPE, + TTypeId.DATE_TYPE, + TTypeId.VARCHAR_TYPE, TTypeId.CHAR_TYPE ] @@ -335,6 +338,62 @@ struct TRow { 1: required list colVals } +struct TBoolColumn { + 1: required list values + 2: required binary nulls +} + +struct TByteColumn { + 1: required list values + 2: required binary nulls +} + +struct TI16Column { + 1: required list values + 2: required binary nulls +} + +struct TI32Column { + 1: required list values + 2: required binary nulls +} + +struct TI64Column { + 1: required list values + 2: required binary nulls +} + +struct TDoubleColumn { + 1: required list values + 2: required binary nulls +} + +struct TStringColumn { + 1: required list values + 2: required binary nulls +} + +struct TBinaryColumn { + 1: required list values + 2: required binary nulls +} + +// Note that Hive's type system is richer than Thrift's, +// so in some cases we have to map multiple Hive types +// to the same Thrift type. On the client-side this is +// disambiguated by looking at the Schema of the +// result set. +union TColumn { + 1: TBoolColumn boolVal // BOOLEAN + 2: TByteColumn byteVal // TINYINT + 3: TI16Column i16Val // SMALLINT + 4: TI32Column i32Val // INT + 5: TI64Column i64Val // BIGINT, TIMESTAMP + 6: TDoubleColumn doubleVal // FLOAT, DOUBLE + 7: TStringColumn stringVal // STRING, LIST, MAP, STRUCT, UNIONTYPE, DECIMAL, NULL + 8: TBinaryColumn binaryVal // BINARY +} + // Represents a rowset struct TRowSet { // The starting row offset of this rowset. @@ -490,7 +549,7 @@ struct TOperationHandle { // which operations may be executed. struct TOpenSessionReq { // The version of the HiveServer2 protocol that the client is using. - 1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5 + 1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6 // Username and password for authentication. // Depending on the authentication scheme being used, @@ -509,7 +568,7 @@ struct TOpenSessionResp { 1: required TStatus status // The protocol version that the server is using. - 2: required TProtocolVersion serverProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5 + 2: required TProtocolVersion serverProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6 // Session Handle 3: optional TSessionHandle sessionHandle diff --git service/src/gen/thrift/gen-cpp/TCLIService_types.cpp service/src/gen/thrift/gen-cpp/TCLIService_types.cpp index 8b80416..1afa43d 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_types.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService_types.cpp @@ -15,16 +15,18 @@ int _kTProtocolVersionValues[] = { TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V2, TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V3, TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V4, - TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V5 + TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V5, + TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V6 }; const char* _kTProtocolVersionNames[] = { "HIVE_CLI_SERVICE_PROTOCOL_V1", "HIVE_CLI_SERVICE_PROTOCOL_V2", "HIVE_CLI_SERVICE_PROTOCOL_V3", "HIVE_CLI_SERVICE_PROTOCOL_V4", - "HIVE_CLI_SERVICE_PROTOCOL_V5" + "HIVE_CLI_SERVICE_PROTOCOL_V5", + "HIVE_CLI_SERVICE_PROTOCOL_V6" }; -const std::map _TProtocolVersion_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kTProtocolVersionValues, _kTProtocolVersionNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +const std::map _TProtocolVersion_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(6, _kTProtocolVersionValues, _kTProtocolVersionNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); int _kTTypeIdValues[] = { TTypeId::BOOLEAN_TYPE, @@ -2233,8 +2235,961 @@ void swap(TRow &a, TRow &b) { swap(a.colVals, b.colVals); } -const char* TRowSet::ascii_fingerprint = "698727A24268879440EE0DAFE68FC1C5"; -const uint8_t TRowSet::binary_fingerprint[16] = {0x69,0x87,0x27,0xA2,0x42,0x68,0x87,0x94,0x40,0xEE,0x0D,0xAF,0xE6,0x8F,0xC1,0xC5}; +const char* TBoolColumn::ascii_fingerprint = "F9058324D96DB7F974D8ACDC01C54219"; +const uint8_t TBoolColumn::binary_fingerprint[16] = {0xF9,0x05,0x83,0x24,0xD9,0x6D,0xB7,0xF9,0x74,0xD8,0xAC,0xDC,0x01,0xC5,0x42,0x19}; + +uint32_t TBoolColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size85; + ::apache::thrift::protocol::TType _etype88; + xfer += iprot->readListBegin(_etype88, _size85); + this->values.resize(_size85); + uint32_t _i89; + for (_i89 = 0; _i89 < _size85; ++_i89) + { + xfer += iprot->readBool(this->values[_i89]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TBoolColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TBoolColumn"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_BOOL, static_cast(this->values.size())); + std::vector ::const_iterator _iter90; + for (_iter90 = this->values.begin(); _iter90 != this->values.end(); ++_iter90) + { + xfer += oprot->writeBool((*_iter90)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TBoolColumn &a, TBoolColumn &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TByteColumn::ascii_fingerprint = "1CB300106BAA463A70BB2A2395900F48"; +const uint8_t TByteColumn::binary_fingerprint[16] = {0x1C,0xB3,0x00,0x10,0x6B,0xAA,0x46,0x3A,0x70,0xBB,0x2A,0x23,0x95,0x90,0x0F,0x48}; + +uint32_t TByteColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size91; + ::apache::thrift::protocol::TType _etype94; + xfer += iprot->readListBegin(_etype94, _size91); + this->values.resize(_size91); + uint32_t _i95; + for (_i95 = 0; _i95 < _size91; ++_i95) + { + xfer += iprot->readByte(this->values[_i95]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TByteColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TByteColumn"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_BYTE, static_cast(this->values.size())); + std::vector ::const_iterator _iter96; + for (_iter96 = this->values.begin(); _iter96 != this->values.end(); ++_iter96) + { + xfer += oprot->writeByte((*_iter96)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TByteColumn &a, TByteColumn &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TI16Column::ascii_fingerprint = "6574CDB1F121C8DB47FB257A3F104BDB"; +const uint8_t TI16Column::binary_fingerprint[16] = {0x65,0x74,0xCD,0xB1,0xF1,0x21,0xC8,0xDB,0x47,0xFB,0x25,0x7A,0x3F,0x10,0x4B,0xDB}; + +uint32_t TI16Column::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size97; + ::apache::thrift::protocol::TType _etype100; + xfer += iprot->readListBegin(_etype100, _size97); + this->values.resize(_size97); + uint32_t _i101; + for (_i101 = 0; _i101 < _size97; ++_i101) + { + xfer += iprot->readI16(this->values[_i101]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TI16Column::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TI16Column"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I16, static_cast(this->values.size())); + std::vector ::const_iterator _iter102; + for (_iter102 = this->values.begin(); _iter102 != this->values.end(); ++_iter102) + { + xfer += oprot->writeI16((*_iter102)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TI16Column &a, TI16Column &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TI32Column::ascii_fingerprint = "CCCCE89C7E9DA10280F5663700677313"; +const uint8_t TI32Column::binary_fingerprint[16] = {0xCC,0xCC,0xE8,0x9C,0x7E,0x9D,0xA1,0x02,0x80,0xF5,0x66,0x37,0x00,0x67,0x73,0x13}; + +uint32_t TI32Column::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size103; + ::apache::thrift::protocol::TType _etype106; + xfer += iprot->readListBegin(_etype106, _size103); + this->values.resize(_size103); + uint32_t _i107; + for (_i107 = 0; _i107 < _size103; ++_i107) + { + xfer += iprot->readI32(this->values[_i107]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TI32Column::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TI32Column"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast(this->values.size())); + std::vector ::const_iterator _iter108; + for (_iter108 = this->values.begin(); _iter108 != this->values.end(); ++_iter108) + { + xfer += oprot->writeI32((*_iter108)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TI32Column &a, TI32Column &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TI64Column::ascii_fingerprint = "925353917FC0AF87976A2338011F5A31"; +const uint8_t TI64Column::binary_fingerprint[16] = {0x92,0x53,0x53,0x91,0x7F,0xC0,0xAF,0x87,0x97,0x6A,0x23,0x38,0x01,0x1F,0x5A,0x31}; + +uint32_t TI64Column::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size109; + ::apache::thrift::protocol::TType _etype112; + xfer += iprot->readListBegin(_etype112, _size109); + this->values.resize(_size109); + uint32_t _i113; + for (_i113 = 0; _i113 < _size109; ++_i113) + { + xfer += iprot->readI64(this->values[_i113]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TI64Column::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TI64Column"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast(this->values.size())); + std::vector ::const_iterator _iter114; + for (_iter114 = this->values.begin(); _iter114 != this->values.end(); ++_iter114) + { + xfer += oprot->writeI64((*_iter114)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TI64Column &a, TI64Column &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TDoubleColumn::ascii_fingerprint = "8FF1C050A8D7FD247AEB23CD71539C09"; +const uint8_t TDoubleColumn::binary_fingerprint[16] = {0x8F,0xF1,0xC0,0x50,0xA8,0xD7,0xFD,0x24,0x7A,0xEB,0x23,0xCD,0x71,0x53,0x9C,0x09}; + +uint32_t TDoubleColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size115; + ::apache::thrift::protocol::TType _etype118; + xfer += iprot->readListBegin(_etype118, _size115); + this->values.resize(_size115); + uint32_t _i119; + for (_i119 = 0; _i119 < _size115; ++_i119) + { + xfer += iprot->readDouble(this->values[_i119]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TDoubleColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TDoubleColumn"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_DOUBLE, static_cast(this->values.size())); + std::vector ::const_iterator _iter120; + for (_iter120 = this->values.begin(); _iter120 != this->values.end(); ++_iter120) + { + xfer += oprot->writeDouble((*_iter120)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TDoubleColumn &a, TDoubleColumn &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TStringColumn::ascii_fingerprint = "BE556BF7091B2DABBA1863D5E458B15F"; +const uint8_t TStringColumn::binary_fingerprint[16] = {0xBE,0x55,0x6B,0xF7,0x09,0x1B,0x2D,0xAB,0xBA,0x18,0x63,0xD5,0xE4,0x58,0xB1,0x5F}; + +uint32_t TStringColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size121; + ::apache::thrift::protocol::TType _etype124; + xfer += iprot->readListBegin(_etype124, _size121); + this->values.resize(_size121); + uint32_t _i125; + for (_i125 = 0; _i125 < _size121; ++_i125) + { + xfer += iprot->readString(this->values[_i125]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TStringColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TStringColumn"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->values.size())); + std::vector ::const_iterator _iter126; + for (_iter126 = this->values.begin(); _iter126 != this->values.end(); ++_iter126) + { + xfer += oprot->writeString((*_iter126)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TStringColumn &a, TStringColumn &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TBinaryColumn::ascii_fingerprint = "BE556BF7091B2DABBA1863D5E458B15F"; +const uint8_t TBinaryColumn::binary_fingerprint[16] = {0xBE,0x55,0x6B,0xF7,0x09,0x1B,0x2D,0xAB,0xBA,0x18,0x63,0xD5,0xE4,0x58,0xB1,0x5F}; + +uint32_t TBinaryColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_values = false; + bool isset_nulls = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->values.clear(); + uint32_t _size127; + ::apache::thrift::protocol::TType _etype130; + xfer += iprot->readListBegin(_etype130, _size127); + this->values.resize(_size127); + uint32_t _i131; + for (_i131 = 0; _i131 < _size127; ++_i131) + { + xfer += iprot->readBinary(this->values[_i131]); + } + xfer += iprot->readListEnd(); + } + isset_values = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readBinary(this->nulls); + isset_nulls = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_values) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_nulls) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TBinaryColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TBinaryColumn"); + + xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->values.size())); + std::vector ::const_iterator _iter132; + for (_iter132 = this->values.begin(); _iter132 != this->values.end(); ++_iter132) + { + xfer += oprot->writeBinary((*_iter132)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("nulls", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeBinary(this->nulls); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TBinaryColumn &a, TBinaryColumn &b) { + using ::std::swap; + swap(a.values, b.values); + swap(a.nulls, b.nulls); +} + +const char* TColumn::ascii_fingerprint = "E6ADD10B4CDDE61A19E8878CC7039A17"; +const uint8_t TColumn::binary_fingerprint[16] = {0xE6,0xAD,0xD1,0x0B,0x4C,0xDD,0xE6,0x1A,0x19,0xE8,0x87,0x8C,0xC7,0x03,0x9A,0x17}; + +uint32_t TColumn::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->boolVal.read(iprot); + this->__isset.boolVal = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->byteVal.read(iprot); + this->__isset.byteVal = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->i16Val.read(iprot); + this->__isset.i16Val = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->i32Val.read(iprot); + this->__isset.i32Val = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->i64Val.read(iprot); + this->__isset.i64Val = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->doubleVal.read(iprot); + this->__isset.doubleVal = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 7: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->stringVal.read(iprot); + this->__isset.stringVal = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 8: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->binaryVal.read(iprot); + this->__isset.binaryVal = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TColumn::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TColumn"); + + xfer += oprot->writeFieldBegin("boolVal", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->boolVal.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("byteVal", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->byteVal.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("i16Val", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->i16Val.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("i32Val", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->i32Val.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("i64Val", ::apache::thrift::protocol::T_STRUCT, 5); + xfer += this->i64Val.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("doubleVal", ::apache::thrift::protocol::T_STRUCT, 6); + xfer += this->doubleVal.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("stringVal", ::apache::thrift::protocol::T_STRUCT, 7); + xfer += this->stringVal.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("binaryVal", ::apache::thrift::protocol::T_STRUCT, 8); + xfer += this->binaryVal.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TColumn &a, TColumn &b) { + using ::std::swap; + swap(a.boolVal, b.boolVal); + swap(a.byteVal, b.byteVal); + swap(a.i16Val, b.i16Val); + swap(a.i32Val, b.i32Val); + swap(a.i64Val, b.i64Val); + swap(a.doubleVal, b.doubleVal); + swap(a.stringVal, b.stringVal); + swap(a.binaryVal, b.binaryVal); + swap(a.__isset, b.__isset); +} + +const char* TRowSet::ascii_fingerprint = "46DA30A870489C7A58105AE0080DAEBF"; +const uint8_t TRowSet::binary_fingerprint[16] = {0x46,0xDA,0x30,0xA8,0x70,0x48,0x9C,0x7A,0x58,0x10,0x5A,0xE0,0x08,0x0D,0xAE,0xBF}; uint32_t TRowSet::read(::apache::thrift::protocol::TProtocol* iprot) { @@ -2270,14 +3225,14 @@ uint32_t TRowSet::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->rows.clear(); - uint32_t _size85; - ::apache::thrift::protocol::TType _etype88; - xfer += iprot->readListBegin(_etype88, _size85); - this->rows.resize(_size85); - uint32_t _i89; - for (_i89 = 0; _i89 < _size85; ++_i89) + uint32_t _size133; + ::apache::thrift::protocol::TType _etype136; + xfer += iprot->readListBegin(_etype136, _size133); + this->rows.resize(_size133); + uint32_t _i137; + for (_i137 = 0; _i137 < _size133; ++_i137) { - xfer += this->rows[_i89].read(iprot); + xfer += this->rows[_i137].read(iprot); } xfer += iprot->readListEnd(); } @@ -2290,14 +3245,14 @@ uint32_t TRowSet::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->columns.clear(); - uint32_t _size90; - ::apache::thrift::protocol::TType _etype93; - xfer += iprot->readListBegin(_etype93, _size90); - this->columns.resize(_size90); - uint32_t _i94; - for (_i94 = 0; _i94 < _size90; ++_i94) + uint32_t _size138; + ::apache::thrift::protocol::TType _etype141; + xfer += iprot->readListBegin(_etype141, _size138); + this->columns.resize(_size138); + uint32_t _i142; + for (_i142 = 0; _i142 < _size138; ++_i142) { - xfer += this->columns[_i94].read(iprot); + xfer += this->columns[_i142].read(iprot); } xfer += iprot->readListEnd(); } @@ -2333,10 +3288,10 @@ uint32_t TRowSet::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldBegin("rows", ::apache::thrift::protocol::T_LIST, 2); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->rows.size())); - std::vector ::const_iterator _iter95; - for (_iter95 = this->rows.begin(); _iter95 != this->rows.end(); ++_iter95) + std::vector ::const_iterator _iter143; + for (_iter143 = this->rows.begin(); _iter143 != this->rows.end(); ++_iter143) { - xfer += (*_iter95).write(oprot); + xfer += (*_iter143).write(oprot); } xfer += oprot->writeListEnd(); } @@ -2346,10 +3301,10 @@ uint32_t TRowSet::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldBegin("columns", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->columns.size())); - std::vector ::const_iterator _iter96; - for (_iter96 = this->columns.begin(); _iter96 != this->columns.end(); ++_iter96) + std::vector ::const_iterator _iter144; + for (_iter144 = this->columns.begin(); _iter144 != this->columns.end(); ++_iter144) { - xfer += (*_iter96).write(oprot); + xfer += (*_iter144).write(oprot); } xfer += oprot->writeListEnd(); } @@ -2394,9 +3349,9 @@ uint32_t TStatus::read(::apache::thrift::protocol::TProtocol* iprot) { { case 1: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast97; - xfer += iprot->readI32(ecast97); - this->statusCode = (TStatusCode::type)ecast97; + int32_t ecast145; + xfer += iprot->readI32(ecast145); + this->statusCode = (TStatusCode::type)ecast145; isset_statusCode = true; } else { xfer += iprot->skip(ftype); @@ -2406,14 +3361,14 @@ uint32_t TStatus::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->infoMessages.clear(); - uint32_t _size98; - ::apache::thrift::protocol::TType _etype101; - xfer += iprot->readListBegin(_etype101, _size98); - this->infoMessages.resize(_size98); - uint32_t _i102; - for (_i102 = 0; _i102 < _size98; ++_i102) + uint32_t _size146; + ::apache::thrift::protocol::TType _etype149; + xfer += iprot->readListBegin(_etype149, _size146); + this->infoMessages.resize(_size146); + uint32_t _i150; + for (_i150 = 0; _i150 < _size146; ++_i150) { - xfer += iprot->readString(this->infoMessages[_i102]); + xfer += iprot->readString(this->infoMessages[_i150]); } xfer += iprot->readListEnd(); } @@ -2472,10 +3427,10 @@ uint32_t TStatus::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldBegin("infoMessages", ::apache::thrift::protocol::T_LIST, 2); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->infoMessages.size())); - std::vector ::const_iterator _iter103; - for (_iter103 = this->infoMessages.begin(); _iter103 != this->infoMessages.end(); ++_iter103) + std::vector ::const_iterator _iter151; + for (_iter151 = this->infoMessages.begin(); _iter151 != this->infoMessages.end(); ++_iter151) { - xfer += oprot->writeString((*_iter103)); + xfer += oprot->writeString((*_iter151)); } xfer += oprot->writeListEnd(); } @@ -2691,9 +3646,9 @@ uint32_t TOperationHandle::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast104; - xfer += iprot->readI32(ecast104); - this->operationType = (TOperationType::type)ecast104; + int32_t ecast152; + xfer += iprot->readI32(ecast152); + this->operationType = (TOperationType::type)ecast152; isset_operationType = true; } else { xfer += iprot->skip(ftype); @@ -2794,9 +3749,9 @@ uint32_t TOpenSessionReq::read(::apache::thrift::protocol::TProtocol* iprot) { { case 1: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast105; - xfer += iprot->readI32(ecast105); - this->client_protocol = (TProtocolVersion::type)ecast105; + int32_t ecast153; + xfer += iprot->readI32(ecast153); + this->client_protocol = (TProtocolVersion::type)ecast153; isset_client_protocol = true; } else { xfer += iprot->skip(ftype); @@ -2822,17 +3777,17 @@ uint32_t TOpenSessionReq::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_MAP) { { this->configuration.clear(); - uint32_t _size106; - ::apache::thrift::protocol::TType _ktype107; - ::apache::thrift::protocol::TType _vtype108; - xfer += iprot->readMapBegin(_ktype107, _vtype108, _size106); - uint32_t _i110; - for (_i110 = 0; _i110 < _size106; ++_i110) + uint32_t _size154; + ::apache::thrift::protocol::TType _ktype155; + ::apache::thrift::protocol::TType _vtype156; + xfer += iprot->readMapBegin(_ktype155, _vtype156, _size154); + uint32_t _i158; + for (_i158 = 0; _i158 < _size154; ++_i158) { - std::string _key111; - xfer += iprot->readString(_key111); - std::string& _val112 = this->configuration[_key111]; - xfer += iprot->readString(_val112); + std::string _key159; + xfer += iprot->readString(_key159); + std::string& _val160 = this->configuration[_key159]; + xfer += iprot->readString(_val160); } xfer += iprot->readMapEnd(); } @@ -2877,11 +3832,11 @@ uint32_t TOpenSessionReq::write(::apache::thrift::protocol::TProtocol* oprot) co xfer += oprot->writeFieldBegin("configuration", ::apache::thrift::protocol::T_MAP, 4); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->configuration.size())); - std::map ::const_iterator _iter113; - for (_iter113 = this->configuration.begin(); _iter113 != this->configuration.end(); ++_iter113) + std::map ::const_iterator _iter161; + for (_iter161 = this->configuration.begin(); _iter161 != this->configuration.end(); ++_iter161) { - xfer += oprot->writeString(_iter113->first); - xfer += oprot->writeString(_iter113->second); + xfer += oprot->writeString(_iter161->first); + xfer += oprot->writeString(_iter161->second); } xfer += oprot->writeMapEnd(); } @@ -2936,9 +3891,9 @@ uint32_t TOpenSessionResp::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast114; - xfer += iprot->readI32(ecast114); - this->serverProtocolVersion = (TProtocolVersion::type)ecast114; + int32_t ecast162; + xfer += iprot->readI32(ecast162); + this->serverProtocolVersion = (TProtocolVersion::type)ecast162; isset_serverProtocolVersion = true; } else { xfer += iprot->skip(ftype); @@ -2956,17 +3911,17 @@ uint32_t TOpenSessionResp::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_MAP) { { this->configuration.clear(); - uint32_t _size115; - ::apache::thrift::protocol::TType _ktype116; - ::apache::thrift::protocol::TType _vtype117; - xfer += iprot->readMapBegin(_ktype116, _vtype117, _size115); - uint32_t _i119; - for (_i119 = 0; _i119 < _size115; ++_i119) + uint32_t _size163; + ::apache::thrift::protocol::TType _ktype164; + ::apache::thrift::protocol::TType _vtype165; + xfer += iprot->readMapBegin(_ktype164, _vtype165, _size163); + uint32_t _i167; + for (_i167 = 0; _i167 < _size163; ++_i167) { - std::string _key120; - xfer += iprot->readString(_key120); - std::string& _val121 = this->configuration[_key120]; - xfer += iprot->readString(_val121); + std::string _key168; + xfer += iprot->readString(_key168); + std::string& _val169 = this->configuration[_key168]; + xfer += iprot->readString(_val169); } xfer += iprot->readMapEnd(); } @@ -3012,11 +3967,11 @@ uint32_t TOpenSessionResp::write(::apache::thrift::protocol::TProtocol* oprot) c xfer += oprot->writeFieldBegin("configuration", ::apache::thrift::protocol::T_MAP, 4); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->configuration.size())); - std::map ::const_iterator _iter122; - for (_iter122 = this->configuration.begin(); _iter122 != this->configuration.end(); ++_iter122) + std::map ::const_iterator _iter170; + for (_iter170 = this->configuration.begin(); _iter170 != this->configuration.end(); ++_iter170) { - xfer += oprot->writeString(_iter122->first); - xfer += oprot->writeString(_iter122->second); + xfer += oprot->writeString(_iter170->first); + xfer += oprot->writeString(_iter170->second); } xfer += oprot->writeMapEnd(); } @@ -3326,9 +4281,9 @@ uint32_t TGetInfoReq::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast123; - xfer += iprot->readI32(ecast123); - this->infoType = (TGetInfoType::type)ecast123; + int32_t ecast171; + xfer += iprot->readI32(ecast171); + this->infoType = (TGetInfoType::type)ecast171; isset_infoType = true; } else { xfer += iprot->skip(ftype); @@ -3498,17 +4453,17 @@ uint32_t TExecuteStatementReq::read(::apache::thrift::protocol::TProtocol* iprot if (ftype == ::apache::thrift::protocol::T_MAP) { { this->confOverlay.clear(); - uint32_t _size124; - ::apache::thrift::protocol::TType _ktype125; - ::apache::thrift::protocol::TType _vtype126; - xfer += iprot->readMapBegin(_ktype125, _vtype126, _size124); - uint32_t _i128; - for (_i128 = 0; _i128 < _size124; ++_i128) + uint32_t _size172; + ::apache::thrift::protocol::TType _ktype173; + ::apache::thrift::protocol::TType _vtype174; + xfer += iprot->readMapBegin(_ktype173, _vtype174, _size172); + uint32_t _i176; + for (_i176 = 0; _i176 < _size172; ++_i176) { - std::string _key129; - xfer += iprot->readString(_key129); - std::string& _val130 = this->confOverlay[_key129]; - xfer += iprot->readString(_val130); + std::string _key177; + xfer += iprot->readString(_key177); + std::string& _val178 = this->confOverlay[_key177]; + xfer += iprot->readString(_val178); } xfer += iprot->readMapEnd(); } @@ -3557,11 +4512,11 @@ uint32_t TExecuteStatementReq::write(::apache::thrift::protocol::TProtocol* opro xfer += oprot->writeFieldBegin("confOverlay", ::apache::thrift::protocol::T_MAP, 3); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast(this->confOverlay.size())); - std::map ::const_iterator _iter131; - for (_iter131 = this->confOverlay.begin(); _iter131 != this->confOverlay.end(); ++_iter131) + std::map ::const_iterator _iter179; + for (_iter179 = this->confOverlay.begin(); _iter179 != this->confOverlay.end(); ++_iter179) { - xfer += oprot->writeString(_iter131->first); - xfer += oprot->writeString(_iter131->second); + xfer += oprot->writeString(_iter179->first); + xfer += oprot->writeString(_iter179->second); } xfer += oprot->writeMapEnd(); } @@ -4183,14 +5138,14 @@ uint32_t TGetTablesReq::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->tableTypes.clear(); - uint32_t _size132; - ::apache::thrift::protocol::TType _etype135; - xfer += iprot->readListBegin(_etype135, _size132); - this->tableTypes.resize(_size132); - uint32_t _i136; - for (_i136 = 0; _i136 < _size132; ++_i136) + uint32_t _size180; + ::apache::thrift::protocol::TType _etype183; + xfer += iprot->readListBegin(_etype183, _size180); + this->tableTypes.resize(_size180); + uint32_t _i184; + for (_i184 = 0; _i184 < _size180; ++_i184) { - xfer += iprot->readString(this->tableTypes[_i136]); + xfer += iprot->readString(this->tableTypes[_i184]); } xfer += iprot->readListEnd(); } @@ -4240,10 +5195,10 @@ uint32_t TGetTablesReq::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("tableTypes", ::apache::thrift::protocol::T_LIST, 5); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->tableTypes.size())); - std::vector ::const_iterator _iter137; - for (_iter137 = this->tableTypes.begin(); _iter137 != this->tableTypes.end(); ++_iter137) + std::vector ::const_iterator _iter185; + for (_iter185 = this->tableTypes.begin(); _iter185 != this->tableTypes.end(); ++_iter185) { - xfer += oprot->writeString((*_iter137)); + xfer += oprot->writeString((*_iter185)); } xfer += oprot->writeListEnd(); } @@ -4972,9 +5927,9 @@ uint32_t TGetOperationStatusResp::read(::apache::thrift::protocol::TProtocol* ip break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast138; - xfer += iprot->readI32(ecast138); - this->operationState = (TOperationState::type)ecast138; + int32_t ecast186; + xfer += iprot->readI32(ecast186); + this->operationState = (TOperationState::type)ecast186; this->__isset.operationState = true; } else { xfer += iprot->skip(ftype); @@ -5496,9 +6451,9 @@ uint32_t TFetchResultsReq::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast139; - xfer += iprot->readI32(ecast139); - this->orientation = (TFetchOrientation::type)ecast139; + int32_t ecast187; + xfer += iprot->readI32(ecast187); + this->orientation = (TFetchOrientation::type)ecast187; isset_orientation = true; } else { xfer += iprot->skip(ftype); @@ -5558,8 +6513,8 @@ void swap(TFetchResultsReq &a, TFetchResultsReq &b) { swap(a.maxRows, b.maxRows); } -const char* TFetchResultsResp::ascii_fingerprint = "29891EA4D71B4283E8715DA5B95F2763"; -const uint8_t TFetchResultsResp::binary_fingerprint[16] = {0x29,0x89,0x1E,0xA4,0xD7,0x1B,0x42,0x83,0xE8,0x71,0x5D,0xA5,0xB9,0x5F,0x27,0x63}; +const char* TFetchResultsResp::ascii_fingerprint = "FC43BC2D6F3B76D4DB0F34226A745C8E"; +const uint8_t TFetchResultsResp::binary_fingerprint[16] = {0xFC,0x43,0xBC,0x2D,0x6F,0x3B,0x76,0xD4,0xDB,0x0F,0x34,0x22,0x6A,0x74,0x5C,0x8E}; uint32_t TFetchResultsResp::read(::apache::thrift::protocol::TProtocol* iprot) { diff --git service/src/gen/thrift/gen-cpp/TCLIService_types.h service/src/gen/thrift/gen-cpp/TCLIService_types.h index ac563d6..a870b8a 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_types.h +++ service/src/gen/thrift/gen-cpp/TCLIService_types.h @@ -22,7 +22,8 @@ struct TProtocolVersion { HIVE_CLI_SERVICE_PROTOCOL_V2 = 1, HIVE_CLI_SERVICE_PROTOCOL_V3 = 2, HIVE_CLI_SERVICE_PROTOCOL_V4 = 3, - HIVE_CLI_SERVICE_PROTOCOL_V5 = 4 + HIVE_CLI_SERVICE_PROTOCOL_V5 = 4, + HIVE_CLI_SERVICE_PROTOCOL_V6 = 5 }; }; @@ -1277,6 +1278,457 @@ class TRow { void swap(TRow &a, TRow &b); + +class TBoolColumn { + public: + + static const char* ascii_fingerprint; // = "F9058324D96DB7F974D8ACDC01C54219"; + static const uint8_t binary_fingerprint[16]; // = {0xF9,0x05,0x83,0x24,0xD9,0x6D,0xB7,0xF9,0x74,0xD8,0xAC,0xDC,0x01,0xC5,0x42,0x19}; + + TBoolColumn() : nulls() { + } + + virtual ~TBoolColumn() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TBoolColumn & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TBoolColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TBoolColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TBoolColumn &a, TBoolColumn &b); + + +class TByteColumn { + public: + + static const char* ascii_fingerprint; // = "1CB300106BAA463A70BB2A2395900F48"; + static const uint8_t binary_fingerprint[16]; // = {0x1C,0xB3,0x00,0x10,0x6B,0xAA,0x46,0x3A,0x70,0xBB,0x2A,0x23,0x95,0x90,0x0F,0x48}; + + TByteColumn() : nulls() { + } + + virtual ~TByteColumn() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TByteColumn & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TByteColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TByteColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TByteColumn &a, TByteColumn &b); + + +class TI16Column { + public: + + static const char* ascii_fingerprint; // = "6574CDB1F121C8DB47FB257A3F104BDB"; + static const uint8_t binary_fingerprint[16]; // = {0x65,0x74,0xCD,0xB1,0xF1,0x21,0xC8,0xDB,0x47,0xFB,0x25,0x7A,0x3F,0x10,0x4B,0xDB}; + + TI16Column() : nulls() { + } + + virtual ~TI16Column() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TI16Column & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TI16Column &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TI16Column & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TI16Column &a, TI16Column &b); + + +class TI32Column { + public: + + static const char* ascii_fingerprint; // = "CCCCE89C7E9DA10280F5663700677313"; + static const uint8_t binary_fingerprint[16]; // = {0xCC,0xCC,0xE8,0x9C,0x7E,0x9D,0xA1,0x02,0x80,0xF5,0x66,0x37,0x00,0x67,0x73,0x13}; + + TI32Column() : nulls() { + } + + virtual ~TI32Column() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TI32Column & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TI32Column &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TI32Column & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TI32Column &a, TI32Column &b); + + +class TI64Column { + public: + + static const char* ascii_fingerprint; // = "925353917FC0AF87976A2338011F5A31"; + static const uint8_t binary_fingerprint[16]; // = {0x92,0x53,0x53,0x91,0x7F,0xC0,0xAF,0x87,0x97,0x6A,0x23,0x38,0x01,0x1F,0x5A,0x31}; + + TI64Column() : nulls() { + } + + virtual ~TI64Column() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TI64Column & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TI64Column &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TI64Column & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TI64Column &a, TI64Column &b); + + +class TDoubleColumn { + public: + + static const char* ascii_fingerprint; // = "8FF1C050A8D7FD247AEB23CD71539C09"; + static const uint8_t binary_fingerprint[16]; // = {0x8F,0xF1,0xC0,0x50,0xA8,0xD7,0xFD,0x24,0x7A,0xEB,0x23,0xCD,0x71,0x53,0x9C,0x09}; + + TDoubleColumn() : nulls() { + } + + virtual ~TDoubleColumn() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TDoubleColumn & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TDoubleColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TDoubleColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TDoubleColumn &a, TDoubleColumn &b); + + +class TStringColumn { + public: + + static const char* ascii_fingerprint; // = "BE556BF7091B2DABBA1863D5E458B15F"; + static const uint8_t binary_fingerprint[16]; // = {0xBE,0x55,0x6B,0xF7,0x09,0x1B,0x2D,0xAB,0xBA,0x18,0x63,0xD5,0xE4,0x58,0xB1,0x5F}; + + TStringColumn() : nulls() { + } + + virtual ~TStringColumn() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TStringColumn & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TStringColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TStringColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TStringColumn &a, TStringColumn &b); + + +class TBinaryColumn { + public: + + static const char* ascii_fingerprint; // = "BE556BF7091B2DABBA1863D5E458B15F"; + static const uint8_t binary_fingerprint[16]; // = {0xBE,0x55,0x6B,0xF7,0x09,0x1B,0x2D,0xAB,0xBA,0x18,0x63,0xD5,0xE4,0x58,0xB1,0x5F}; + + TBinaryColumn() : nulls() { + } + + virtual ~TBinaryColumn() throw() {} + + std::vector values; + std::string nulls; + + void __set_values(const std::vector & val) { + values = val; + } + + void __set_nulls(const std::string& val) { + nulls = val; + } + + bool operator == (const TBinaryColumn & rhs) const + { + if (!(values == rhs.values)) + return false; + if (!(nulls == rhs.nulls)) + return false; + return true; + } + bool operator != (const TBinaryColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TBinaryColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TBinaryColumn &a, TBinaryColumn &b); + +typedef struct _TColumn__isset { + _TColumn__isset() : boolVal(false), byteVal(false), i16Val(false), i32Val(false), i64Val(false), doubleVal(false), stringVal(false), binaryVal(false) {} + bool boolVal; + bool byteVal; + bool i16Val; + bool i32Val; + bool i64Val; + bool doubleVal; + bool stringVal; + bool binaryVal; +} _TColumn__isset; + +class TColumn { + public: + + static const char* ascii_fingerprint; // = "E6ADD10B4CDDE61A19E8878CC7039A17"; + static const uint8_t binary_fingerprint[16]; // = {0xE6,0xAD,0xD1,0x0B,0x4C,0xDD,0xE6,0x1A,0x19,0xE8,0x87,0x8C,0xC7,0x03,0x9A,0x17}; + + TColumn() { + } + + virtual ~TColumn() throw() {} + + TBoolColumn boolVal; + TByteColumn byteVal; + TI16Column i16Val; + TI32Column i32Val; + TI64Column i64Val; + TDoubleColumn doubleVal; + TStringColumn stringVal; + TBinaryColumn binaryVal; + + _TColumn__isset __isset; + + void __set_boolVal(const TBoolColumn& val) { + boolVal = val; + } + + void __set_byteVal(const TByteColumn& val) { + byteVal = val; + } + + void __set_i16Val(const TI16Column& val) { + i16Val = val; + } + + void __set_i32Val(const TI32Column& val) { + i32Val = val; + } + + void __set_i64Val(const TI64Column& val) { + i64Val = val; + } + + void __set_doubleVal(const TDoubleColumn& val) { + doubleVal = val; + } + + void __set_stringVal(const TStringColumn& val) { + stringVal = val; + } + + void __set_binaryVal(const TBinaryColumn& val) { + binaryVal = val; + } + + bool operator == (const TColumn & rhs) const + { + if (!(boolVal == rhs.boolVal)) + return false; + if (!(byteVal == rhs.byteVal)) + return false; + if (!(i16Val == rhs.i16Val)) + return false; + if (!(i32Val == rhs.i32Val)) + return false; + if (!(i64Val == rhs.i64Val)) + return false; + if (!(doubleVal == rhs.doubleVal)) + return false; + if (!(stringVal == rhs.stringVal)) + return false; + if (!(binaryVal == rhs.binaryVal)) + return false; + return true; + } + bool operator != (const TColumn &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TColumn & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TColumn &a, TColumn &b); + typedef struct _TRowSet__isset { _TRowSet__isset() : columns(false) {} bool columns; @@ -1285,8 +1737,8 @@ typedef struct _TRowSet__isset { class TRowSet { public: - static const char* ascii_fingerprint; // = "698727A24268879440EE0DAFE68FC1C5"; - static const uint8_t binary_fingerprint[16]; // = {0x69,0x87,0x27,0xA2,0x42,0x68,0x87,0x94,0x40,0xEE,0x0D,0xAF,0xE6,0x8F,0xC1,0xC5}; + static const char* ascii_fingerprint; // = "46DA30A870489C7A58105AE0080DAEBF"; + static const uint8_t binary_fingerprint[16]; // = {0x46,0xDA,0x30,0xA8,0x70,0x48,0x9C,0x7A,0x58,0x10,0x5A,0xE0,0x08,0x0D,0xAE,0xBF}; TRowSet() : startRowOffset(0) { } @@ -1584,8 +2036,8 @@ class TOpenSessionReq { static const char* ascii_fingerprint; // = "C8FD0F306A16C16BDA7B57F58BFAE5B2"; static const uint8_t binary_fingerprint[16]; // = {0xC8,0xFD,0x0F,0x30,0x6A,0x16,0xC1,0x6B,0xDA,0x7B,0x57,0xF5,0x8B,0xFA,0xE5,0xB2}; - TOpenSessionReq() : client_protocol((TProtocolVersion::type)4), username(), password() { - client_protocol = (TProtocolVersion::type)4; + TOpenSessionReq() : client_protocol((TProtocolVersion::type)5), username(), password() { + client_protocol = (TProtocolVersion::type)5; } @@ -1660,8 +2112,8 @@ class TOpenSessionResp { static const char* ascii_fingerprint; // = "CFE7D7F4E9EC671F2518ED74FEE9F163"; static const uint8_t binary_fingerprint[16]; // = {0xCF,0xE7,0xD7,0xF4,0xE9,0xEC,0x67,0x1F,0x25,0x18,0xED,0x74,0xFE,0xE9,0xF1,0x63}; - TOpenSessionResp() : serverProtocolVersion((TProtocolVersion::type)4) { - serverProtocolVersion = (TProtocolVersion::type)4; + TOpenSessionResp() : serverProtocolVersion((TProtocolVersion::type)5) { + serverProtocolVersion = (TProtocolVersion::type)5; } @@ -3302,8 +3754,8 @@ typedef struct _TFetchResultsResp__isset { class TFetchResultsResp { public: - static const char* ascii_fingerprint; // = "29891EA4D71B4283E8715DA5B95F2763"; - static const uint8_t binary_fingerprint[16]; // = {0x29,0x89,0x1E,0xA4,0xD7,0x1B,0x42,0x83,0xE8,0x71,0x5D,0xA5,0xB9,0x5F,0x27,0x63}; + static const char* ascii_fingerprint; // = "FC43BC2D6F3B76D4DB0F34226A745C8E"; + static const uint8_t binary_fingerprint[16]; // = {0xFC,0x43,0xBC,0x2D,0x6F,0x3B,0x76,0xD4,0xDB,0x0F,0x34,0x22,0x6A,0x74,0x5C,0x8E}; TFetchResultsResp() : hasMoreRows(0) { } diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TBinaryColumn.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TBinaryColumn.java new file mode 100644 index 0000000..4690f6b --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TBinaryColumn.java @@ -0,0 +1,550 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TBinaryColumn implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TBinaryColumn"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TBinaryColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TBinaryColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TBinaryColumn.class, metaDataMap); + } + + public TBinaryColumn() { + } + + public TBinaryColumn( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TBinaryColumn(TBinaryColumn other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (ByteBuffer other_element : other.values) { + ByteBuffer temp_binary_element = org.apache.thrift.TBaseHelper.copyBinary(other_element); +; + __this__values.add(temp_binary_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TBinaryColumn deepCopy() { + return new TBinaryColumn(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(ByteBuffer elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TBinaryColumn) + return this.equals((TBinaryColumn)that); + return false; + } + + public boolean equals(TBinaryColumn that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TBinaryColumn other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TBinaryColumn typedOther = (TBinaryColumn)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TBinaryColumn("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TBinaryColumnStandardSchemeFactory implements SchemeFactory { + public TBinaryColumnStandardScheme getScheme() { + return new TBinaryColumnStandardScheme(); + } + } + + private static class TBinaryColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TBinaryColumn struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list166 = iprot.readListBegin(); + struct.values = new ArrayList(_list166.size); + for (int _i167 = 0; _i167 < _list166.size; ++_i167) + { + ByteBuffer _elem168; // required + _elem168 = iprot.readBinary(); + struct.values.add(_elem168); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TBinaryColumn struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.values.size())); + for (ByteBuffer _iter169 : struct.values) + { + oprot.writeBinary(_iter169); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TBinaryColumnTupleSchemeFactory implements SchemeFactory { + public TBinaryColumnTupleScheme getScheme() { + return new TBinaryColumnTupleScheme(); + } + } + + private static class TBinaryColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TBinaryColumn struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (ByteBuffer _iter170 : struct.values) + { + oprot.writeBinary(_iter170); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TBinaryColumn struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list171 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.values = new ArrayList(_list171.size); + for (int _i172 = 0; _i172 < _list171.size; ++_i172) + { + ByteBuffer _elem173; // required + _elem173 = iprot.readBinary(); + struct.values.add(_elem173); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TBoolColumn.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TBoolColumn.java new file mode 100644 index 0000000..e3d08d5 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TBoolColumn.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TBoolColumn implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TBoolColumn"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TBoolColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TBoolColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TBoolColumn.class, metaDataMap); + } + + public TBoolColumn() { + } + + public TBoolColumn( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TBoolColumn(TBoolColumn other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (Boolean other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TBoolColumn deepCopy() { + return new TBoolColumn(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(boolean elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TBoolColumn) + return this.equals((TBoolColumn)that); + return false; + } + + public boolean equals(TBoolColumn that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TBoolColumn other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TBoolColumn typedOther = (TBoolColumn)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TBoolColumn("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TBoolColumnStandardSchemeFactory implements SchemeFactory { + public TBoolColumnStandardScheme getScheme() { + return new TBoolColumnStandardScheme(); + } + } + + private static class TBoolColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TBoolColumn struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); + struct.values = new ArrayList(_list110.size); + for (int _i111 = 0; _i111 < _list110.size; ++_i111) + { + boolean _elem112; // required + _elem112 = iprot.readBool(); + struct.values.add(_elem112); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TBoolColumn struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.values.size())); + for (boolean _iter113 : struct.values) + { + oprot.writeBool(_iter113); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TBoolColumnTupleSchemeFactory implements SchemeFactory { + public TBoolColumnTupleScheme getScheme() { + return new TBoolColumnTupleScheme(); + } + } + + private static class TBoolColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TBoolColumn struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (boolean _iter114 : struct.values) + { + oprot.writeBool(_iter114); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TBoolColumn struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list115 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, iprot.readI32()); + struct.values = new ArrayList(_list115.size); + for (int _i116 = 0; _i116 < _list115.size; ++_i116) + { + boolean _elem117; // required + _elem117 = iprot.readBool(); + struct.values.add(_elem117); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TByteColumn.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TByteColumn.java new file mode 100644 index 0000000..eeeeff5 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TByteColumn.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TByteColumn implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TByteColumn"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TByteColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TByteColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TByteColumn.class, metaDataMap); + } + + public TByteColumn() { + } + + public TByteColumn( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TByteColumn(TByteColumn other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (Byte other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TByteColumn deepCopy() { + return new TByteColumn(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(byte elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TByteColumn) + return this.equals((TByteColumn)that); + return false; + } + + public boolean equals(TByteColumn that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TByteColumn other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TByteColumn typedOther = (TByteColumn)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TByteColumn("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TByteColumnStandardSchemeFactory implements SchemeFactory { + public TByteColumnStandardScheme getScheme() { + return new TByteColumnStandardScheme(); + } + } + + private static class TByteColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TByteColumn struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list118 = iprot.readListBegin(); + struct.values = new ArrayList(_list118.size); + for (int _i119 = 0; _i119 < _list118.size; ++_i119) + { + byte _elem120; // required + _elem120 = iprot.readByte(); + struct.values.add(_elem120); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TByteColumn struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BYTE, struct.values.size())); + for (byte _iter121 : struct.values) + { + oprot.writeByte(_iter121); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TByteColumnTupleSchemeFactory implements SchemeFactory { + public TByteColumnTupleScheme getScheme() { + return new TByteColumnTupleScheme(); + } + } + + private static class TByteColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TByteColumn struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (byte _iter122 : struct.values) + { + oprot.writeByte(_iter122); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TByteColumn struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list123 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BYTE, iprot.readI32()); + struct.values = new ArrayList(_list123.size); + for (int _i124 = 0; _i124 < _list123.size; ++_i124) + { + byte _elem125; // required + _elem125 = iprot.readByte(); + struct.values.add(_elem125); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TColumn.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TColumn.java index 310fbc3..bfe50c7 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TColumn.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TColumn.java @@ -33,23 +33,25 @@ public class TColumn extends org.apache.thrift.TUnion { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumn"); - private static final org.apache.thrift.protocol.TField BOOL_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("boolColumn", org.apache.thrift.protocol.TType.LIST, (short)1); - private static final org.apache.thrift.protocol.TField BYTE_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("byteColumn", org.apache.thrift.protocol.TType.LIST, (short)2); - private static final org.apache.thrift.protocol.TField I16_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("i16Column", org.apache.thrift.protocol.TType.LIST, (short)3); - private static final org.apache.thrift.protocol.TField I32_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("i32Column", org.apache.thrift.protocol.TType.LIST, (short)4); - private static final org.apache.thrift.protocol.TField I64_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("i64Column", org.apache.thrift.protocol.TType.LIST, (short)5); - private static final org.apache.thrift.protocol.TField DOUBLE_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("doubleColumn", org.apache.thrift.protocol.TType.LIST, (short)6); - private static final org.apache.thrift.protocol.TField STRING_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("stringColumn", org.apache.thrift.protocol.TType.LIST, (short)7); + private static final org.apache.thrift.protocol.TField BOOL_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("boolVal", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField BYTE_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("byteVal", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField I16_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("i16Val", org.apache.thrift.protocol.TType.STRUCT, (short)3); + private static final org.apache.thrift.protocol.TField I32_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("i32Val", org.apache.thrift.protocol.TType.STRUCT, (short)4); + private static final org.apache.thrift.protocol.TField I64_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("i64Val", org.apache.thrift.protocol.TType.STRUCT, (short)5); + private static final org.apache.thrift.protocol.TField DOUBLE_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("doubleVal", org.apache.thrift.protocol.TType.STRUCT, (short)6); + private static final org.apache.thrift.protocol.TField STRING_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("stringVal", org.apache.thrift.protocol.TType.STRUCT, (short)7); + private static final org.apache.thrift.protocol.TField BINARY_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryVal", org.apache.thrift.protocol.TType.STRUCT, (short)8); /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - BOOL_COLUMN((short)1, "boolColumn"), - BYTE_COLUMN((short)2, "byteColumn"), - I16_COLUMN((short)3, "i16Column"), - I32_COLUMN((short)4, "i32Column"), - I64_COLUMN((short)5, "i64Column"), - DOUBLE_COLUMN((short)6, "doubleColumn"), - STRING_COLUMN((short)7, "stringColumn"); + BOOL_VAL((short)1, "boolVal"), + BYTE_VAL((short)2, "byteVal"), + I16_VAL((short)3, "i16Val"), + I32_VAL((short)4, "i32Val"), + I64_VAL((short)5, "i64Val"), + DOUBLE_VAL((short)6, "doubleVal"), + STRING_VAL((short)7, "stringVal"), + BINARY_VAL((short)8, "binaryVal"); private static final Map byName = new HashMap(); @@ -64,20 +66,22 @@ */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // BOOL_COLUMN - return BOOL_COLUMN; - case 2: // BYTE_COLUMN - return BYTE_COLUMN; - case 3: // I16_COLUMN - return I16_COLUMN; - case 4: // I32_COLUMN - return I32_COLUMN; - case 5: // I64_COLUMN - return I64_COLUMN; - case 6: // DOUBLE_COLUMN - return DOUBLE_COLUMN; - case 7: // STRING_COLUMN - return STRING_COLUMN; + case 1: // BOOL_VAL + return BOOL_VAL; + case 2: // BYTE_VAL + return BYTE_VAL; + case 3: // I16_VAL + return I16_VAL; + case 4: // I32_VAL + return I32_VAL; + case 5: // I64_VAL + return I64_VAL; + case 6: // DOUBLE_VAL + return DOUBLE_VAL; + case 7: // STRING_VAL + return STRING_VAL; + case 8: // BINARY_VAL + return BINARY_VAL; default: return null; } @@ -120,27 +124,22 @@ public String getFieldName() { public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.BOOL_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("boolColumn", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TBoolValue.class)))); - tmpMap.put(_Fields.BYTE_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("byteColumn", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TByteValue.class)))); - tmpMap.put(_Fields.I16_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("i16Column", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TI16Value.class)))); - tmpMap.put(_Fields.I32_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("i32Column", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TI32Value.class)))); - tmpMap.put(_Fields.I64_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("i64Column", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TI64Value.class)))); - tmpMap.put(_Fields.DOUBLE_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("doubleColumn", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDoubleValue.class)))); - tmpMap.put(_Fields.STRING_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("stringColumn", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStringValue.class)))); + tmpMap.put(_Fields.BOOL_VAL, new org.apache.thrift.meta_data.FieldMetaData("boolVal", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TBoolColumn.class))); + tmpMap.put(_Fields.BYTE_VAL, new org.apache.thrift.meta_data.FieldMetaData("byteVal", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TByteColumn.class))); + tmpMap.put(_Fields.I16_VAL, new org.apache.thrift.meta_data.FieldMetaData("i16Val", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TI16Column.class))); + tmpMap.put(_Fields.I32_VAL, new org.apache.thrift.meta_data.FieldMetaData("i32Val", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TI32Column.class))); + tmpMap.put(_Fields.I64_VAL, new org.apache.thrift.meta_data.FieldMetaData("i64Val", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TI64Column.class))); + tmpMap.put(_Fields.DOUBLE_VAL, new org.apache.thrift.meta_data.FieldMetaData("doubleVal", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDoubleColumn.class))); + tmpMap.put(_Fields.STRING_VAL, new org.apache.thrift.meta_data.FieldMetaData("stringVal", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStringColumn.class))); + tmpMap.put(_Fields.BINARY_VAL, new org.apache.thrift.meta_data.FieldMetaData("binaryVal", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TBinaryColumn.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TColumn.class, metaDataMap); } @@ -160,45 +159,51 @@ public TColumn deepCopy() { return new TColumn(this); } - public static TColumn boolColumn(List value) { + public static TColumn boolVal(TBoolColumn value) { TColumn x = new TColumn(); - x.setBoolColumn(value); + x.setBoolVal(value); return x; } - public static TColumn byteColumn(List value) { + public static TColumn byteVal(TByteColumn value) { TColumn x = new TColumn(); - x.setByteColumn(value); + x.setByteVal(value); return x; } - public static TColumn i16Column(List value) { + public static TColumn i16Val(TI16Column value) { TColumn x = new TColumn(); - x.setI16Column(value); + x.setI16Val(value); return x; } - public static TColumn i32Column(List value) { + public static TColumn i32Val(TI32Column value) { TColumn x = new TColumn(); - x.setI32Column(value); + x.setI32Val(value); return x; } - public static TColumn i64Column(List value) { + public static TColumn i64Val(TI64Column value) { TColumn x = new TColumn(); - x.setI64Column(value); + x.setI64Val(value); return x; } - public static TColumn doubleColumn(List value) { + public static TColumn doubleVal(TDoubleColumn value) { TColumn x = new TColumn(); - x.setDoubleColumn(value); + x.setDoubleVal(value); return x; } - public static TColumn stringColumn(List value) { + public static TColumn stringVal(TStringColumn value) { TColumn x = new TColumn(); - x.setStringColumn(value); + x.setStringVal(value); + return x; + } + + public static TColumn binaryVal(TBinaryColumn value) { + TColumn x = new TColumn(); + x.setBinaryVal(value); return x; } @@ -206,41 +211,46 @@ public static TColumn stringColumn(List value) { @Override protected void checkType(_Fields setField, Object value) throws ClassCastException { switch (setField) { - case BOOL_COLUMN: - if (value instanceof List) { + case BOOL_VAL: + if (value instanceof TBoolColumn) { break; } - throw new ClassCastException("Was expecting value of type List for field 'boolColumn', but got " + value.getClass().getSimpleName()); - case BYTE_COLUMN: - if (value instanceof List) { + throw new ClassCastException("Was expecting value of type TBoolColumn for field 'boolVal', but got " + value.getClass().getSimpleName()); + case BYTE_VAL: + if (value instanceof TByteColumn) { break; } - throw new ClassCastException("Was expecting value of type List for field 'byteColumn', but got " + value.getClass().getSimpleName()); - case I16_COLUMN: - if (value instanceof List) { + throw new ClassCastException("Was expecting value of type TByteColumn for field 'byteVal', but got " + value.getClass().getSimpleName()); + case I16_VAL: + if (value instanceof TI16Column) { break; } - throw new ClassCastException("Was expecting value of type List for field 'i16Column', but got " + value.getClass().getSimpleName()); - case I32_COLUMN: - if (value instanceof List) { + throw new ClassCastException("Was expecting value of type TI16Column for field 'i16Val', but got " + value.getClass().getSimpleName()); + case I32_VAL: + if (value instanceof TI32Column) { break; } - throw new ClassCastException("Was expecting value of type List for field 'i32Column', but got " + value.getClass().getSimpleName()); - case I64_COLUMN: - if (value instanceof List) { + throw new ClassCastException("Was expecting value of type TI32Column for field 'i32Val', but got " + value.getClass().getSimpleName()); + case I64_VAL: + if (value instanceof TI64Column) { break; } - throw new ClassCastException("Was expecting value of type List for field 'i64Column', but got " + value.getClass().getSimpleName()); - case DOUBLE_COLUMN: - if (value instanceof List) { + throw new ClassCastException("Was expecting value of type TI64Column for field 'i64Val', but got " + value.getClass().getSimpleName()); + case DOUBLE_VAL: + if (value instanceof TDoubleColumn) { break; } - throw new ClassCastException("Was expecting value of type List for field 'doubleColumn', but got " + value.getClass().getSimpleName()); - case STRING_COLUMN: - if (value instanceof List) { + throw new ClassCastException("Was expecting value of type TDoubleColumn for field 'doubleVal', but got " + value.getClass().getSimpleName()); + case STRING_VAL: + if (value instanceof TStringColumn) { break; } - throw new ClassCastException("Was expecting value of type List for field 'stringColumn', but got " + value.getClass().getSimpleName()); + throw new ClassCastException("Was expecting value of type TStringColumn for field 'stringVal', but got " + value.getClass().getSimpleName()); + case BINARY_VAL: + if (value instanceof TBinaryColumn) { + break; + } + throw new ClassCastException("Was expecting value of type TBinaryColumn for field 'binaryVal', but got " + value.getClass().getSimpleName()); default: throw new IllegalArgumentException("Unknown field id " + setField); } @@ -251,142 +261,82 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip _Fields setField = _Fields.findByThriftId(field.id); if (setField != null) { switch (setField) { - case BOOL_COLUMN: - if (field.type == BOOL_COLUMN_FIELD_DESC.type) { - List boolColumn; - { - org.apache.thrift.protocol.TList _list46 = iprot.readListBegin(); - boolColumn = new ArrayList(_list46.size); - for (int _i47 = 0; _i47 < _list46.size; ++_i47) - { - TBoolValue _elem48; // required - _elem48 = new TBoolValue(); - _elem48.read(iprot); - boolColumn.add(_elem48); - } - iprot.readListEnd(); - } - return boolColumn; + case BOOL_VAL: + if (field.type == BOOL_VAL_FIELD_DESC.type) { + TBoolColumn boolVal; + boolVal = new TBoolColumn(); + boolVal.read(iprot); + return boolVal; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } - case BYTE_COLUMN: - if (field.type == BYTE_COLUMN_FIELD_DESC.type) { - List byteColumn; - { - org.apache.thrift.protocol.TList _list49 = iprot.readListBegin(); - byteColumn = new ArrayList(_list49.size); - for (int _i50 = 0; _i50 < _list49.size; ++_i50) - { - TByteValue _elem51; // required - _elem51 = new TByteValue(); - _elem51.read(iprot); - byteColumn.add(_elem51); - } - iprot.readListEnd(); - } - return byteColumn; + case BYTE_VAL: + if (field.type == BYTE_VAL_FIELD_DESC.type) { + TByteColumn byteVal; + byteVal = new TByteColumn(); + byteVal.read(iprot); + return byteVal; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } - case I16_COLUMN: - if (field.type == I16_COLUMN_FIELD_DESC.type) { - List i16Column; - { - org.apache.thrift.protocol.TList _list52 = iprot.readListBegin(); - i16Column = new ArrayList(_list52.size); - for (int _i53 = 0; _i53 < _list52.size; ++_i53) - { - TI16Value _elem54; // required - _elem54 = new TI16Value(); - _elem54.read(iprot); - i16Column.add(_elem54); - } - iprot.readListEnd(); - } - return i16Column; + case I16_VAL: + if (field.type == I16_VAL_FIELD_DESC.type) { + TI16Column i16Val; + i16Val = new TI16Column(); + i16Val.read(iprot); + return i16Val; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } - case I32_COLUMN: - if (field.type == I32_COLUMN_FIELD_DESC.type) { - List i32Column; - { - org.apache.thrift.protocol.TList _list55 = iprot.readListBegin(); - i32Column = new ArrayList(_list55.size); - for (int _i56 = 0; _i56 < _list55.size; ++_i56) - { - TI32Value _elem57; // required - _elem57 = new TI32Value(); - _elem57.read(iprot); - i32Column.add(_elem57); - } - iprot.readListEnd(); - } - return i32Column; + case I32_VAL: + if (field.type == I32_VAL_FIELD_DESC.type) { + TI32Column i32Val; + i32Val = new TI32Column(); + i32Val.read(iprot); + return i32Val; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } - case I64_COLUMN: - if (field.type == I64_COLUMN_FIELD_DESC.type) { - List i64Column; - { - org.apache.thrift.protocol.TList _list58 = iprot.readListBegin(); - i64Column = new ArrayList(_list58.size); - for (int _i59 = 0; _i59 < _list58.size; ++_i59) - { - TI64Value _elem60; // required - _elem60 = new TI64Value(); - _elem60.read(iprot); - i64Column.add(_elem60); - } - iprot.readListEnd(); - } - return i64Column; + case I64_VAL: + if (field.type == I64_VAL_FIELD_DESC.type) { + TI64Column i64Val; + i64Val = new TI64Column(); + i64Val.read(iprot); + return i64Val; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } - case DOUBLE_COLUMN: - if (field.type == DOUBLE_COLUMN_FIELD_DESC.type) { - List doubleColumn; - { - org.apache.thrift.protocol.TList _list61 = iprot.readListBegin(); - doubleColumn = new ArrayList(_list61.size); - for (int _i62 = 0; _i62 < _list61.size; ++_i62) - { - TDoubleValue _elem63; // required - _elem63 = new TDoubleValue(); - _elem63.read(iprot); - doubleColumn.add(_elem63); - } - iprot.readListEnd(); - } - return doubleColumn; + case DOUBLE_VAL: + if (field.type == DOUBLE_VAL_FIELD_DESC.type) { + TDoubleColumn doubleVal; + doubleVal = new TDoubleColumn(); + doubleVal.read(iprot); + return doubleVal; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } - case STRING_COLUMN: - if (field.type == STRING_COLUMN_FIELD_DESC.type) { - List stringColumn; - { - org.apache.thrift.protocol.TList _list64 = iprot.readListBegin(); - stringColumn = new ArrayList(_list64.size); - for (int _i65 = 0; _i65 < _list64.size; ++_i65) - { - TStringValue _elem66; // required - _elem66 = new TStringValue(); - _elem66.read(iprot); - stringColumn.add(_elem66); - } - iprot.readListEnd(); - } - return stringColumn; + case STRING_VAL: + if (field.type == STRING_VAL_FIELD_DESC.type) { + TStringColumn stringVal; + stringVal = new TStringColumn(); + stringVal.read(iprot); + return stringVal; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + case BINARY_VAL: + if (field.type == BINARY_VAL_FIELD_DESC.type) { + TBinaryColumn binaryVal; + binaryVal = new TBinaryColumn(); + binaryVal.read(iprot); + return binaryVal; } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; @@ -402,82 +352,37 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip @Override protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { - case BOOL_COLUMN: - List boolColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, boolColumn.size())); - for (TBoolValue _iter67 : boolColumn) - { - _iter67.write(oprot); - } - oprot.writeListEnd(); - } + case BOOL_VAL: + TBoolColumn boolVal = (TBoolColumn)value_; + boolVal.write(oprot); return; - case BYTE_COLUMN: - List byteColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, byteColumn.size())); - for (TByteValue _iter68 : byteColumn) - { - _iter68.write(oprot); - } - oprot.writeListEnd(); - } + case BYTE_VAL: + TByteColumn byteVal = (TByteColumn)value_; + byteVal.write(oprot); return; - case I16_COLUMN: - List i16Column = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, i16Column.size())); - for (TI16Value _iter69 : i16Column) - { - _iter69.write(oprot); - } - oprot.writeListEnd(); - } + case I16_VAL: + TI16Column i16Val = (TI16Column)value_; + i16Val.write(oprot); return; - case I32_COLUMN: - List i32Column = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, i32Column.size())); - for (TI32Value _iter70 : i32Column) - { - _iter70.write(oprot); - } - oprot.writeListEnd(); - } + case I32_VAL: + TI32Column i32Val = (TI32Column)value_; + i32Val.write(oprot); return; - case I64_COLUMN: - List i64Column = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, i64Column.size())); - for (TI64Value _iter71 : i64Column) - { - _iter71.write(oprot); - } - oprot.writeListEnd(); - } + case I64_VAL: + TI64Column i64Val = (TI64Column)value_; + i64Val.write(oprot); return; - case DOUBLE_COLUMN: - List doubleColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, doubleColumn.size())); - for (TDoubleValue _iter72 : doubleColumn) - { - _iter72.write(oprot); - } - oprot.writeListEnd(); - } + case DOUBLE_VAL: + TDoubleColumn doubleVal = (TDoubleColumn)value_; + doubleVal.write(oprot); return; - case STRING_COLUMN: - List stringColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, stringColumn.size())); - for (TStringValue _iter73 : stringColumn) - { - _iter73.write(oprot); - } - oprot.writeListEnd(); - } + case STRING_VAL: + TStringColumn stringVal = (TStringColumn)value_; + stringVal.write(oprot); + return; + case BINARY_VAL: + TBinaryColumn binaryVal = (TBinaryColumn)value_; + binaryVal.write(oprot); return; default: throw new IllegalStateException("Cannot write union with unknown field " + setField_); @@ -489,111 +394,46 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot _Fields setField = _Fields.findByThriftId(fieldID); if (setField != null) { switch (setField) { - case BOOL_COLUMN: - List boolColumn; - { - org.apache.thrift.protocol.TList _list74 = iprot.readListBegin(); - boolColumn = new ArrayList(_list74.size); - for (int _i75 = 0; _i75 < _list74.size; ++_i75) - { - TBoolValue _elem76; // required - _elem76 = new TBoolValue(); - _elem76.read(iprot); - boolColumn.add(_elem76); - } - iprot.readListEnd(); - } - return boolColumn; - case BYTE_COLUMN: - List byteColumn; - { - org.apache.thrift.protocol.TList _list77 = iprot.readListBegin(); - byteColumn = new ArrayList(_list77.size); - for (int _i78 = 0; _i78 < _list77.size; ++_i78) - { - TByteValue _elem79; // required - _elem79 = new TByteValue(); - _elem79.read(iprot); - byteColumn.add(_elem79); - } - iprot.readListEnd(); - } - return byteColumn; - case I16_COLUMN: - List i16Column; - { - org.apache.thrift.protocol.TList _list80 = iprot.readListBegin(); - i16Column = new ArrayList(_list80.size); - for (int _i81 = 0; _i81 < _list80.size; ++_i81) - { - TI16Value _elem82; // required - _elem82 = new TI16Value(); - _elem82.read(iprot); - i16Column.add(_elem82); - } - iprot.readListEnd(); - } - return i16Column; - case I32_COLUMN: - List i32Column; - { - org.apache.thrift.protocol.TList _list83 = iprot.readListBegin(); - i32Column = new ArrayList(_list83.size); - for (int _i84 = 0; _i84 < _list83.size; ++_i84) - { - TI32Value _elem85; // required - _elem85 = new TI32Value(); - _elem85.read(iprot); - i32Column.add(_elem85); - } - iprot.readListEnd(); - } - return i32Column; - case I64_COLUMN: - List i64Column; - { - org.apache.thrift.protocol.TList _list86 = iprot.readListBegin(); - i64Column = new ArrayList(_list86.size); - for (int _i87 = 0; _i87 < _list86.size; ++_i87) - { - TI64Value _elem88; // required - _elem88 = new TI64Value(); - _elem88.read(iprot); - i64Column.add(_elem88); - } - iprot.readListEnd(); - } - return i64Column; - case DOUBLE_COLUMN: - List doubleColumn; - { - org.apache.thrift.protocol.TList _list89 = iprot.readListBegin(); - doubleColumn = new ArrayList(_list89.size); - for (int _i90 = 0; _i90 < _list89.size; ++_i90) - { - TDoubleValue _elem91; // required - _elem91 = new TDoubleValue(); - _elem91.read(iprot); - doubleColumn.add(_elem91); - } - iprot.readListEnd(); - } - return doubleColumn; - case STRING_COLUMN: - List stringColumn; - { - org.apache.thrift.protocol.TList _list92 = iprot.readListBegin(); - stringColumn = new ArrayList(_list92.size); - for (int _i93 = 0; _i93 < _list92.size; ++_i93) - { - TStringValue _elem94; // required - _elem94 = new TStringValue(); - _elem94.read(iprot); - stringColumn.add(_elem94); - } - iprot.readListEnd(); - } - return stringColumn; + case BOOL_VAL: + TBoolColumn boolVal; + boolVal = new TBoolColumn(); + boolVal.read(iprot); + return boolVal; + case BYTE_VAL: + TByteColumn byteVal; + byteVal = new TByteColumn(); + byteVal.read(iprot); + return byteVal; + case I16_VAL: + TI16Column i16Val; + i16Val = new TI16Column(); + i16Val.read(iprot); + return i16Val; + case I32_VAL: + TI32Column i32Val; + i32Val = new TI32Column(); + i32Val.read(iprot); + return i32Val; + case I64_VAL: + TI64Column i64Val; + i64Val = new TI64Column(); + i64Val.read(iprot); + return i64Val; + case DOUBLE_VAL: + TDoubleColumn doubleVal; + doubleVal = new TDoubleColumn(); + doubleVal.read(iprot); + return doubleVal; + case STRING_VAL: + TStringColumn stringVal; + stringVal = new TStringColumn(); + stringVal.read(iprot); + return stringVal; + case BINARY_VAL: + TBinaryColumn binaryVal; + binaryVal = new TBinaryColumn(); + binaryVal.read(iprot); + return binaryVal; default: throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); } @@ -605,82 +445,37 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot @Override protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { - case BOOL_COLUMN: - List boolColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, boolColumn.size())); - for (TBoolValue _iter95 : boolColumn) - { - _iter95.write(oprot); - } - oprot.writeListEnd(); - } + case BOOL_VAL: + TBoolColumn boolVal = (TBoolColumn)value_; + boolVal.write(oprot); return; - case BYTE_COLUMN: - List byteColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, byteColumn.size())); - for (TByteValue _iter96 : byteColumn) - { - _iter96.write(oprot); - } - oprot.writeListEnd(); - } + case BYTE_VAL: + TByteColumn byteVal = (TByteColumn)value_; + byteVal.write(oprot); return; - case I16_COLUMN: - List i16Column = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, i16Column.size())); - for (TI16Value _iter97 : i16Column) - { - _iter97.write(oprot); - } - oprot.writeListEnd(); - } + case I16_VAL: + TI16Column i16Val = (TI16Column)value_; + i16Val.write(oprot); return; - case I32_COLUMN: - List i32Column = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, i32Column.size())); - for (TI32Value _iter98 : i32Column) - { - _iter98.write(oprot); - } - oprot.writeListEnd(); - } + case I32_VAL: + TI32Column i32Val = (TI32Column)value_; + i32Val.write(oprot); return; - case I64_COLUMN: - List i64Column = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, i64Column.size())); - for (TI64Value _iter99 : i64Column) - { - _iter99.write(oprot); - } - oprot.writeListEnd(); - } + case I64_VAL: + TI64Column i64Val = (TI64Column)value_; + i64Val.write(oprot); return; - case DOUBLE_COLUMN: - List doubleColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, doubleColumn.size())); - for (TDoubleValue _iter100 : doubleColumn) - { - _iter100.write(oprot); - } - oprot.writeListEnd(); - } + case DOUBLE_VAL: + TDoubleColumn doubleVal = (TDoubleColumn)value_; + doubleVal.write(oprot); return; - case STRING_COLUMN: - List stringColumn = (List)value_; - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, stringColumn.size())); - for (TStringValue _iter101 : stringColumn) - { - _iter101.write(oprot); - } - oprot.writeListEnd(); - } + case STRING_VAL: + TStringColumn stringVal = (TStringColumn)value_; + stringVal.write(oprot); + return; + case BINARY_VAL: + TBinaryColumn binaryVal = (TBinaryColumn)value_; + binaryVal.write(oprot); return; default: throw new IllegalStateException("Cannot write union with unknown field " + setField_); @@ -690,20 +485,22 @@ protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) @Override protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) { switch (setField) { - case BOOL_COLUMN: - return BOOL_COLUMN_FIELD_DESC; - case BYTE_COLUMN: - return BYTE_COLUMN_FIELD_DESC; - case I16_COLUMN: - return I16_COLUMN_FIELD_DESC; - case I32_COLUMN: - return I32_COLUMN_FIELD_DESC; - case I64_COLUMN: - return I64_COLUMN_FIELD_DESC; - case DOUBLE_COLUMN: - return DOUBLE_COLUMN_FIELD_DESC; - case STRING_COLUMN: - return STRING_COLUMN_FIELD_DESC; + case BOOL_VAL: + return BOOL_VAL_FIELD_DESC; + case BYTE_VAL: + return BYTE_VAL_FIELD_DESC; + case I16_VAL: + return I16_VAL_FIELD_DESC; + case I32_VAL: + return I32_VAL_FIELD_DESC; + case I64_VAL: + return I64_VAL_FIELD_DESC; + case DOUBLE_VAL: + return DOUBLE_VAL_FIELD_DESC; + case STRING_VAL: + return STRING_VAL_FIELD_DESC; + case BINARY_VAL: + return BINARY_VAL_FIELD_DESC; default: throw new IllegalArgumentException("Unknown field id " + setField); } @@ -724,136 +521,155 @@ public _Fields fieldForId(int fieldId) { } - public List getBoolColumn() { - if (getSetField() == _Fields.BOOL_COLUMN) { - return (List)getFieldValue(); + public TBoolColumn getBoolVal() { + if (getSetField() == _Fields.BOOL_VAL) { + return (TBoolColumn)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'boolVal' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setBoolVal(TBoolColumn value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.BOOL_VAL; + value_ = value; + } + + public TByteColumn getByteVal() { + if (getSetField() == _Fields.BYTE_VAL) { + return (TByteColumn)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'boolColumn' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'byteVal' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setBoolColumn(List value) { + public void setByteVal(TByteColumn value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.BOOL_COLUMN; + setField_ = _Fields.BYTE_VAL; value_ = value; } - public List getByteColumn() { - if (getSetField() == _Fields.BYTE_COLUMN) { - return (List)getFieldValue(); + public TI16Column getI16Val() { + if (getSetField() == _Fields.I16_VAL) { + return (TI16Column)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'byteColumn' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'i16Val' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setByteColumn(List value) { + public void setI16Val(TI16Column value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.BYTE_COLUMN; + setField_ = _Fields.I16_VAL; value_ = value; } - public List getI16Column() { - if (getSetField() == _Fields.I16_COLUMN) { - return (List)getFieldValue(); + public TI32Column getI32Val() { + if (getSetField() == _Fields.I32_VAL) { + return (TI32Column)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'i16Column' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'i32Val' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setI16Column(List value) { + public void setI32Val(TI32Column value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.I16_COLUMN; + setField_ = _Fields.I32_VAL; value_ = value; } - public List getI32Column() { - if (getSetField() == _Fields.I32_COLUMN) { - return (List)getFieldValue(); + public TI64Column getI64Val() { + if (getSetField() == _Fields.I64_VAL) { + return (TI64Column)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'i32Column' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'i64Val' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setI32Column(List value) { + public void setI64Val(TI64Column value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.I32_COLUMN; + setField_ = _Fields.I64_VAL; value_ = value; } - public List getI64Column() { - if (getSetField() == _Fields.I64_COLUMN) { - return (List)getFieldValue(); + public TDoubleColumn getDoubleVal() { + if (getSetField() == _Fields.DOUBLE_VAL) { + return (TDoubleColumn)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'i64Column' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'doubleVal' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setI64Column(List value) { + public void setDoubleVal(TDoubleColumn value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.I64_COLUMN; + setField_ = _Fields.DOUBLE_VAL; value_ = value; } - public List getDoubleColumn() { - if (getSetField() == _Fields.DOUBLE_COLUMN) { - return (List)getFieldValue(); + public TStringColumn getStringVal() { + if (getSetField() == _Fields.STRING_VAL) { + return (TStringColumn)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'doubleColumn' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'stringVal' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setDoubleColumn(List value) { + public void setStringVal(TStringColumn value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.DOUBLE_COLUMN; + setField_ = _Fields.STRING_VAL; value_ = value; } - public List getStringColumn() { - if (getSetField() == _Fields.STRING_COLUMN) { - return (List)getFieldValue(); + public TBinaryColumn getBinaryVal() { + if (getSetField() == _Fields.BINARY_VAL) { + return (TBinaryColumn)getFieldValue(); } else { - throw new RuntimeException("Cannot get field 'stringColumn' because union is currently set to " + getFieldDesc(getSetField()).name); + throw new RuntimeException("Cannot get field 'binaryVal' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setStringColumn(List value) { + public void setBinaryVal(TBinaryColumn value) { if (value == null) throw new NullPointerException(); - setField_ = _Fields.STRING_COLUMN; + setField_ = _Fields.BINARY_VAL; value_ = value; } - public boolean isSetBoolColumn() { - return setField_ == _Fields.BOOL_COLUMN; + public boolean isSetBoolVal() { + return setField_ == _Fields.BOOL_VAL; + } + + + public boolean isSetByteVal() { + return setField_ == _Fields.BYTE_VAL; } - public boolean isSetByteColumn() { - return setField_ == _Fields.BYTE_COLUMN; + public boolean isSetI16Val() { + return setField_ == _Fields.I16_VAL; } - public boolean isSetI16Column() { - return setField_ == _Fields.I16_COLUMN; + public boolean isSetI32Val() { + return setField_ == _Fields.I32_VAL; } - public boolean isSetI32Column() { - return setField_ == _Fields.I32_COLUMN; + public boolean isSetI64Val() { + return setField_ == _Fields.I64_VAL; } - public boolean isSetI64Column() { - return setField_ == _Fields.I64_COLUMN; + public boolean isSetDoubleVal() { + return setField_ == _Fields.DOUBLE_VAL; } - public boolean isSetDoubleColumn() { - return setField_ == _Fields.DOUBLE_COLUMN; + public boolean isSetStringVal() { + return setField_ == _Fields.STRING_VAL; } - public boolean isSetStringColumn() { - return setField_ == _Fields.STRING_COLUMN; + public boolean isSetBinaryVal() { + return setField_ == _Fields.BINARY_VAL; } diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TDoubleColumn.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TDoubleColumn.java new file mode 100644 index 0000000..a1aab11 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TDoubleColumn.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TDoubleColumn implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDoubleColumn"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TDoubleColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TDoubleColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDoubleColumn.class, metaDataMap); + } + + public TDoubleColumn() { + } + + public TDoubleColumn( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TDoubleColumn(TDoubleColumn other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (Double other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TDoubleColumn deepCopy() { + return new TDoubleColumn(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(double elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TDoubleColumn) + return this.equals((TDoubleColumn)that); + return false; + } + + public boolean equals(TDoubleColumn that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TDoubleColumn other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TDoubleColumn typedOther = (TDoubleColumn)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TDoubleColumn("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TDoubleColumnStandardSchemeFactory implements SchemeFactory { + public TDoubleColumnStandardScheme getScheme() { + return new TDoubleColumnStandardScheme(); + } + } + + private static class TDoubleColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TDoubleColumn struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list150 = iprot.readListBegin(); + struct.values = new ArrayList(_list150.size); + for (int _i151 = 0; _i151 < _list150.size; ++_i151) + { + double _elem152; // required + _elem152 = iprot.readDouble(); + struct.values.add(_elem152); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TDoubleColumn struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE, struct.values.size())); + for (double _iter153 : struct.values) + { + oprot.writeDouble(_iter153); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TDoubleColumnTupleSchemeFactory implements SchemeFactory { + public TDoubleColumnTupleScheme getScheme() { + return new TDoubleColumnTupleScheme(); + } + } + + private static class TDoubleColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TDoubleColumn struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (double _iter154 : struct.values) + { + oprot.writeDouble(_iter154); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TDoubleColumn struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list155 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE, iprot.readI32()); + struct.values = new ArrayList(_list155.size); + for (int _i156 = 0; _i156 < _list155.size; ++_i156) + { + double _elem157; // required + _elem157 = iprot.readDouble(); + struct.values.add(_elem157); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java index ea656ac..4cb9a55 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TExecuteStatementReq.java @@ -624,15 +624,15 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TExecuteStatementRe case 3: // CONF_OVERLAY if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map154 = iprot.readMapBegin(); - struct.confOverlay = new HashMap(2*_map154.size); - for (int _i155 = 0; _i155 < _map154.size; ++_i155) + org.apache.thrift.protocol.TMap _map218 = iprot.readMapBegin(); + struct.confOverlay = new HashMap(2*_map218.size); + for (int _i219 = 0; _i219 < _map218.size; ++_i219) { - String _key156; // required - String _val157; // required - _key156 = iprot.readString(); - _val157 = iprot.readString(); - struct.confOverlay.put(_key156, _val157); + String _key220; // required + String _val221; // required + _key220 = iprot.readString(); + _val221 = iprot.readString(); + struct.confOverlay.put(_key220, _val221); } iprot.readMapEnd(); } @@ -677,10 +677,10 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TExecuteStatementR oprot.writeFieldBegin(CONF_OVERLAY_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.confOverlay.size())); - for (Map.Entry _iter158 : struct.confOverlay.entrySet()) + for (Map.Entry _iter222 : struct.confOverlay.entrySet()) { - oprot.writeString(_iter158.getKey()); - oprot.writeString(_iter158.getValue()); + oprot.writeString(_iter222.getKey()); + oprot.writeString(_iter222.getValue()); } oprot.writeMapEnd(); } @@ -722,10 +722,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TExecuteStatementRe if (struct.isSetConfOverlay()) { { oprot.writeI32(struct.confOverlay.size()); - for (Map.Entry _iter159 : struct.confOverlay.entrySet()) + for (Map.Entry _iter223 : struct.confOverlay.entrySet()) { - oprot.writeString(_iter159.getKey()); - oprot.writeString(_iter159.getValue()); + oprot.writeString(_iter223.getKey()); + oprot.writeString(_iter223.getValue()); } } } @@ -745,15 +745,15 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TExecuteStatementReq BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map160 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.confOverlay = new HashMap(2*_map160.size); - for (int _i161 = 0; _i161 < _map160.size; ++_i161) + org.apache.thrift.protocol.TMap _map224 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.confOverlay = new HashMap(2*_map224.size); + for (int _i225 = 0; _i225 < _map224.size; ++_i225) { - String _key162; // required - String _val163; // required - _key162 = iprot.readString(); - _val163 = iprot.readString(); - struct.confOverlay.put(_key162, _val163); + String _key226; // required + String _val227; // required + _key226 = iprot.readString(); + _val227 = iprot.readString(); + struct.confOverlay.put(_key226, _val227); } } struct.setConfOverlayIsSet(true); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetTablesReq.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetTablesReq.java index dfd62ab..dad2008 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetTablesReq.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetTablesReq.java @@ -711,13 +711,13 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TGetTablesReq struc case 5: // TABLE_TYPES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list164 = iprot.readListBegin(); - struct.tableTypes = new ArrayList(_list164.size); - for (int _i165 = 0; _i165 < _list164.size; ++_i165) + org.apache.thrift.protocol.TList _list228 = iprot.readListBegin(); + struct.tableTypes = new ArrayList(_list228.size); + for (int _i229 = 0; _i229 < _list228.size; ++_i229) { - String _elem166; // required - _elem166 = iprot.readString(); - struct.tableTypes.add(_elem166); + String _elem230; // required + _elem230 = iprot.readString(); + struct.tableTypes.add(_elem230); } iprot.readListEnd(); } @@ -770,9 +770,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TGetTablesReq stru oprot.writeFieldBegin(TABLE_TYPES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.tableTypes.size())); - for (String _iter167 : struct.tableTypes) + for (String _iter231 : struct.tableTypes) { - oprot.writeString(_iter167); + oprot.writeString(_iter231); } oprot.writeListEnd(); } @@ -823,9 +823,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TGetTablesReq struc if (struct.isSetTableTypes()) { { oprot.writeI32(struct.tableTypes.size()); - for (String _iter168 : struct.tableTypes) + for (String _iter232 : struct.tableTypes) { - oprot.writeString(_iter168); + oprot.writeString(_iter232); } } } @@ -852,13 +852,13 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TGetTablesReq struct } if (incoming.get(3)) { { - org.apache.thrift.protocol.TList _list169 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.tableTypes = new ArrayList(_list169.size); - for (int _i170 = 0; _i170 < _list169.size; ++_i170) + org.apache.thrift.protocol.TList _list233 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.tableTypes = new ArrayList(_list233.size); + for (int _i234 = 0; _i234 < _list233.size; ++_i234) { - String _elem171; // required - _elem171 = iprot.readString(); - struct.tableTypes.add(_elem171); + String _elem235; // required + _elem235 = iprot.readString(); + struct.tableTypes.add(_elem235); } } struct.setTableTypesIsSet(true); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI16Column.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI16Column.java new file mode 100644 index 0000000..7ec49b3 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI16Column.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TI16Column implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TI16Column"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TI16ColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TI16ColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TI16Column.class, metaDataMap); + } + + public TI16Column() { + } + + public TI16Column( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TI16Column(TI16Column other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (Short other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TI16Column deepCopy() { + return new TI16Column(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(short elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TI16Column) + return this.equals((TI16Column)that); + return false; + } + + public boolean equals(TI16Column that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TI16Column other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TI16Column typedOther = (TI16Column)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TI16Column("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TI16ColumnStandardSchemeFactory implements SchemeFactory { + public TI16ColumnStandardScheme getScheme() { + return new TI16ColumnStandardScheme(); + } + } + + private static class TI16ColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TI16Column struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(); + struct.values = new ArrayList(_list126.size); + for (int _i127 = 0; _i127 < _list126.size; ++_i127) + { + short _elem128; // required + _elem128 = iprot.readI16(); + struct.values.add(_elem128); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TI16Column struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I16, struct.values.size())); + for (short _iter129 : struct.values) + { + oprot.writeI16(_iter129); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TI16ColumnTupleSchemeFactory implements SchemeFactory { + public TI16ColumnTupleScheme getScheme() { + return new TI16ColumnTupleScheme(); + } + } + + private static class TI16ColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TI16Column struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (short _iter130 : struct.values) + { + oprot.writeI16(_iter130); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TI16Column struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I16, iprot.readI32()); + struct.values = new ArrayList(_list131.size); + for (int _i132 = 0; _i132 < _list131.size; ++_i132) + { + short _elem133; // required + _elem133 = iprot.readI16(); + struct.values.add(_elem133); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI32Column.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI32Column.java new file mode 100644 index 0000000..d774ba4 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI32Column.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TI32Column implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TI32Column"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TI32ColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TI32ColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TI32Column.class, metaDataMap); + } + + public TI32Column() { + } + + public TI32Column( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TI32Column(TI32Column other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (Integer other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TI32Column deepCopy() { + return new TI32Column(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(int elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TI32Column) + return this.equals((TI32Column)that); + return false; + } + + public boolean equals(TI32Column that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TI32Column other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TI32Column typedOther = (TI32Column)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TI32Column("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TI32ColumnStandardSchemeFactory implements SchemeFactory { + public TI32ColumnStandardScheme getScheme() { + return new TI32ColumnStandardScheme(); + } + } + + private static class TI32ColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TI32Column struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list134 = iprot.readListBegin(); + struct.values = new ArrayList(_list134.size); + for (int _i135 = 0; _i135 < _list134.size; ++_i135) + { + int _elem136; // required + _elem136 = iprot.readI32(); + struct.values.add(_elem136); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TI32Column struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.values.size())); + for (int _iter137 : struct.values) + { + oprot.writeI32(_iter137); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TI32ColumnTupleSchemeFactory implements SchemeFactory { + public TI32ColumnTupleScheme getScheme() { + return new TI32ColumnTupleScheme(); + } + } + + private static class TI32ColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TI32Column struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (int _iter138 : struct.values) + { + oprot.writeI32(_iter138); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TI32Column struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list139 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32()); + struct.values = new ArrayList(_list139.size); + for (int _i140 = 0; _i140 < _list139.size; ++_i140) + { + int _elem141; // required + _elem141 = iprot.readI32(); + struct.values.add(_elem141); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI64Column.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI64Column.java new file mode 100644 index 0000000..a819658 --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TI64Column.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TI64Column implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TI64Column"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TI64ColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TI64ColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TI64Column.class, metaDataMap); + } + + public TI64Column() { + } + + public TI64Column( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TI64Column(TI64Column other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (Long other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TI64Column deepCopy() { + return new TI64Column(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(long elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TI64Column) + return this.equals((TI64Column)that); + return false; + } + + public boolean equals(TI64Column that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TI64Column other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TI64Column typedOther = (TI64Column)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TI64Column("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TI64ColumnStandardSchemeFactory implements SchemeFactory { + public TI64ColumnStandardScheme getScheme() { + return new TI64ColumnStandardScheme(); + } + } + + private static class TI64ColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TI64Column struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list142 = iprot.readListBegin(); + struct.values = new ArrayList(_list142.size); + for (int _i143 = 0; _i143 < _list142.size; ++_i143) + { + long _elem144; // required + _elem144 = iprot.readI64(); + struct.values.add(_elem144); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TI64Column struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.values.size())); + for (long _iter145 : struct.values) + { + oprot.writeI64(_iter145); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TI64ColumnTupleSchemeFactory implements SchemeFactory { + public TI64ColumnTupleScheme getScheme() { + return new TI64ColumnTupleScheme(); + } + } + + private static class TI64ColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TI64Column struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (long _iter146 : struct.values) + { + oprot.writeI64(_iter146); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TI64Column struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list147 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32()); + struct.values = new ArrayList(_list147.size); + for (int _i148 = 0; _i148 < _list147.size; ++_i148) + { + long _elem149; // required + _elem149 = iprot.readI64(); + struct.values.add(_elem149); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java index ed335b1..859196b 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionReq.java @@ -141,7 +141,7 @@ public String getFieldName() { } public TOpenSessionReq() { - this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5; + this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6; } @@ -188,7 +188,7 @@ public TOpenSessionReq deepCopy() { @Override public void clear() { - this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5; + this.client_protocol = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6; this.username = null; this.password = null; @@ -638,15 +638,15 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TOpenSessionReq str case 4: // CONFIGURATION if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map134 = iprot.readMapBegin(); - struct.configuration = new HashMap(2*_map134.size); - for (int _i135 = 0; _i135 < _map134.size; ++_i135) + org.apache.thrift.protocol.TMap _map198 = iprot.readMapBegin(); + struct.configuration = new HashMap(2*_map198.size); + for (int _i199 = 0; _i199 < _map198.size; ++_i199) { - String _key136; // required - String _val137; // required - _key136 = iprot.readString(); - _val137 = iprot.readString(); - struct.configuration.put(_key136, _val137); + String _key200; // required + String _val201; // required + _key200 = iprot.readString(); + _val201 = iprot.readString(); + struct.configuration.put(_key200, _val201); } iprot.readMapEnd(); } @@ -692,10 +692,10 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TOpenSessionReq st oprot.writeFieldBegin(CONFIGURATION_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.configuration.size())); - for (Map.Entry _iter138 : struct.configuration.entrySet()) + for (Map.Entry _iter202 : struct.configuration.entrySet()) { - oprot.writeString(_iter138.getKey()); - oprot.writeString(_iter138.getValue()); + oprot.writeString(_iter202.getKey()); + oprot.writeString(_iter202.getValue()); } oprot.writeMapEnd(); } @@ -740,10 +740,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TOpenSessionReq str if (struct.isSetConfiguration()) { { oprot.writeI32(struct.configuration.size()); - for (Map.Entry _iter139 : struct.configuration.entrySet()) + for (Map.Entry _iter203 : struct.configuration.entrySet()) { - oprot.writeString(_iter139.getKey()); - oprot.writeString(_iter139.getValue()); + oprot.writeString(_iter203.getKey()); + oprot.writeString(_iter203.getValue()); } } } @@ -765,15 +765,15 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TOpenSessionReq stru } if (incoming.get(2)) { { - org.apache.thrift.protocol.TMap _map140 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.configuration = new HashMap(2*_map140.size); - for (int _i141 = 0; _i141 < _map140.size; ++_i141) + org.apache.thrift.protocol.TMap _map204 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.configuration = new HashMap(2*_map204.size); + for (int _i205 = 0; _i205 < _map204.size; ++_i205) { - String _key142; // required - String _val143; // required - _key142 = iprot.readString(); - _val143 = iprot.readString(); - struct.configuration.put(_key142, _val143); + String _key206; // required + String _val207; // required + _key206 = iprot.readString(); + _val207 = iprot.readString(); + struct.configuration.put(_key206, _val207); } } struct.setConfigurationIsSet(true); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java index 95f9aed..bb98382 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TOpenSessionResp.java @@ -141,7 +141,7 @@ public String getFieldName() { } public TOpenSessionResp() { - this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5; + this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6; } @@ -191,7 +191,7 @@ public TOpenSessionResp deepCopy() { @Override public void clear() { this.status = null; - this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5; + this.serverProtocolVersion = org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6; this.sessionHandle = null; this.configuration = null; @@ -650,15 +650,15 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TOpenSessionResp st case 4: // CONFIGURATION if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map144 = iprot.readMapBegin(); - struct.configuration = new HashMap(2*_map144.size); - for (int _i145 = 0; _i145 < _map144.size; ++_i145) + org.apache.thrift.protocol.TMap _map208 = iprot.readMapBegin(); + struct.configuration = new HashMap(2*_map208.size); + for (int _i209 = 0; _i209 < _map208.size; ++_i209) { - String _key146; // required - String _val147; // required - _key146 = iprot.readString(); - _val147 = iprot.readString(); - struct.configuration.put(_key146, _val147); + String _key210; // required + String _val211; // required + _key210 = iprot.readString(); + _val211 = iprot.readString(); + struct.configuration.put(_key210, _val211); } iprot.readMapEnd(); } @@ -702,10 +702,10 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TOpenSessionResp s oprot.writeFieldBegin(CONFIGURATION_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.configuration.size())); - for (Map.Entry _iter148 : struct.configuration.entrySet()) + for (Map.Entry _iter212 : struct.configuration.entrySet()) { - oprot.writeString(_iter148.getKey()); - oprot.writeString(_iter148.getValue()); + oprot.writeString(_iter212.getKey()); + oprot.writeString(_iter212.getValue()); } oprot.writeMapEnd(); } @@ -745,10 +745,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TOpenSessionResp st if (struct.isSetConfiguration()) { { oprot.writeI32(struct.configuration.size()); - for (Map.Entry _iter149 : struct.configuration.entrySet()) + for (Map.Entry _iter213 : struct.configuration.entrySet()) { - oprot.writeString(_iter149.getKey()); - oprot.writeString(_iter149.getValue()); + oprot.writeString(_iter213.getKey()); + oprot.writeString(_iter213.getValue()); } } } @@ -770,15 +770,15 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TOpenSessionResp str } if (incoming.get(1)) { { - org.apache.thrift.protocol.TMap _map150 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.configuration = new HashMap(2*_map150.size); - for (int _i151 = 0; _i151 < _map150.size; ++_i151) + org.apache.thrift.protocol.TMap _map214 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.configuration = new HashMap(2*_map214.size); + for (int _i215 = 0; _i215 < _map214.size; ++_i215) { - String _key152; // required - String _val153; // required - _key152 = iprot.readString(); - _val153 = iprot.readString(); - struct.configuration.put(_key152, _val153); + String _key216; // required + String _val217; // required + _key216 = iprot.readString(); + _val217 = iprot.readString(); + struct.configuration.put(_key216, _val217); } } struct.setConfigurationIsSet(true); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java index b68911c..96553b0 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TProtocolVersion.java @@ -16,7 +16,8 @@ HIVE_CLI_SERVICE_PROTOCOL_V2(1), HIVE_CLI_SERVICE_PROTOCOL_V3(2), HIVE_CLI_SERVICE_PROTOCOL_V4(3), - HIVE_CLI_SERVICE_PROTOCOL_V5(4); + HIVE_CLI_SERVICE_PROTOCOL_V5(4), + HIVE_CLI_SERVICE_PROTOCOL_V6(5); private final int value; @@ -47,6 +48,8 @@ public static TProtocolVersion findByValue(int value) { return HIVE_CLI_SERVICE_PROTOCOL_V4; case 4: return HIVE_CLI_SERVICE_PROTOCOL_V5; + case 5: + return HIVE_CLI_SERVICE_PROTOCOL_V6; default: return null; } diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRowSet.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRowSet.java index 3ab822c..41a7540 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRowSet.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRowSet.java @@ -545,14 +545,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TRowSet struct) thr case 2: // ROWS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); - struct.rows = new ArrayList(_list110.size); - for (int _i111 = 0; _i111 < _list110.size; ++_i111) + org.apache.thrift.protocol.TList _list174 = iprot.readListBegin(); + struct.rows = new ArrayList(_list174.size); + for (int _i175 = 0; _i175 < _list174.size; ++_i175) { - TRow _elem112; // required - _elem112 = new TRow(); - _elem112.read(iprot); - struct.rows.add(_elem112); + TRow _elem176; // required + _elem176 = new TRow(); + _elem176.read(iprot); + struct.rows.add(_elem176); } iprot.readListEnd(); } @@ -564,14 +564,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TRowSet struct) thr case 3: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list113 = iprot.readListBegin(); - struct.columns = new ArrayList(_list113.size); - for (int _i114 = 0; _i114 < _list113.size; ++_i114) + org.apache.thrift.protocol.TList _list177 = iprot.readListBegin(); + struct.columns = new ArrayList(_list177.size); + for (int _i178 = 0; _i178 < _list177.size; ++_i178) { - TColumn _elem115; // required - _elem115 = new TColumn(); - _elem115.read(iprot); - struct.columns.add(_elem115); + TColumn _elem179; // required + _elem179 = new TColumn(); + _elem179.read(iprot); + struct.columns.add(_elem179); } iprot.readListEnd(); } @@ -600,9 +600,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TRowSet struct) th oprot.writeFieldBegin(ROWS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.rows.size())); - for (TRow _iter116 : struct.rows) + for (TRow _iter180 : struct.rows) { - _iter116.write(oprot); + _iter180.write(oprot); } oprot.writeListEnd(); } @@ -613,9 +613,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TRowSet struct) th oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); - for (TColumn _iter117 : struct.columns) + for (TColumn _iter181 : struct.columns) { - _iter117.write(oprot); + _iter181.write(oprot); } oprot.writeListEnd(); } @@ -642,9 +642,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) thr oprot.writeI64(struct.startRowOffset); { oprot.writeI32(struct.rows.size()); - for (TRow _iter118 : struct.rows) + for (TRow _iter182 : struct.rows) { - _iter118.write(oprot); + _iter182.write(oprot); } } BitSet optionals = new BitSet(); @@ -655,9 +655,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) thr if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); - for (TColumn _iter119 : struct.columns) + for (TColumn _iter183 : struct.columns) { - _iter119.write(oprot); + _iter183.write(oprot); } } } @@ -669,28 +669,28 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) thro struct.startRowOffset = iprot.readI64(); struct.setStartRowOffsetIsSet(true); { - org.apache.thrift.protocol.TList _list120 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.rows = new ArrayList(_list120.size); - for (int _i121 = 0; _i121 < _list120.size; ++_i121) + org.apache.thrift.protocol.TList _list184 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.rows = new ArrayList(_list184.size); + for (int _i185 = 0; _i185 < _list184.size; ++_i185) { - TRow _elem122; // required - _elem122 = new TRow(); - _elem122.read(iprot); - struct.rows.add(_elem122); + TRow _elem186; // required + _elem186 = new TRow(); + _elem186.read(iprot); + struct.rows.add(_elem186); } } struct.setRowsIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list123 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columns = new ArrayList(_list123.size); - for (int _i124 = 0; _i124 < _list123.size; ++_i124) + org.apache.thrift.protocol.TList _list187 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columns = new ArrayList(_list187.size); + for (int _i188 = 0; _i188 < _list187.size; ++_i188) { - TColumn _elem125; // required - _elem125 = new TColumn(); - _elem125.read(iprot); - struct.columns.add(_elem125); + TColumn _elem189; // required + _elem189 = new TColumn(); + _elem189.read(iprot); + struct.columns.add(_elem189); } } struct.setColumnsIsSet(true); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStatus.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStatus.java index 1143425..9fb573f 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStatus.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStatus.java @@ -694,13 +694,13 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TStatus struct) thr case 2: // INFO_MESSAGES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(); - struct.infoMessages = new ArrayList(_list126.size); - for (int _i127 = 0; _i127 < _list126.size; ++_i127) + org.apache.thrift.protocol.TList _list190 = iprot.readListBegin(); + struct.infoMessages = new ArrayList(_list190.size); + for (int _i191 = 0; _i191 < _list190.size; ++_i191) { - String _elem128; // required - _elem128 = iprot.readString(); - struct.infoMessages.add(_elem128); + String _elem192; // required + _elem192 = iprot.readString(); + struct.infoMessages.add(_elem192); } iprot.readListEnd(); } @@ -756,9 +756,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, TStatus struct) th oprot.writeFieldBegin(INFO_MESSAGES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.infoMessages.size())); - for (String _iter129 : struct.infoMessages) + for (String _iter193 : struct.infoMessages) { - oprot.writeString(_iter129); + oprot.writeString(_iter193); } oprot.writeListEnd(); } @@ -819,9 +819,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, TStatus struct) thr if (struct.isSetInfoMessages()) { { oprot.writeI32(struct.infoMessages.size()); - for (String _iter130 : struct.infoMessages) + for (String _iter194 : struct.infoMessages) { - oprot.writeString(_iter130); + oprot.writeString(_iter194); } } } @@ -844,13 +844,13 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TStatus struct) thro BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.infoMessages = new ArrayList(_list131.size); - for (int _i132 = 0; _i132 < _list131.size; ++_i132) + org.apache.thrift.protocol.TList _list195 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.infoMessages = new ArrayList(_list195.size); + for (int _i196 = 0; _i196 < _list195.size; ++_i196) { - String _elem133; // required - _elem133 = iprot.readString(); - struct.infoMessages.add(_elem133); + String _elem197; // required + _elem197 = iprot.readString(); + struct.infoMessages.add(_elem197); } } struct.setInfoMessagesIsSet(true); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStringColumn.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStringColumn.java new file mode 100644 index 0000000..999412e --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStringColumn.java @@ -0,0 +1,548 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hive.service.cli.thrift; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TStringColumn implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TStringColumn"); + + private static final org.apache.thrift.protocol.TField VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("values", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NULLS_FIELD_DESC = new org.apache.thrift.protocol.TField("nulls", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TStringColumnStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TStringColumnTupleSchemeFactory()); + } + + private List values; // required + private ByteBuffer nulls; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUES((short)1, "values"), + NULLS((short)2, "nulls"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUES + return VALUES; + case 2: // NULLS + return NULLS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUES, new org.apache.thrift.meta_data.FieldMetaData("values", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + tmpMap.put(_Fields.NULLS, new org.apache.thrift.meta_data.FieldMetaData("nulls", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TStringColumn.class, metaDataMap); + } + + public TStringColumn() { + } + + public TStringColumn( + List values, + ByteBuffer nulls) + { + this(); + this.values = values; + this.nulls = nulls; + } + + /** + * Performs a deep copy on other. + */ + public TStringColumn(TStringColumn other) { + if (other.isSetValues()) { + List __this__values = new ArrayList(); + for (String other_element : other.values) { + __this__values.add(other_element); + } + this.values = __this__values; + } + if (other.isSetNulls()) { + this.nulls = org.apache.thrift.TBaseHelper.copyBinary(other.nulls); +; + } + } + + public TStringColumn deepCopy() { + return new TStringColumn(this); + } + + @Override + public void clear() { + this.values = null; + this.nulls = null; + } + + public int getValuesSize() { + return (this.values == null) ? 0 : this.values.size(); + } + + public java.util.Iterator getValuesIterator() { + return (this.values == null) ? null : this.values.iterator(); + } + + public void addToValues(String elem) { + if (this.values == null) { + this.values = new ArrayList(); + } + this.values.add(elem); + } + + public List getValues() { + return this.values; + } + + public void setValues(List values) { + this.values = values; + } + + public void unsetValues() { + this.values = null; + } + + /** Returns true if field values is set (has been assigned a value) and false otherwise */ + public boolean isSetValues() { + return this.values != null; + } + + public void setValuesIsSet(boolean value) { + if (!value) { + this.values = null; + } + } + + public byte[] getNulls() { + setNulls(org.apache.thrift.TBaseHelper.rightSize(nulls)); + return nulls == null ? null : nulls.array(); + } + + public ByteBuffer bufferForNulls() { + return nulls; + } + + public void setNulls(byte[] nulls) { + setNulls(nulls == null ? (ByteBuffer)null : ByteBuffer.wrap(nulls)); + } + + public void setNulls(ByteBuffer nulls) { + this.nulls = nulls; + } + + public void unsetNulls() { + this.nulls = null; + } + + /** Returns true if field nulls is set (has been assigned a value) and false otherwise */ + public boolean isSetNulls() { + return this.nulls != null; + } + + public void setNullsIsSet(boolean value) { + if (!value) { + this.nulls = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUES: + if (value == null) { + unsetValues(); + } else { + setValues((List)value); + } + break; + + case NULLS: + if (value == null) { + unsetNulls(); + } else { + setNulls((ByteBuffer)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUES: + return getValues(); + + case NULLS: + return getNulls(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case VALUES: + return isSetValues(); + case NULLS: + return isSetNulls(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TStringColumn) + return this.equals((TStringColumn)that); + return false; + } + + public boolean equals(TStringColumn that) { + if (that == null) + return false; + + boolean this_present_values = true && this.isSetValues(); + boolean that_present_values = true && that.isSetValues(); + if (this_present_values || that_present_values) { + if (!(this_present_values && that_present_values)) + return false; + if (!this.values.equals(that.values)) + return false; + } + + boolean this_present_nulls = true && this.isSetNulls(); + boolean that_present_nulls = true && that.isSetNulls(); + if (this_present_nulls || that_present_nulls) { + if (!(this_present_nulls && that_present_nulls)) + return false; + if (!this.nulls.equals(that.nulls)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_values = true && (isSetValues()); + builder.append(present_values); + if (present_values) + builder.append(values); + + boolean present_nulls = true && (isSetNulls()); + builder.append(present_nulls); + if (present_nulls) + builder.append(nulls); + + return builder.toHashCode(); + } + + public int compareTo(TStringColumn other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TStringColumn typedOther = (TStringColumn)other; + + lastComparison = Boolean.valueOf(isSetValues()).compareTo(typedOther.isSetValues()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValues()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, typedOther.values); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetNulls()).compareTo(typedOther.isSetNulls()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNulls()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nulls, typedOther.nulls); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TStringColumn("); + boolean first = true; + + sb.append("values:"); + if (this.values == null) { + sb.append("null"); + } else { + sb.append(this.values); + } + first = false; + if (!first) sb.append(", "); + sb.append("nulls:"); + if (this.nulls == null) { + sb.append("null"); + } else { + org.apache.thrift.TBaseHelper.toString(this.nulls, sb); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetValues()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'values' is unset! Struct:" + toString()); + } + + if (!isSetNulls()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'nulls' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class TStringColumnStandardSchemeFactory implements SchemeFactory { + public TStringColumnStandardScheme getScheme() { + return new TStringColumnStandardScheme(); + } + } + + private static class TStringColumnStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TStringColumn struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // VALUES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list158 = iprot.readListBegin(); + struct.values = new ArrayList(_list158.size); + for (int _i159 = 0; _i159 < _list158.size; ++_i159) + { + String _elem160; // required + _elem160 = iprot.readString(); + struct.values.add(_elem160); + } + iprot.readListEnd(); + } + struct.setValuesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NULLS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TStringColumn struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.values != null) { + oprot.writeFieldBegin(VALUES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.values.size())); + for (String _iter161 : struct.values) + { + oprot.writeString(_iter161); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.nulls != null) { + oprot.writeFieldBegin(NULLS_FIELD_DESC); + oprot.writeBinary(struct.nulls); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TStringColumnTupleSchemeFactory implements SchemeFactory { + public TStringColumnTupleScheme getScheme() { + return new TStringColumnTupleScheme(); + } + } + + private static class TStringColumnTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TStringColumn struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.values.size()); + for (String _iter162 : struct.values) + { + oprot.writeString(_iter162); + } + } + oprot.writeBinary(struct.nulls); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TStringColumn struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TList _list163 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.values = new ArrayList(_list163.size); + for (int _i164 = 0; _i164 < _list163.size; ++_i164) + { + String _elem165; // required + _elem165 = iprot.readString(); + struct.values.add(_elem165); + } + } + struct.setValuesIsSet(true); + struct.nulls = iprot.readBinary(); + struct.setNullsIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java index 3935555..4c06c1a 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeQualifiers.java @@ -360,7 +360,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TTypeQualifiers str for (int _i1 = 0; _i1 < _map0.size; ++_i1) { String _key2; // required - TTypeQualifierValue _val3; // required + TTypeQualifierValue _val3; // optional _key2 = iprot.readString(); _val3 = new TTypeQualifierValue(); _val3.read(iprot); @@ -435,7 +435,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TTypeQualifiers stru for (int _i7 = 0; _i7 < _map6.size; ++_i7) { String _key8; // required - TTypeQualifierValue _val9; // required + TTypeQualifierValue _val9; // optional _key8 = iprot.readString(); _val9 = new TTypeQualifierValue(); _val9.read(iprot); diff --git service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote old mode 100644 new mode 100755 diff --git service/src/gen/thrift/gen-py/TCLIService/ttypes.py service/src/gen/thrift/gen-py/TCLIService/ttypes.py index b8246f9..cbf6b25 100644 --- service/src/gen/thrift/gen-py/TCLIService/ttypes.py +++ service/src/gen/thrift/gen-py/TCLIService/ttypes.py @@ -22,6 +22,7 @@ class TProtocolVersion: HIVE_CLI_SERVICE_PROTOCOL_V3 = 2 HIVE_CLI_SERVICE_PROTOCOL_V4 = 3 HIVE_CLI_SERVICE_PROTOCOL_V5 = 4 + HIVE_CLI_SERVICE_PROTOCOL_V6 = 5 _VALUES_TO_NAMES = { 0: "HIVE_CLI_SERVICE_PROTOCOL_V1", @@ -29,6 +30,7 @@ class TProtocolVersion: 2: "HIVE_CLI_SERVICE_PROTOCOL_V3", 3: "HIVE_CLI_SERVICE_PROTOCOL_V4", 4: "HIVE_CLI_SERVICE_PROTOCOL_V5", + 5: "HIVE_CLI_SERVICE_PROTOCOL_V6", } _NAMES_TO_VALUES = { @@ -37,6 +39,7 @@ class TProtocolVersion: "HIVE_CLI_SERVICE_PROTOCOL_V3": 2, "HIVE_CLI_SERVICE_PROTOCOL_V4": 3, "HIVE_CLI_SERVICE_PROTOCOL_V5": 4, + "HIVE_CLI_SERVICE_PROTOCOL_V6": 5, } class TTypeId: @@ -2133,6 +2136,830 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +class TBoolColumn: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.BOOL,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype100, _size97) = iprot.readListBegin() + for _i101 in xrange(_size97): + _elem102 = iprot.readBool(); + self.values.append(_elem102) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TBoolColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.BOOL, len(self.values)) + for iter103 in self.values: + oprot.writeBool(iter103) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TByteColumn: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.BYTE,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype107, _size104) = iprot.readListBegin() + for _i108 in xrange(_size104): + _elem109 = iprot.readByte(); + self.values.append(_elem109) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TByteColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.BYTE, len(self.values)) + for iter110 in self.values: + oprot.writeByte(iter110) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TI16Column: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.I16,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype114, _size111) = iprot.readListBegin() + for _i115 in xrange(_size111): + _elem116 = iprot.readI16(); + self.values.append(_elem116) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI16Column') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.I16, len(self.values)) + for iter117 in self.values: + oprot.writeI16(iter117) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TI32Column: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.I32,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype121, _size118) = iprot.readListBegin() + for _i122 in xrange(_size118): + _elem123 = iprot.readI32(); + self.values.append(_elem123) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI32Column') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.I32, len(self.values)) + for iter124 in self.values: + oprot.writeI32(iter124) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TI64Column: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.I64,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype128, _size125) = iprot.readListBegin() + for _i129 in xrange(_size125): + _elem130 = iprot.readI64(); + self.values.append(_elem130) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI64Column') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.I64, len(self.values)) + for iter131 in self.values: + oprot.writeI64(iter131) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TDoubleColumn: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.DOUBLE,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype135, _size132) = iprot.readListBegin() + for _i136 in xrange(_size132): + _elem137 = iprot.readDouble(); + self.values.append(_elem137) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TDoubleColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.DOUBLE, len(self.values)) + for iter138 in self.values: + oprot.writeDouble(iter138) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TStringColumn: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.STRING,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype142, _size139) = iprot.readListBegin() + for _i143 in xrange(_size139): + _elem144 = iprot.readString(); + self.values.append(_elem144) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TStringColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.values)) + for iter145 in self.values: + oprot.writeString(iter145) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TBinaryColumn: + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.STRING,None), None, ), # 1 + (2, TType.STRING, 'nulls', None, None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype149, _size146) = iprot.readListBegin() + for _i150 in xrange(_size146): + _elem151 = iprot.readString(); + self.values.append(_elem151) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TBinaryColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.values)) + for iter152 in self.values: + oprot.writeString(iter152) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeString(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocol.TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocol.TProtocolException(message='Required field nulls is unset!') + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TColumn: + """ + Attributes: + - boolVal + - byteVal + - i16Val + - i32Val + - i64Val + - doubleVal + - stringVal + - binaryVal + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'boolVal', (TBoolColumn, TBoolColumn.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'byteVal', (TByteColumn, TByteColumn.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'i16Val', (TI16Column, TI16Column.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'i32Val', (TI32Column, TI32Column.thrift_spec), None, ), # 4 + (5, TType.STRUCT, 'i64Val', (TI64Column, TI64Column.thrift_spec), None, ), # 5 + (6, TType.STRUCT, 'doubleVal', (TDoubleColumn, TDoubleColumn.thrift_spec), None, ), # 6 + (7, TType.STRUCT, 'stringVal', (TStringColumn, TStringColumn.thrift_spec), None, ), # 7 + (8, TType.STRUCT, 'binaryVal', (TBinaryColumn, TBinaryColumn.thrift_spec), None, ), # 8 + ) + + def __init__(self, boolVal=None, byteVal=None, i16Val=None, i32Val=None, i64Val=None, doubleVal=None, stringVal=None, binaryVal=None,): + self.boolVal = boolVal + self.byteVal = byteVal + self.i16Val = i16Val + self.i32Val = i32Val + self.i64Val = i64Val + self.doubleVal = doubleVal + self.stringVal = stringVal + self.binaryVal = binaryVal + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.boolVal = TBoolColumn() + self.boolVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.byteVal = TByteColumn() + self.byteVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.i16Val = TI16Column() + self.i16Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.i32Val = TI32Column() + self.i32Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.i64Val = TI64Column() + self.i64Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.doubleVal = TDoubleColumn() + self.doubleVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRUCT: + self.stringVal = TStringColumn() + self.stringVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.STRUCT: + self.binaryVal = TBinaryColumn() + self.binaryVal.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TColumn') + if self.boolVal is not None: + oprot.writeFieldBegin('boolVal', TType.STRUCT, 1) + self.boolVal.write(oprot) + oprot.writeFieldEnd() + if self.byteVal is not None: + oprot.writeFieldBegin('byteVal', TType.STRUCT, 2) + self.byteVal.write(oprot) + oprot.writeFieldEnd() + if self.i16Val is not None: + oprot.writeFieldBegin('i16Val', TType.STRUCT, 3) + self.i16Val.write(oprot) + oprot.writeFieldEnd() + if self.i32Val is not None: + oprot.writeFieldBegin('i32Val', TType.STRUCT, 4) + self.i32Val.write(oprot) + oprot.writeFieldEnd() + if self.i64Val is not None: + oprot.writeFieldBegin('i64Val', TType.STRUCT, 5) + self.i64Val.write(oprot) + oprot.writeFieldEnd() + if self.doubleVal is not None: + oprot.writeFieldBegin('doubleVal', TType.STRUCT, 6) + self.doubleVal.write(oprot) + oprot.writeFieldEnd() + if self.stringVal is not None: + oprot.writeFieldBegin('stringVal', TType.STRUCT, 7) + self.stringVal.write(oprot) + oprot.writeFieldEnd() + if self.binaryVal is not None: + oprot.writeFieldBegin('binaryVal', TType.STRUCT, 8) + self.binaryVal.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class TRowSet: """ Attributes: @@ -2170,22 +2997,22 @@ def read(self, iprot): elif fid == 2: if ftype == TType.LIST: self.rows = [] - (_etype100, _size97) = iprot.readListBegin() - for _i101 in xrange(_size97): - _elem102 = TRow() - _elem102.read(iprot) - self.rows.append(_elem102) + (_etype156, _size153) = iprot.readListBegin() + for _i157 in xrange(_size153): + _elem158 = TRow() + _elem158.read(iprot) + self.rows.append(_elem158) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 3: if ftype == TType.LIST: self.columns = [] - (_etype106, _size103) = iprot.readListBegin() - for _i107 in xrange(_size103): - _elem108 = TColumn() - _elem108.read(iprot) - self.columns.append(_elem108) + (_etype162, _size159) = iprot.readListBegin() + for _i163 in xrange(_size159): + _elem164 = TColumn() + _elem164.read(iprot) + self.columns.append(_elem164) iprot.readListEnd() else: iprot.skip(ftype) @@ -2206,15 +3033,15 @@ def write(self, oprot): if self.rows is not None: oprot.writeFieldBegin('rows', TType.LIST, 2) oprot.writeListBegin(TType.STRUCT, len(self.rows)) - for iter109 in self.rows: - iter109.write(oprot) + for iter165 in self.rows: + iter165.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.columns is not None: oprot.writeFieldBegin('columns', TType.LIST, 3) oprot.writeListBegin(TType.STRUCT, len(self.columns)) - for iter110 in self.columns: - iter110.write(oprot) + for iter166 in self.columns: + iter166.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -2282,10 +3109,10 @@ def read(self, iprot): elif fid == 2: if ftype == TType.LIST: self.infoMessages = [] - (_etype114, _size111) = iprot.readListBegin() - for _i115 in xrange(_size111): - _elem116 = iprot.readString(); - self.infoMessages.append(_elem116) + (_etype170, _size167) = iprot.readListBegin() + for _i171 in xrange(_size167): + _elem172 = iprot.readString(); + self.infoMessages.append(_elem172) iprot.readListEnd() else: iprot.skip(ftype) @@ -2321,8 +3148,8 @@ def write(self, oprot): if self.infoMessages is not None: oprot.writeFieldBegin('infoMessages', TType.LIST, 2) oprot.writeListBegin(TType.STRING, len(self.infoMessages)) - for iter117 in self.infoMessages: - oprot.writeString(iter117) + for iter173 in self.infoMessages: + oprot.writeString(iter173) oprot.writeListEnd() oprot.writeFieldEnd() if self.sqlState is not None: @@ -2610,7 +3437,7 @@ class TOpenSessionReq: thrift_spec = ( None, # 0 - (1, TType.I32, 'client_protocol', None, 4, ), # 1 + (1, TType.I32, 'client_protocol', None, 5, ), # 1 (2, TType.STRING, 'username', None, None, ), # 2 (3, TType.STRING, 'password', None, None, ), # 3 (4, TType.MAP, 'configuration', (TType.STRING,None,TType.STRING,None), None, ), # 4 @@ -2649,11 +3476,11 @@ def read(self, iprot): elif fid == 4: if ftype == TType.MAP: self.configuration = {} - (_ktype119, _vtype120, _size118 ) = iprot.readMapBegin() - for _i122 in xrange(_size118): - _key123 = iprot.readString(); - _val124 = iprot.readString(); - self.configuration[_key123] = _val124 + (_ktype175, _vtype176, _size174 ) = iprot.readMapBegin() + for _i178 in xrange(_size174): + _key179 = iprot.readString(); + _val180 = iprot.readString(); + self.configuration[_key179] = _val180 iprot.readMapEnd() else: iprot.skip(ftype) @@ -2682,9 +3509,9 @@ def write(self, oprot): if self.configuration is not None: oprot.writeFieldBegin('configuration', TType.MAP, 4) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) - for kiter125,viter126 in self.configuration.items(): - oprot.writeString(kiter125) - oprot.writeString(viter126) + for kiter181,viter182 in self.configuration.items(): + oprot.writeString(kiter181) + oprot.writeString(viter182) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -2719,7 +3546,7 @@ class TOpenSessionResp: thrift_spec = ( None, # 0 (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 - (2, TType.I32, 'serverProtocolVersion', None, 4, ), # 2 + (2, TType.I32, 'serverProtocolVersion', None, 5, ), # 2 (3, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 3 (4, TType.MAP, 'configuration', (TType.STRING,None,TType.STRING,None), None, ), # 4 ) @@ -2759,11 +3586,11 @@ def read(self, iprot): elif fid == 4: if ftype == TType.MAP: self.configuration = {} - (_ktype128, _vtype129, _size127 ) = iprot.readMapBegin() - for _i131 in xrange(_size127): - _key132 = iprot.readString(); - _val133 = iprot.readString(); - self.configuration[_key132] = _val133 + (_ktype184, _vtype185, _size183 ) = iprot.readMapBegin() + for _i187 in xrange(_size183): + _key188 = iprot.readString(); + _val189 = iprot.readString(); + self.configuration[_key188] = _val189 iprot.readMapEnd() else: iprot.skip(ftype) @@ -2792,9 +3619,9 @@ def write(self, oprot): if self.configuration is not None: oprot.writeFieldBegin('configuration', TType.MAP, 4) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) - for kiter134,viter135 in self.configuration.items(): - oprot.writeString(kiter134) - oprot.writeString(viter135) + for kiter190,viter191 in self.configuration.items(): + oprot.writeString(kiter190) + oprot.writeString(viter191) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -3266,11 +4093,11 @@ def read(self, iprot): elif fid == 3: if ftype == TType.MAP: self.confOverlay = {} - (_ktype137, _vtype138, _size136 ) = iprot.readMapBegin() - for _i140 in xrange(_size136): - _key141 = iprot.readString(); - _val142 = iprot.readString(); - self.confOverlay[_key141] = _val142 + (_ktype193, _vtype194, _size192 ) = iprot.readMapBegin() + for _i196 in xrange(_size192): + _key197 = iprot.readString(); + _val198 = iprot.readString(); + self.confOverlay[_key197] = _val198 iprot.readMapEnd() else: iprot.skip(ftype) @@ -3300,9 +4127,9 @@ def write(self, oprot): if self.confOverlay is not None: oprot.writeFieldBegin('confOverlay', TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.confOverlay)) - for kiter143,viter144 in self.confOverlay.items(): - oprot.writeString(kiter143) - oprot.writeString(viter144) + for kiter199,viter200 in self.confOverlay.items(): + oprot.writeString(kiter199) + oprot.writeString(viter200) oprot.writeMapEnd() oprot.writeFieldEnd() if self.runAsync is not None: @@ -3907,10 +4734,10 @@ def read(self, iprot): elif fid == 5: if ftype == TType.LIST: self.tableTypes = [] - (_etype148, _size145) = iprot.readListBegin() - for _i149 in xrange(_size145): - _elem150 = iprot.readString(); - self.tableTypes.append(_elem150) + (_etype204, _size201) = iprot.readListBegin() + for _i205 in xrange(_size201): + _elem206 = iprot.readString(); + self.tableTypes.append(_elem206) iprot.readListEnd() else: iprot.skip(ftype) @@ -3943,8 +4770,8 @@ def write(self, oprot): if self.tableTypes is not None: oprot.writeFieldBegin('tableTypes', TType.LIST, 5) oprot.writeListBegin(TType.STRING, len(self.tableTypes)) - for iter151 in self.tableTypes: - oprot.writeString(iter151) + for iter207 in self.tableTypes: + oprot.writeString(iter207) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() diff --git service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote old mode 100644 new mode 100755 diff --git service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb index caaf75a..edc33a4 100644 --- service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb +++ service/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb @@ -12,8 +12,9 @@ module TProtocolVersion HIVE_CLI_SERVICE_PROTOCOL_V3 = 2 HIVE_CLI_SERVICE_PROTOCOL_V4 = 3 HIVE_CLI_SERVICE_PROTOCOL_V5 = 4 - VALUE_MAP = {0 => "HIVE_CLI_SERVICE_PROTOCOL_V1", 1 => "HIVE_CLI_SERVICE_PROTOCOL_V2", 2 => "HIVE_CLI_SERVICE_PROTOCOL_V3", 3 => "HIVE_CLI_SERVICE_PROTOCOL_V4", 4 => "HIVE_CLI_SERVICE_PROTOCOL_V5"} - VALID_VALUES = Set.new([HIVE_CLI_SERVICE_PROTOCOL_V1, HIVE_CLI_SERVICE_PROTOCOL_V2, HIVE_CLI_SERVICE_PROTOCOL_V3, HIVE_CLI_SERVICE_PROTOCOL_V4, HIVE_CLI_SERVICE_PROTOCOL_V5]).freeze + HIVE_CLI_SERVICE_PROTOCOL_V6 = 5 + VALUE_MAP = {0 => "HIVE_CLI_SERVICE_PROTOCOL_V1", 1 => "HIVE_CLI_SERVICE_PROTOCOL_V2", 2 => "HIVE_CLI_SERVICE_PROTOCOL_V3", 3 => "HIVE_CLI_SERVICE_PROTOCOL_V4", 4 => "HIVE_CLI_SERVICE_PROTOCOL_V5", 5 => "HIVE_CLI_SERVICE_PROTOCOL_V6"} + VALID_VALUES = Set.new([HIVE_CLI_SERVICE_PROTOCOL_V1, HIVE_CLI_SERVICE_PROTOCOL_V2, HIVE_CLI_SERVICE_PROTOCOL_V3, HIVE_CLI_SERVICE_PROTOCOL_V4, HIVE_CLI_SERVICE_PROTOCOL_V5, HIVE_CLI_SERVICE_PROTOCOL_V6]).freeze end module TTypeId @@ -656,6 +657,231 @@ class TRow ::Thrift::Struct.generate_accessors self end +class TBoolColumn + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::BOOL}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TByteColumn + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::BYTE}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TI16Column + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::I16}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TI32Column + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::I32}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TI64Column + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::I64}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TDoubleColumn + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::DOUBLE}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TStringColumn + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::STRING}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TBinaryColumn + include ::Thrift::Struct, ::Thrift::Struct_Union + VALUES = 1 + NULLS = 2 + + FIELDS = { + VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::STRING, :binary => true}}, + NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls + end + + ::Thrift::Struct.generate_accessors self +end + +class TColumn < ::Thrift::Union + include ::Thrift::Struct_Union + class << self + def boolVal(val) + TColumn.new(:boolVal, val) + end + + def byteVal(val) + TColumn.new(:byteVal, val) + end + + def i16Val(val) + TColumn.new(:i16Val, val) + end + + def i32Val(val) + TColumn.new(:i32Val, val) + end + + def i64Val(val) + TColumn.new(:i64Val, val) + end + + def doubleVal(val) + TColumn.new(:doubleVal, val) + end + + def stringVal(val) + TColumn.new(:stringVal, val) + end + + def binaryVal(val) + TColumn.new(:binaryVal, val) + end + end + + BOOLVAL = 1 + BYTEVAL = 2 + I16VAL = 3 + I32VAL = 4 + I64VAL = 5 + DOUBLEVAL = 6 + STRINGVAL = 7 + BINARYVAL = 8 + + FIELDS = { + BOOLVAL => {:type => ::Thrift::Types::STRUCT, :name => 'boolVal', :class => ::TBoolColumn}, + BYTEVAL => {:type => ::Thrift::Types::STRUCT, :name => 'byteVal', :class => ::TByteColumn}, + I16VAL => {:type => ::Thrift::Types::STRUCT, :name => 'i16Val', :class => ::TI16Column}, + I32VAL => {:type => ::Thrift::Types::STRUCT, :name => 'i32Val', :class => ::TI32Column}, + I64VAL => {:type => ::Thrift::Types::STRUCT, :name => 'i64Val', :class => ::TI64Column}, + DOUBLEVAL => {:type => ::Thrift::Types::STRUCT, :name => 'doubleVal', :class => ::TDoubleColumn}, + STRINGVAL => {:type => ::Thrift::Types::STRUCT, :name => 'stringVal', :class => ::TStringColumn}, + BINARYVAL => {:type => ::Thrift::Types::STRUCT, :name => 'binaryVal', :class => ::TBinaryColumn} + } + + def struct_fields; FIELDS; end + + def validate + raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil? + end + + ::Thrift::Union.generate_accessors self +end + class TRowSet include ::Thrift::Struct, ::Thrift::Struct_Union STARTROWOFFSET = 1 @@ -779,7 +1005,7 @@ class TOpenSessionReq CONFIGURATION = 4 FIELDS = { - CLIENT_PROTOCOL => {:type => ::Thrift::Types::I32, :name => 'client_protocol', :default => 4, :enum_class => ::TProtocolVersion}, + CLIENT_PROTOCOL => {:type => ::Thrift::Types::I32, :name => 'client_protocol', :default => 5, :enum_class => ::TProtocolVersion}, USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true}, PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password', :optional => true}, CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true} @@ -806,7 +1032,7 @@ class TOpenSessionResp FIELDS = { STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus}, - SERVERPROTOCOLVERSION => {:type => ::Thrift::Types::I32, :name => 'serverProtocolVersion', :default => 4, :enum_class => ::TProtocolVersion}, + SERVERPROTOCOLVERSION => {:type => ::Thrift::Types::I32, :name => 'serverProtocolVersion', :default => 5, :enum_class => ::TProtocolVersion}, SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::TSessionHandle, :optional => true}, CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true} } diff --git service/src/java/org/apache/hive/service/cli/CLIService.java service/src/java/org/apache/hive/service/cli/CLIService.java index cf8d106..aee2ade 100644 --- service/src/java/org/apache/hive/service/cli/CLIService.java +++ service/src/java/org/apache/hive/service/cli/CLIService.java @@ -39,6 +39,7 @@ import org.apache.hive.service.ServiceException; import org.apache.hive.service.auth.HiveAuthFactory; import org.apache.hive.service.cli.session.SessionManager; +import org.apache.hive.service.cli.thrift.TProtocolVersion; /** * CLIService. @@ -46,6 +47,13 @@ */ public class CLIService extends CompositeService implements ICLIService { + public static final TProtocolVersion SERVER_VERSION; + + static { + TProtocolVersion[] protocols = TProtocolVersion.values(); + SERVER_VERSION = protocols[protocols.length - 1]; + } + private final Log LOG = LogFactory.getLog(CLIService.class.getName()); private HiveConf hiveConf; @@ -106,6 +114,21 @@ public synchronized void stop() { super.stop(); } + public SessionHandle openSession(TProtocolVersion protocol, String username, String password, + Map configuration) throws HiveSQLException { + SessionHandle sessionHandle = sessionManager.openSession(protocol, username, password, configuration, false, null); + LOG.info(sessionHandle + ": openSession()"); + return sessionHandle; + } + + public SessionHandle openSessionWithImpersonation(TProtocolVersion protocol, String username, + String password, Map configuration, String delegationToken) + throws HiveSQLException { + SessionHandle sessionHandle = sessionManager.openSession(protocol, username, password, configuration, + true, delegationToken); + LOG.info(sessionHandle + ": openSession()"); + return sessionHandle; + } /* (non-Javadoc) * @see org.apache.hive.service.cli.ICLIService#openSession(java.lang.String, java.lang.String, java.util.Map) @@ -113,7 +136,7 @@ public synchronized void stop() { @Override public SessionHandle openSession(String username, String password, Map configuration) throws HiveSQLException { - SessionHandle sessionHandle = sessionManager.openSession(username, password, configuration, false, null); + SessionHandle sessionHandle = sessionManager.openSession(SERVER_VERSION, username, password, configuration, false, null); LOG.info(sessionHandle + ": openSession()"); return sessionHandle; } @@ -123,9 +146,9 @@ public SessionHandle openSession(String username, String password, Map configuration, - String delegationToken) throws HiveSQLException { - SessionHandle sessionHandle = sessionManager.openSession(username, password, configuration, - true, delegationToken); + String delegationToken) throws HiveSQLException { + SessionHandle sessionHandle = sessionManager.openSession(SERVER_VERSION, username, password, configuration, + true, delegationToken); LOG.info(sessionHandle + ": openSession()"); return sessionHandle; } diff --git service/src/java/org/apache/hive/service/cli/Column.java service/src/java/org/apache/hive/service/cli/Column.java new file mode 100644 index 0000000..2e21f18 --- /dev/null +++ service/src/java/org/apache/hive/service/cli/Column.java @@ -0,0 +1,423 @@ +/** + * 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.hive.service.cli; + +import java.nio.ByteBuffer; +import java.util.AbstractList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.List; + +import com.google.common.primitives.Booleans; +import com.google.common.primitives.Bytes; +import com.google.common.primitives.Doubles; +import com.google.common.primitives.Ints; +import com.google.common.primitives.Longs; +import com.google.common.primitives.Shorts; +import org.apache.hive.service.cli.thrift.TBinaryColumn; +import org.apache.hive.service.cli.thrift.TBoolColumn; +import org.apache.hive.service.cli.thrift.TByteColumn; +import org.apache.hive.service.cli.thrift.TColumn; +import org.apache.hive.service.cli.thrift.TDoubleColumn; +import org.apache.hive.service.cli.thrift.TI16Column; +import org.apache.hive.service.cli.thrift.TI32Column; +import org.apache.hive.service.cli.thrift.TI64Column; +import org.apache.hive.service.cli.thrift.TStringColumn; + +/** + * Column. + */ +public class Column extends AbstractList { + + private static final int DEFAULT_SIZE = 100; + + private final Type type; + + private BitSet nulls; + + private int size; + private boolean[] boolVars; + private byte[] byteVars; + private short[] shortVars; + private int[] intVars; + private long[] longVars; + private double[] doubleVars; + private List stringVars; + private List binaryVars; + + public Column(Type type, BitSet nulls, Object values) { + this.type = type; + this.nulls = nulls; + if (type == Type.BOOLEAN_TYPE) { + boolVars = (boolean[]) values; + size = boolVars.length; + } else if (type == Type.TINYINT_TYPE) { + byteVars = (byte[]) values; + size = byteVars.length; + } else if (type == Type.SMALLINT_TYPE) { + shortVars = (short[]) values; + size = shortVars.length; + } else if (type == Type.INT_TYPE) { + intVars = (int[]) values; + size = intVars.length; + } else if (type == Type.BIGINT_TYPE) { + longVars = (long[]) values; + size = longVars.length; + } else if (type == Type.DOUBLE_TYPE) { + doubleVars = (double[]) values; + size = doubleVars.length; + } else if (type == Type.BINARY_TYPE) { + binaryVars = (List) values; + size = binaryVars.size(); + } else if (type == Type.STRING_TYPE) { + stringVars = (List) values; + size = stringVars.size(); + } else { + throw new IllegalStateException("invalid union object"); + } + } + + public Column(Type type) { + nulls = new BitSet(); + switch (type) { + case BOOLEAN_TYPE: + boolVars = new boolean[DEFAULT_SIZE]; + break; + case TINYINT_TYPE: + byteVars = new byte[DEFAULT_SIZE]; + break; + case SMALLINT_TYPE: + shortVars = new short[DEFAULT_SIZE]; + break; + case INT_TYPE: + intVars = new int[DEFAULT_SIZE]; + break; + case BIGINT_TYPE: + longVars = new long[DEFAULT_SIZE]; + break; + case FLOAT_TYPE: + case DOUBLE_TYPE: + type = Type.DOUBLE_TYPE; + doubleVars = new double[DEFAULT_SIZE]; + break; + case BINARY_TYPE: + binaryVars = new ArrayList(); + break; + default: + type = Type.STRING_TYPE; + stringVars = new ArrayList(); + } + this.type = type; + } + + public Column(TColumn colValues) { + if (colValues.isSetBoolVal()) { + type = Type.BOOLEAN_TYPE; + nulls = toBitset(colValues.getBoolVal().getNulls()); + boolVars = Booleans.toArray(colValues.getBoolVal().getValues()); + size = boolVars.length; + } else if (colValues.isSetByteVal()) { + type = Type.TINYINT_TYPE; + nulls = toBitset(colValues.getByteVal().getNulls()); + byteVars = Bytes.toArray(colValues.getByteVal().getValues()); + size = byteVars.length; + } else if (colValues.isSetI16Val()) { + type = Type.SMALLINT_TYPE; + nulls = toBitset(colValues.getI16Val().getNulls()); + shortVars = Shorts.toArray(colValues.getI16Val().getValues()); + size = shortVars.length; + } else if (colValues.isSetI32Val()) { + type = Type.INT_TYPE; + nulls = toBitset(colValues.getI32Val().getNulls()); + intVars = Ints.toArray(colValues.getI32Val().getValues()); + size = intVars.length; + } else if (colValues.isSetI64Val()) { + type = Type.BIGINT_TYPE; + nulls = toBitset(colValues.getI64Val().getNulls()); + longVars = Longs.toArray(colValues.getI64Val().getValues()); + size = longVars.length; + } else if (colValues.isSetDoubleVal()) { + type = Type.DOUBLE_TYPE; + nulls = toBitset(colValues.getDoubleVal().getNulls()); + doubleVars = Doubles.toArray(colValues.getDoubleVal().getValues()); + size = doubleVars.length; + } else if (colValues.isSetBinaryVal()) { + type = Type.BINARY_TYPE; + nulls = toBitset(colValues.getBinaryVal().getNulls()); + binaryVars = colValues.getBinaryVal().getValues(); + size = binaryVars.size(); + } else if (colValues.isSetStringVal()) { + type = Type.STRING_TYPE; + nulls = toBitset(colValues.getStringVal().getNulls()); + stringVars = colValues.getStringVal().getValues(); + size = stringVars.size(); + } else { + throw new IllegalStateException("invalid union object"); + } + } + + public Column extractSubset(int start, int end) { + BitSet subNulls = nulls.get(start, end); + if (type == Type.BOOLEAN_TYPE) { + Column subset = new Column(type, subNulls, Arrays.copyOfRange(boolVars, start, end)); + boolVars = Arrays.copyOfRange(boolVars, end, size); + nulls = nulls.get(start, size); + size = boolVars.length; + return subset; + } + if (type == Type.TINYINT_TYPE) { + Column subset = new Column(type, subNulls, Arrays.copyOfRange(byteVars, start, end)); + byteVars = Arrays.copyOfRange(byteVars, end, size); + nulls = nulls.get(start, size); + size = byteVars.length; + return subset; + } + if (type == Type.SMALLINT_TYPE) { + Column subset = new Column(type, subNulls, Arrays.copyOfRange(shortVars, start, end)); + shortVars = Arrays.copyOfRange(shortVars, end, size); + nulls = nulls.get(start, size); + size = shortVars.length; + return subset; + } + if (type == Type.INT_TYPE) { + Column subset = new Column(type, subNulls, Arrays.copyOfRange(intVars, start, end)); + intVars = Arrays.copyOfRange(intVars, end, size); + nulls = nulls.get(start, size); + size = intVars.length; + return subset; + } + if (type == Type.BIGINT_TYPE) { + Column subset = new Column(type, subNulls, Arrays.copyOfRange(longVars, start, end)); + longVars = Arrays.copyOfRange(longVars, end, size); + nulls = nulls.get(start, size); + size = longVars.length; + return subset; + } + if (type == Type.DOUBLE_TYPE) { + Column subset = new Column(type, subNulls, Arrays.copyOfRange(doubleVars, start, end)); + doubleVars = Arrays.copyOfRange(doubleVars, end, size); + nulls = nulls.get(start, size); + size = doubleVars.length; + return subset; + } + if (type == Type.BINARY_TYPE) { + Column subset = new Column(type, subNulls, binaryVars.subList(start, end)); + binaryVars = binaryVars.subList(end, binaryVars.size()); + nulls = nulls.get(start, size); + size = binaryVars.size(); + return subset; + } + if (type == Type.STRING_TYPE) { + Column subset = new Column(type, subNulls, stringVars.subList(start, end)); + stringVars = stringVars.subList(end, stringVars.size()); + nulls = nulls.get(start, size); + size = stringVars.size(); + return subset; + } + throw new IllegalStateException("invalid union object"); + } + + private static final byte[] MASKS = new byte[] { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, (byte)0x80 + }; + + private static BitSet toBitset(byte[] nulls) { + BitSet bitset = new BitSet(); + int bits = nulls.length * 8; + for (int i = 0; i < bits; i++) { + bitset.set(i, (nulls[i / 8] & MASKS[i % 8]) != 0); + } + return bitset; + } + + private static byte[] toBinary(BitSet bitset) { + byte[] nulls = new byte[1 + (bitset.length() / 8)]; + for (int i = 0; i < bitset.length(); i++) { + nulls[i / 8] |= bitset.get(i) ? MASKS[i % 8] : 0; + } + return nulls; + } + + public Type getType() { + return type; + } + + @Override + public Object get(int index) { + if (nulls.get(index)) { + return null; + } + switch (type) { + case BOOLEAN_TYPE: + return boolVars[index]; + case TINYINT_TYPE: + return byteVars[index]; + case SMALLINT_TYPE: + return shortVars[index]; + case INT_TYPE: + return intVars[index]; + case BIGINT_TYPE: + return longVars[index]; + case DOUBLE_TYPE: + return doubleVars[index]; + case STRING_TYPE: + return stringVars.get(index); + case BINARY_TYPE: + return binaryVars.get(index).array(); + } + return null; + } + + @Override + public int size() { + return size; + } + + public TColumn toTColumn() { + TColumn value = new TColumn(); + ByteBuffer nullMasks = ByteBuffer.wrap(toBinary(nulls)); + switch (type) { + case BOOLEAN_TYPE: + value.setBoolVal(new TBoolColumn(Booleans.asList(Arrays.copyOfRange(boolVars, 0, size)), nullMasks)); + break; + case TINYINT_TYPE: + value.setByteVal(new TByteColumn(Bytes.asList(Arrays.copyOfRange(byteVars, 0, size)), nullMasks)); + break; + case SMALLINT_TYPE: + value.setI16Val(new TI16Column(Shorts.asList(Arrays.copyOfRange(shortVars, 0, size)), nullMasks)); + break; + case INT_TYPE: + value.setI32Val(new TI32Column(Ints.asList(Arrays.copyOfRange(intVars, 0, size)), nullMasks)); + break; + case BIGINT_TYPE: + value.setI64Val(new TI64Column(Longs.asList(Arrays.copyOfRange(longVars, 0, size)), nullMasks)); + break; + case DOUBLE_TYPE: + value.setDoubleVal(new TDoubleColumn(Doubles.asList(Arrays.copyOfRange(doubleVars, 0, size)), nullMasks)); + break; + case STRING_TYPE: + value.setStringVal(new TStringColumn(stringVars, nullMasks)); + break; + case BINARY_TYPE: + value.setBinaryVal(new TBinaryColumn(binaryVars, nullMasks)); + break; + } + return value; + } + + private static final ByteBuffer EMPTY_BINARY = ByteBuffer.allocate(0); + private static final String EMPTY_STRING = ""; + + public void addValue(Type type, Object field) { + switch (type) { + case BOOLEAN_TYPE: + nulls.set(size, field == null); + boolVars()[size] = field == null ? true : (Boolean)field; + break; + case TINYINT_TYPE: + nulls.set(size, field == null); + byteVars()[size] = field == null ? 0 : (Byte) field; + break; + case SMALLINT_TYPE: + nulls.set(size, field == null); + shortVars()[size] = field == null ? 0 : (Short)field; + break; + case INT_TYPE: + nulls.set(size, field == null); + intVars()[size] = field == null ? 0 : (Integer)field; + break; + case BIGINT_TYPE: + nulls.set(size, field == null); + longVars()[size] = field == null ? 0 : (Long)field; + break; + case FLOAT_TYPE: + nulls.set(size, field == null); + doubleVars()[size] = field == null ? 0 : ((Float)field).doubleValue(); + break; + case DOUBLE_TYPE: + nulls.set(size, field == null); + doubleVars()[size] = field == null ? 0 : (Double)field; + break; + case BINARY_TYPE: + nulls.set(binaryVars.size(), field == null); + binaryVars.add(field == null ? EMPTY_BINARY : ByteBuffer.wrap((byte[])field)); + break; + default: + nulls.set(stringVars.size(), field == null); + stringVars.add(field == null ? EMPTY_STRING : String.valueOf(field)); + break; + } + size++; + } + + private boolean[] boolVars() { + if (boolVars.length == size) { + boolean[] newVars = new boolean[size << 1]; + System.arraycopy(boolVars, 0, newVars, 0, size); + return boolVars = newVars; + } + return boolVars; + } + + private byte[] byteVars() { + if (byteVars.length == size) { + byte[] newVars = new byte[size << 1]; + System.arraycopy(byteVars, 0, newVars, 0, size); + return byteVars = newVars; + } + return byteVars; + } + + private short[] shortVars() { + if (shortVars.length == size) { + short[] newVars = new short[size << 1]; + System.arraycopy(shortVars, 0, newVars, 0, size); + return shortVars = newVars; + } + return shortVars; + } + + private int[] intVars() { + if (intVars.length == size) { + int[] newVars = new int[size << 1]; + System.arraycopy(intVars, 0, newVars, 0, size); + return intVars = newVars; + } + return intVars; + } + + private long[] longVars() { + if (longVars.length == size) { + long[] newVars = new long[size << 1]; + System.arraycopy(longVars, 0, newVars, 0, size); + return longVars = newVars; + } + return longVars; + } + + private double[] doubleVars() { + if (doubleVars.length == size) { + double[] newVars = new double[size << 1]; + System.arraycopy(doubleVars, 0, newVars, 0, size); + return doubleVars = newVars; + } + return doubleVars; + } +} diff --git service/src/java/org/apache/hive/service/cli/ColumnBasedSet.java service/src/java/org/apache/hive/service/cli/ColumnBasedSet.java new file mode 100644 index 0000000..47a582e --- /dev/null +++ service/src/java/org/apache/hive/service/cli/ColumnBasedSet.java @@ -0,0 +1,149 @@ +/** + * 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.hive.service.cli; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.hive.service.cli.thrift.TColumn; +import org.apache.hive.service.cli.thrift.TRow; +import org.apache.hive.service.cli.thrift.TRowSet; + +/** + * ColumnBasedSet. + */ +public class ColumnBasedSet implements RowSet { + + private long startOffset; + + private final Type[] types; // non-null only for writing (server-side) + private final List columns; + + public ColumnBasedSet(TableSchema schema) { + types = schema.toTypes(); + columns = new ArrayList(); + for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { + columns.add(new Column(colDesc.getType())); + } + } + + public ColumnBasedSet(TRowSet tRowSet) { + types = null; + columns = new ArrayList(); + for (TColumn tvalue : tRowSet.getColumns()) { + columns.add(new Column(tvalue)); + } + startOffset = tRowSet.getStartRowOffset(); + } + + private ColumnBasedSet(Type[] types, List columns, long startOffset) { + this.types = types; + this.columns = columns; + this.startOffset = startOffset; + } + + @Override + public ColumnBasedSet addRow(Object[] fields) { + for (int i = 0; i < fields.length; i++) { + columns.get(i).addValue(types[i], fields[i]); + } + return this; + } + + public List getColumns() { + return columns; + } + + @Override + public int numColumns() { + return columns.size(); + } + + @Override + public int numRows() { + return columns.isEmpty() ? 0 : columns.get(0).size(); + } + + @Override + public ColumnBasedSet extractSubset(int maxRows) { + int numRows = Math.min(numRows(), maxRows); + + List subset = new ArrayList(); + for (int i = 0; i < columns.size(); i++) { + subset.add(columns.get(i).extractSubset(0, numRows)); + } + ColumnBasedSet result = new ColumnBasedSet(types, subset, startOffset); + startOffset += numRows; + return result; + } + + @Override + public long getStartOffset() { + return startOffset; + } + + @Override + public void setStartOffset(long startOffset) { + this.startOffset = startOffset; + } + + public TRowSet toTRowSet() { + TRowSet tRowSet = new TRowSet(startOffset, new ArrayList()); + for (int i = 0; i < columns.size(); i++) { + tRowSet.addToColumns(columns.get(i).toTColumn()); + } + return tRowSet; + } + + @Override + public Iterator iterator() { + return new Iterator() { + + private int index; + private final Object[] convey = new Object[numColumns()]; + + @Override + public boolean hasNext() { + return index < numRows(); + } + + @Override + public Object[] next() { + for (int i = 0; i < columns.size(); i++) { + convey[i] = columns.get(i).get(index); + } + index++; + return convey; + } + + @Override + public void remove() { + throw new UnsupportedOperationException("remove"); + } + }; + } + + public Object[] fill(int index, Object[] convey) { + for (int i = 0; i < columns.size(); i++) { + convey[i] = columns.get(i).get(index); + } + return convey; + } +} diff --git service/src/java/org/apache/hive/service/cli/ColumnValue.java service/src/java/org/apache/hive/service/cli/ColumnValue.java index cf2b3d9..9b48396 100644 --- service/src/java/org/apache/hive/service/cli/ColumnValue.java +++ service/src/java/org/apache/hive/service/cli/ColumnValue.java @@ -18,6 +18,7 @@ package org.apache.hive.service.cli; +import java.math.BigDecimal; import java.sql.Date; import java.sql.Timestamp; @@ -34,133 +35,116 @@ import org.apache.hive.service.cli.thrift.TStringValue; /** - * ColumnValue. + * Protocols before HIVE_CLI_SERVICE_PROTOCOL_V6 (used by RowBasedSet) * */ public class ColumnValue { - public static final TColumnValue NULL = new TColumnValue(); - - static { - NULL.setStringVal(new TStringValue()); - } - - // TODO: replace this with a non-Thrift implementation - private final TColumnValue tColumnValue; - - public ColumnValue(TColumnValue tColumnValue) { - this.tColumnValue = new TColumnValue(tColumnValue); - } - - private static boolean isNull(Object value) { - return (value == null); - } - - public static ColumnValue booleanValue(Boolean value) { + private static TColumnValue booleanValue(Boolean value) { TBoolValue tBoolValue = new TBoolValue(); if (value != null) { tBoolValue.setValue(value); } - return new ColumnValue(TColumnValue.boolVal(tBoolValue)); + return TColumnValue.boolVal(tBoolValue); } - public static ColumnValue byteValue(Byte value) { + private static TColumnValue byteValue(Byte value) { TByteValue tByteValue = new TByteValue(); if (value != null) { tByteValue.setValue(value); } - return new ColumnValue(TColumnValue.byteVal(tByteValue)); + return TColumnValue.byteVal(tByteValue); } - public static ColumnValue shortValue(Short value) { + private static TColumnValue shortValue(Short value) { TI16Value tI16Value = new TI16Value(); if (value != null) { tI16Value.setValue(value); } - return new ColumnValue(TColumnValue.i16Val(tI16Value)); + return TColumnValue.i16Val(tI16Value); } - public static ColumnValue intValue(Integer value) { + private static TColumnValue intValue(Integer value) { TI32Value tI32Value = new TI32Value(); if (value != null) { tI32Value.setValue(value); } - return new ColumnValue(TColumnValue.i32Val(tI32Value)); + return TColumnValue.i32Val(tI32Value); } - public static ColumnValue longValue(Long value) { + private static TColumnValue longValue(Long value) { TI64Value tI64Value = new TI64Value(); if (value != null) { tI64Value.setValue(value); } - return new ColumnValue(TColumnValue.i64Val(tI64Value)); + return TColumnValue.i64Val(tI64Value); } - public static ColumnValue floatValue(Float value) { + private static TColumnValue floatValue(Float value) { TDoubleValue tDoubleValue = new TDoubleValue(); if (value != null) { tDoubleValue.setValue(value); } - return new ColumnValue(TColumnValue.doubleVal(tDoubleValue)); + return TColumnValue.doubleVal(tDoubleValue); } - public static ColumnValue doubleValue(Double value) { + private static TColumnValue doubleValue(Double value) { TDoubleValue tDoubleValue = new TDoubleValue(); if (value != null) { tDoubleValue.setValue(value); } - return new ColumnValue(TColumnValue.doubleVal(tDoubleValue)); + return TColumnValue.doubleVal(tDoubleValue); } - public static ColumnValue stringValue(String value) { + private static TColumnValue stringValue(String value) { TStringValue tStringValue = new TStringValue(); if (value != null) { tStringValue.setValue(value); } - return new ColumnValue(TColumnValue.stringVal(tStringValue)); + return TColumnValue.stringVal(tStringValue); } - public static ColumnValue stringValue(HiveChar value) { + private static TColumnValue stringValue(HiveChar value) { TStringValue tStringValue = new TStringValue(); if (value != null) { tStringValue.setValue(value.toString()); } - return new ColumnValue(TColumnValue.stringVal(tStringValue)); + return TColumnValue.stringVal(tStringValue); } - public static ColumnValue stringValue(HiveVarchar value) { + private static TColumnValue stringValue(HiveVarchar value) { TStringValue tStringValue = new TStringValue(); if (value != null) { tStringValue.setValue(value.toString()); } - return new ColumnValue(TColumnValue.stringVal(tStringValue)); + return TColumnValue.stringVal(tStringValue); } - public static ColumnValue dateValue(Date value) { + private static TColumnValue dateValue(Date value) { TStringValue tStringValue = new TStringValue(); if (value != null) { tStringValue.setValue(value.toString()); } - return new ColumnValue(TColumnValue.stringVal(tStringValue)); + return new TColumnValue(TColumnValue.stringVal(tStringValue)); } - public static ColumnValue timestampValue(Timestamp value) { + private static TColumnValue timestampValue(Timestamp value) { TStringValue tStringValue = new TStringValue(); if (value != null) { tStringValue.setValue(value.toString()); } - return new ColumnValue(TColumnValue.stringVal(tStringValue)); + return TColumnValue.stringVal(tStringValue); } - public static ColumnValue stringValue(HiveDecimal value) { + private static TColumnValue stringValue(HiveDecimal value) { TStringValue tStrValue = new TStringValue(); if (value != null) { tStrValue.setValue(value.toString()); } - return new ColumnValue(TColumnValue.stringVal(tStrValue)); + return TColumnValue.stringVal(tStrValue); } - public static ColumnValue newColumnValue(Type type, Object value) { + public static TColumnValue toTColumnValue(Type type, Object value) { switch (type) { case BOOLEAN_TYPE: return booleanValue((Boolean)value); @@ -189,6 +173,7 @@ public static ColumnValue newColumnValue(Type type, Object value) { case DECIMAL_TYPE: return stringValue(((HiveDecimal)value)); case BINARY_TYPE: + return stringValue((String)value); case ARRAY_TYPE: case MAP_TYPE: case STRUCT_TYPE: @@ -200,8 +185,101 @@ public static ColumnValue newColumnValue(Type type, Object value) { } } - public TColumnValue toTColumnValue() { - return new TColumnValue(tColumnValue); + private static Boolean getBooleanValue(TBoolValue tBoolValue) { + if (tBoolValue.isSetValue()) { + return tBoolValue.isValue(); + } + return null; + } + + private static Byte getByteValue(TByteValue tByteValue) { + if (tByteValue.isSetValue()) { + return tByteValue.getValue(); + } + return null; + } + + private static Short getShortValue(TI16Value tI16Value) { + if (tI16Value.isSetValue()) { + return tI16Value.getValue(); + } + return null; + } + + private static Integer getIntegerValue(TI32Value tI32Value) { + if (tI32Value.isSetValue()) { + return tI32Value.getValue(); + } + return null; + } + + private static Long getLongValue(TI64Value tI64Value) { + if (tI64Value.isSetValue()) { + return tI64Value.getValue(); + } + return null; + } + + private static Double getDoubleValue(TDoubleValue tDoubleValue) { + if (tDoubleValue.isSetValue()) { + return tDoubleValue.getValue(); + } + return null; } + private static String getStringValue(TStringValue tStringValue) { + if (tStringValue.isSetValue()) { + return tStringValue.getValue(); + } + return null; + } + + private static Date getDateValue(TStringValue tStringValue) { + if (tStringValue.isSetValue()) { + return Date.valueOf(tStringValue.getValue()); + } + return null; + } + + private static Timestamp getTimestampValue(TStringValue tStringValue) { + if (tStringValue.isSetValue()) { + return Timestamp.valueOf(tStringValue.getValue()); + } + return null; + } + + private static byte[] getBinaryValue(TStringValue tString) { + if (tString.isSetValue()) { + return tString.getValue().getBytes(); + } + return null; + } + + private static BigDecimal getBigDecimalValue(TStringValue tStringValue) { + if (tStringValue.isSetValue()) { + return new BigDecimal(tStringValue.getValue()); + } + return null; + } + + public static Object toColumnValue(TColumnValue value) { + TColumnValue._Fields field = value.getSetField(); + switch (field) { + case BOOL_VAL: + return getBooleanValue(value.getBoolVal()); + case BYTE_VAL: + return getByteValue(value.getByteVal()); + case I16_VAL: + return getShortValue(value.getI16Val()); + case I32_VAL: + return getIntegerValue(value.getI32Val()); + case I64_VAL: + return getLongValue(value.getI64Val()); + case DOUBLE_VAL: + return getDoubleValue(value.getDoubleVal()); + case STRING_VAL: + return getStringValue(value.getStringVal()); + } + throw new IllegalArgumentException("never"); + } } diff --git service/src/java/org/apache/hive/service/cli/OperationHandle.java service/src/java/org/apache/hive/service/cli/OperationHandle.java index 8f548da..5426e28 100644 --- service/src/java/org/apache/hive/service/cli/OperationHandle.java +++ service/src/java/org/apache/hive/service/cli/OperationHandle.java @@ -18,27 +18,30 @@ package org.apache.hive.service.cli; import org.apache.hive.service.cli.thrift.TOperationHandle; - +import org.apache.hive.service.cli.thrift.TProtocolVersion; public class OperationHandle extends Handle { - private OperationType opType = OperationType.EXECUTE_STATEMENT; + private final OperationType opType; + private final TProtocolVersion protocol; private boolean hasResultSet = false; - public OperationHandle() { - // TODO: make this type abstract - super(); - } - - public OperationHandle(OperationType opType) { + public OperationHandle(OperationType opType, TProtocolVersion protocol) { super(); this.opType = opType; + this.protocol = protocol; } + // dummy handle for ThriftCLIService public OperationHandle(TOperationHandle tOperationHandle) { + this(tOperationHandle, TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1); + } + + public OperationHandle(TOperationHandle tOperationHandle, TProtocolVersion protocol) { super(tOperationHandle.getOperationId()); this.opType = OperationType.getOperationType(tOperationHandle.getOperationType()); this.hasResultSet = tOperationHandle.isHasResultSet(); + this.protocol = protocol; } public OperationType getOperationType() { @@ -61,6 +64,10 @@ public TOperationHandle toTOperationHandle() { return tOperationHandle; } + public TProtocolVersion getProtocolVersion() { + return protocol; + } + @Override public int hashCode() { final int prime = 31; diff --git service/src/java/org/apache/hive/service/cli/Row.java service/src/java/org/apache/hive/service/cli/Row.java deleted file mode 100644 index 9e419e9..0000000 --- service/src/java/org/apache/hive/service/cli/Row.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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.hive.service.cli; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.hive.service.cli.thrift.TColumnValue; -import org.apache.hive.service.cli.thrift.TRow; - -/** - * Row. - * - */ -public class Row { - private final List values = new ArrayList(); - - public Row() { - } - - public Row(TRow tRow) { - for (TColumnValue tColumnValues : tRow.getColVals()) { - values.add(new ColumnValue(tColumnValues)); - } - } - - public Row(TableSchema schema, Object[] fields) { - assert fields.length == schema.getColumnDescriptors().size(); - for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { - TypeDescriptor typeDesc = colDesc.getTypeDescriptor(); - values.add(ColumnValue.newColumnValue(typeDesc.getType(), fields[colDesc.getOrdinalPosition() - 1])); - } - } - - public Row addColumnValue(ColumnValue value) { - values.add(value); - return this; - } - - public Row addBoolean(boolean value) { - values.add(ColumnValue.booleanValue(value)); - return this; - } - - public Row addByte(byte value) { - values.add(ColumnValue.byteValue(value)); - return this; - } - - public Row addString(String value) { - values.add(ColumnValue.stringValue(value)); - return this; - } - - public TRow toTRow() { - TRow tRow = new TRow(); - for (ColumnValue columnValue : values) { - if (columnValue != null) { - tRow.addToColVals(columnValue.toTColumnValue()); - } else { - tRow.addToColVals(ColumnValue.NULL); - } - } - return tRow; - } -} diff --git service/src/java/org/apache/hive/service/cli/RowBasedSet.java service/src/java/org/apache/hive/service/cli/RowBasedSet.java new file mode 100644 index 0000000..a0ee210 --- /dev/null +++ service/src/java/org/apache/hive/service/cli/RowBasedSet.java @@ -0,0 +1,140 @@ +/** + * 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.hive.service.cli; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.hive.service.cli.thrift.TColumnValue; +import org.apache.hive.service.cli.thrift.TRow; +import org.apache.hive.service.cli.thrift.TRowSet; + +/** + * RowBasedSet + */ +public class RowBasedSet implements RowSet { + + private long startOffset; + + private final Type[] types; // non-null only for writing (server-side) + private final RemovableList rows; + + public RowBasedSet(TableSchema schema) { + types = schema.toTypes(); + rows = new RemovableList(); + } + + public RowBasedSet(TRowSet tRowSet) { + types = null; + rows = new RemovableList(tRowSet.getRows()); + startOffset = tRowSet.getStartRowOffset(); + } + + private RowBasedSet(Type[] types, List rows, long startOffset) { + this.types = types; + this.rows = new RemovableList(rows); + this.startOffset = startOffset; + } + + @Override + public RowBasedSet addRow(Object[] fields) { + TRow tRow = new TRow(); + for (int i = 0; i < fields.length; i++) { + tRow.addToColVals(ColumnValue.toTColumnValue(types[i], fields[i])); + } + rows.add(tRow); + return this; + } + + @Override + public int numColumns() { + return rows.isEmpty() ? 0 : rows.get(0).getColVals().size(); + } + + @Override + public int numRows() { + return rows.size(); + } + + public RowBasedSet extractSubset(int maxRows) { + int numRows = Math.min(numRows(), maxRows); + RowBasedSet result = new RowBasedSet(types, rows.subList(0, numRows), startOffset); + rows.removeRange(0, numRows); + startOffset += numRows; + return result; + } + + public long getStartOffset() { + return startOffset; + } + + public void setStartOffset(long startOffset) { + this.startOffset = startOffset; + } + + public int getSize() { + return rows.size(); + } + + public TRowSet toTRowSet() { + TRowSet tRowSet = new TRowSet(); + tRowSet.setStartRowOffset(startOffset); + tRowSet.setRows(new ArrayList(rows)); + return tRowSet; + } + + @Override + public Iterator iterator() { + return new Iterator() { + + final Iterator iterator = rows.iterator(); + final Object[] convey = new Object[numColumns()]; + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public Object[] next() { + TRow row = iterator.next(); + List values = row.getColVals(); + for (int i = 0; i < values.size(); i++) { + convey[i] = ColumnValue.toColumnValue(values.get(i)); + } + return convey; + } + + @Override + public void remove() { + throw new UnsupportedOperationException("remove"); + } + }; + } + + private static class RemovableList extends ArrayList { + public RemovableList() { super(); } + public RemovableList(List rows) { super(rows); } + @Override + public void removeRange(int fromIndex, int toIndex) { + super.removeRange(fromIndex, toIndex); + } + } +} diff --git service/src/java/org/apache/hive/service/cli/RowSet.java service/src/java/org/apache/hive/service/cli/RowSet.java index dce506d..ab0787e 100644 --- service/src/java/org/apache/hive/service/cli/RowSet.java +++ service/src/java/org/apache/hive/service/cli/RowSet.java @@ -18,107 +18,21 @@ package org.apache.hive.service.cli; -import java.util.ArrayList; -import java.util.List; - -import org.apache.hive.service.cli.thrift.TRow; import org.apache.hive.service.cli.thrift.TRowSet; -/** - * RowSet. - * - */ -public class RowSet { - - private long startOffset = 0; - private boolean hasMoreResults = false; - private List rows; - - public RowSet() { - rows = new ArrayList(); - } - - public RowSet(TRowSet tRowSet) { - this(); - startOffset = tRowSet.getStartRowOffset(); - for (TRow tRow : tRowSet.getRows()) { - rows.add(new Row(tRow)); - } - } - - public RowSet(List rows, long startOffset) { - this(); - this.rows.addAll(rows); - this.startOffset = startOffset; - } - - public RowSet addRow(Row row) { - rows.add(row); - return this; - } - - public RowSet addRow(TableSchema schema, Object[] fields) { - return addRow(new Row(schema, fields)); - } - - public RowSet extractSubset(int maxRows) { - int numRows = rows.size(); - maxRows = (maxRows <= numRows) ? maxRows : numRows; - RowSet result = new RowSet(rows.subList(0, maxRows), startOffset); - rows = new ArrayList(rows.subList(maxRows, numRows)); - startOffset += result.getSize(); - return result; - } - - public long getStartOffset() { - return startOffset; - } - - public RowSet setStartOffset(long startOffset) { - this.startOffset = startOffset; - return this; - } - - public boolean getHasMoreResults() { - return hasMoreResults; - } - - public RowSet setHasMoreResults(boolean hasMoreResults) { - this.hasMoreResults = hasMoreResults; - return this; - } +public interface RowSet extends Iterable { - public int getSize() { - return rows.size(); - } + RowSet addRow(Object[] fields); - public TRowSet toTRowSet() { - TRowSet tRowSet = new TRowSet(); - tRowSet.setStartRowOffset(startOffset); - List tRows = new ArrayList(); - for (Row row : rows) { - tRows.add(row.toTRow()); - } - tRowSet.setRows(tRows); + RowSet extractSubset(int maxRows); - /* - //List booleanColumn = new ArrayList(); - //List byteColumn = new ArrayList(); - //List shortColumn = new ArrayList(); - List integerColumn = new ArrayList(); + int numColumns(); - integerColumn.add(1); - //integerColumn.add(null); - integerColumn.add(3); - //integerColumn.add(null); + int numRows(); + long getStartOffset(); - TColumnUnion column = TColumnUnion.i32Column(integerColumn); - List columns = new ArrayList(); - columns.add(column); - tRowSet.setColumns(columns); - */ + void setStartOffset(long startOffset); - return tRowSet; - } + TRowSet toTRowSet(); } diff --git service/src/java/org/apache/hive/service/cli/RowSetFactory.java service/src/java/org/apache/hive/service/cli/RowSetFactory.java new file mode 100644 index 0000000..e8f68ea --- /dev/null +++ service/src/java/org/apache/hive/service/cli/RowSetFactory.java @@ -0,0 +1,41 @@ +/** + * 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.hive.service.cli; + +import org.apache.hive.service.cli.thrift.TProtocolVersion; +import org.apache.hive.service.cli.thrift.TRowSet; + +import static org.apache.hive.service.cli.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6; + +public class RowSetFactory { + + public static RowSet create(TableSchema schema, TProtocolVersion version) { + if (version.getValue() >= HIVE_CLI_SERVICE_PROTOCOL_V6.getValue()) { + return new ColumnBasedSet(schema); + } + return new RowBasedSet(schema); + } + + public static RowSet create(TRowSet results, TProtocolVersion version) { + if (version.getValue() >= HIVE_CLI_SERVICE_PROTOCOL_V6.getValue()) { + return new ColumnBasedSet(results); + } + return new RowBasedSet(results); + } +} diff --git service/src/java/org/apache/hive/service/cli/SessionHandle.java service/src/java/org/apache/hive/service/cli/SessionHandle.java index 1ed02e2..52e0ad4 100644 --- service/src/java/org/apache/hive/service/cli/SessionHandle.java +++ service/src/java/org/apache/hive/service/cli/SessionHandle.java @@ -20,6 +20,7 @@ import java.util.UUID; +import org.apache.hive.service.cli.thrift.TProtocolVersion; import org.apache.hive.service.cli.thrift.TSessionHandle; @@ -29,16 +30,20 @@ */ public class SessionHandle extends Handle { - public SessionHandle() { - super(); - } + private final TProtocolVersion protocol; - public SessionHandle(HandleIdentifier handleId) { - super(handleId); + public SessionHandle(TProtocolVersion protocol) { + this.protocol = protocol; } + // dummy handle for ThriftCLIService public SessionHandle(TSessionHandle tSessionHandle) { + this(tSessionHandle, TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1); + } + + public SessionHandle(TSessionHandle tSessionHandle, TProtocolVersion protocol) { super(tSessionHandle.getSessionId()); + this.protocol = protocol; } public UUID getSessionId() { @@ -51,6 +56,10 @@ public TSessionHandle toTSessionHandle() { return tSessionHandle; } + public TProtocolVersion getProtocolVersion() { + return protocol; + } + @Override public String toString() { return "SessionHandle [" + getHandleIdentifier() + "]"; diff --git service/src/java/org/apache/hive/service/cli/TableSchema.java service/src/java/org/apache/hive/service/cli/TableSchema.java index 155f529..ee019bc 100644 --- service/src/java/org/apache/hive/service/cli/TableSchema.java +++ service/src/java/org/apache/hive/service/cli/TableSchema.java @@ -82,6 +82,14 @@ public TTableSchema toTTableSchema() { return tTableSchema; } + public Type[] toTypes() { + Type[] types = new Type[columns.size()]; + for (int i = 0; i < types.length; i++) { + types[i] = columns.get(i).getType(); + } + return types; + } + public TableSchema addPrimitiveColumn(String columnName, Type columnType, String columnComment) { columns.add(ColumnDescriptor.newPrimitiveColumnDescriptor(columnName, columnComment, columnType, columns.size() + 1)); return this; diff --git service/src/java/org/apache/hive/service/cli/operation/GetCatalogsOperation.java service/src/java/org/apache/hive/service/cli/operation/GetCatalogsOperation.java index 70cabe3..c9fd5f9 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetCatalogsOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetCatalogsOperation.java @@ -18,13 +18,12 @@ package org.apache.hive.service.cli.operation; -import java.util.EnumSet; - import org.apache.hive.service.cli.FetchOrientation; import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; @@ -36,10 +35,11 @@ private static final TableSchema RESULT_SET_SCHEMA = new TableSchema() .addStringColumn("TABLE_CAT", "Catalog name. NULL if not applicable."); - private final RowSet rowSet = new RowSet(); + private final RowSet rowSet; protected GetCatalogsOperation(HiveSession parentSession) { super(parentSession, OperationType.GET_CATALOGS); + rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) diff --git service/src/java/org/apache/hive/service/cli/operation/GetColumnsOperation.java service/src/java/org/apache/hive/service/cli/operation/GetColumnsOperation.java index 8d09d1c..82811db 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetColumnsOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetColumnsOperation.java @@ -20,7 +20,6 @@ import java.sql.DatabaseMetaData; import java.util.Collections; -import java.util.EnumSet; import java.util.List; import java.util.regex.Pattern; @@ -32,6 +31,7 @@ import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.Type; import org.apache.hive.service.cli.session.HiveSession; @@ -102,7 +102,7 @@ private final String tableName; private final String columnName; - private final RowSet rowSet = new RowSet(); + private final RowSet rowSet; protected GetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { @@ -111,6 +111,7 @@ protected GetColumnsOperation(HiveSession parentSession, String catalogName, Str this.schemaName = schemaName; this.tableName = tableName; this.columnName = columnName; + this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) @@ -165,7 +166,7 @@ public void run() throws HiveSQLException { null, // SOURCE_DATA_TYPE "NO", // IS_AUTO_INCREMENT }; - rowSet.addRow(RESULT_SET_SCHEMA, rowData); + rowSet.addRow(rowData); } } } diff --git service/src/java/org/apache/hive/service/cli/operation/GetFunctionsOperation.java service/src/java/org/apache/hive/service/cli/operation/GetFunctionsOperation.java index e3b161a..fd4e94d 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetFunctionsOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetFunctionsOperation.java @@ -19,7 +19,6 @@ package org.apache.hive.service.cli.operation; import java.sql.DatabaseMetaData; -import java.util.EnumSet; import java.util.Set; import org.apache.hadoop.hive.ql.exec.FunctionInfo; @@ -30,6 +29,7 @@ import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.Type; import org.apache.hive.service.cli.session.HiveSession; @@ -57,7 +57,7 @@ private final String schemaName; private final String functionName; - private final RowSet rowSet = new RowSet(); + private final RowSet rowSet; public GetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { @@ -65,6 +65,7 @@ public GetFunctionsOperation(HiveSession parentSession, this.catalogName = catalogName; this.schemaName = schemaName; this.functionName = functionName; + this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) @@ -90,7 +91,7 @@ public void run() throws HiveSQLException { : DatabaseMetaData.functionNoTable), // FUNCTION_TYPE functionInfo.getClass().getCanonicalName() }; - rowSet.addRow(RESULT_SET_SCHEMA, rowData); + rowSet.addRow(rowData); } } setState(OperationState.FINISHED); diff --git service/src/java/org/apache/hive/service/cli/operation/GetSchemasOperation.java service/src/java/org/apache/hive/service/cli/operation/GetSchemasOperation.java index f413116..ebca996 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetSchemasOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetSchemasOperation.java @@ -18,14 +18,13 @@ package org.apache.hive.service.cli.operation; -import java.util.EnumSet; - import org.apache.hadoop.hive.metastore.IMetaStoreClient; import org.apache.hive.service.cli.FetchOrientation; import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; @@ -48,6 +47,7 @@ protected GetSchemasOperation(HiveSession parentSession, super(parentSession, OperationType.GET_SCHEMAS); this.catalogName = catalogName; this.schemaName = schemaName; + this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) @@ -56,12 +56,11 @@ protected GetSchemasOperation(HiveSession parentSession, @Override public void run() throws HiveSQLException { setState(OperationState.RUNNING); - rowSet = new RowSet(); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); for (String dbName : metastoreClient.getDatabases(schemaPattern)) { - rowSet.addRow(RESULT_SET_SCHEMA, new Object[] {dbName, DEFAULT_HIVE_CATALOG}); + rowSet.addRow(new Object[] {dbName, DEFAULT_HIVE_CATALOG}); } setState(OperationState.FINISHED); } catch (Exception e) { diff --git service/src/java/org/apache/hive/service/cli/operation/GetTableTypesOperation.java service/src/java/org/apache/hive/service/cli/operation/GetTableTypesOperation.java index d168d5e..05991e0 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetTableTypesOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetTableTypesOperation.java @@ -18,7 +18,6 @@ package org.apache.hive.service.cli.operation; -import java.util.EnumSet; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.TableType; import org.apache.hive.service.cli.FetchOrientation; @@ -26,6 +25,7 @@ import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; @@ -38,7 +38,7 @@ protected static TableSchema RESULT_SET_SCHEMA = new TableSchema() .addStringColumn("TABLE_TYPE", "Table type name."); - private RowSet rowSet; + private final RowSet rowSet; private final TableTypeMapping tableTypeMapping; protected GetTableTypesOperation(HiveSession parentSession) { @@ -47,6 +47,7 @@ protected GetTableTypesOperation(HiveSession parentSession) { getVar(HiveConf.ConfVars.HIVE_SERVER2_TABLE_TYPE_MAPPING); tableTypeMapping = TableTypeMappingFactory.getTableTypeMapping(tableMappingStr); + rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) @@ -56,10 +57,8 @@ protected GetTableTypesOperation(HiveSession parentSession) { public void run() throws HiveSQLException { setState(OperationState.RUNNING); try { - rowSet = new RowSet(); for (TableType type : TableType.values()) { - rowSet.addRow(RESULT_SET_SCHEMA, - new String[] {tableTypeMapping.mapToClientType(type.toString())}); + rowSet.addRow(new String[] {tableTypeMapping.mapToClientType(type.toString())}); } setState(OperationState.FINISHED); } catch (Exception e) { diff --git service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java index c8cce08..315dbea 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java @@ -19,7 +19,6 @@ package org.apache.hive.service.cli.operation; import java.util.ArrayList; -import java.util.EnumSet; import java.util.List; import org.apache.hadoop.hive.conf.HiveConf; @@ -30,6 +29,7 @@ import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; @@ -43,7 +43,7 @@ private final String schemaName; private final String tableName; private final List tableTypes = new ArrayList(); - private final RowSet rowSet = new RowSet(); + private final RowSet rowSet; private final TableTypeMapping tableTypeMapping; @@ -68,6 +68,7 @@ protected GetTablesOperation(HiveSession parentSession, if (tableTypes != null) { this.tableTypes.addAll(tableTypes); } + this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) @@ -92,7 +93,7 @@ public void run() throws HiveSQLException { }; if (tableTypes.isEmpty() || tableTypes.contains( tableTypeMapping.mapToClientType(table.getTableType()))) { - rowSet.addRow(RESULT_SET_SCHEMA, rowData); + rowSet.addRow(rowData); } } } diff --git service/src/java/org/apache/hive/service/cli/operation/GetTypeInfoOperation.java service/src/java/org/apache/hive/service/cli/operation/GetTypeInfoOperation.java index a923199..758d399 100644 --- service/src/java/org/apache/hive/service/cli/operation/GetTypeInfoOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/GetTypeInfoOperation.java @@ -18,13 +18,12 @@ package org.apache.hive.service.cli.operation; -import java.util.EnumSet; - import org.apache.hive.service.cli.FetchOrientation; import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationType; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.Type; import org.apache.hive.service.cli.session.HiveSession; @@ -73,10 +72,11 @@ .addPrimitiveColumn("NUM_PREC_RADIX", Type.INT_TYPE, "Usually 2 or 10"); - private final RowSet rowSet = new RowSet(); + private final RowSet rowSet; protected GetTypeInfoOperation(HiveSession parentSession) { super(parentSession, OperationType.GET_TYPE_INFO); + rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); } /* (non-Javadoc) @@ -107,7 +107,7 @@ public void run() throws HiveSQLException { null, // SQL_DATETIME_SUB, unused type.getNumPrecRadix() //NUM_PREC_RADIX }; - rowSet.addRow(RESULT_SET_SCHEMA, rowData); + rowSet.addRow(rowData); } setState(OperationState.FINISHED); } catch (Exception e) { diff --git service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java index e5bfd92..c6e1692 100644 --- service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java @@ -27,7 +27,6 @@ import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; -import java.util.EnumSet; import java.util.List; import java.util.Map; @@ -40,6 +39,7 @@ import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; @@ -158,10 +158,10 @@ public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws H resetResultReader(); } List rows = readResults((int) maxRows); - RowSet rowSet = new RowSet(); + RowSet rowSet = RowSetFactory.create(resultSchema, getProtocolVersion()); for (String row : rows) { - rowSet.addRow(resultSchema, new String[] {row}); + rowSet.addRow(new String[] {row}); } return rowSet; } diff --git service/src/java/org/apache/hive/service/cli/operation/Operation.java service/src/java/org/apache/hive/service/cli/operation/Operation.java index 162bd56..58a28b6 100644 --- service/src/java/org/apache/hive/service/cli/operation/Operation.java +++ service/src/java/org/apache/hive/service/cli/operation/Operation.java @@ -31,7 +31,7 @@ import org.apache.hive.service.cli.RowSet; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; - +import org.apache.hive.service.cli.thrift.TProtocolVersion; public abstract class Operation { @@ -50,7 +50,7 @@ protected Operation(HiveSession parentSession, OperationType opType) { super(); this.parentSession = parentSession; - opHandle = new OperationHandle(opType); + this.opHandle = new OperationHandle(opType, parentSession.getProtocolVersion()); } public void setConfiguration(HiveConf configuration) { @@ -69,6 +69,10 @@ public OperationHandle getHandle() { return opHandle; } + public TProtocolVersion getProtocolVersion() { + return opHandle.getProtocolVersion(); + } + public OperationType getType() { return opHandle.getOperationType(); } diff --git service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java index b0b9f01..03a37c8 100644 --- service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java +++ service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java @@ -50,8 +50,8 @@ import org.apache.hive.service.cli.FetchOrientation; import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.OperationState; -import org.apache.hive.service.cli.OperationStatus; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.session.HiveSession; @@ -231,6 +231,8 @@ public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws H validateDefaultFetchOrientation(orientation); assertState(OperationState.FINISHED); + RowSet rowSet = RowSetFactory.create(resultSchema, getProtocolVersion()); + try { /* if client is requesting fetch-from-start and its not the first time reading from this operation * then reset the fetch position to beginning @@ -241,9 +243,9 @@ public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws H fetchStarted = true; driver.setMaxRows((int) maxRows); if (driver.getResults(convey)) { - return decode(convey); + return decode(convey, rowSet); } - return new RowSet(); + return rowSet; } catch (IOException e) { throw new HiveSQLException(e); } catch (CommandNeedRetryException e) { @@ -255,41 +257,41 @@ public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws H } } - private RowSet decode(List rows) throws Exception { + private RowSet decode(List rows, RowSet rowSet) throws Exception { if (driver.isFetchingTable()) { - return prepareFromRow(rows); + return prepareFromRow(rows, rowSet); } - return decodeFromString(rows); + return decodeFromString(rows, rowSet); } // already encoded to thrift-able object in ThriftFormatter - private RowSet prepareFromRow(List rows) throws Exception { - RowSet rowSet = new RowSet(); + private RowSet prepareFromRow(List rows, RowSet rowSet) throws Exception { for (Object row : rows) { - rowSet.addRow(resultSchema, (Object[]) row); + rowSet.addRow((Object[]) row); } return rowSet; } - private RowSet decodeFromString(List rows) throws SQLException, SerDeException { + private RowSet decodeFromString(List rows, RowSet rowSet) + throws SQLException, SerDeException { getSerDe(); StructObjectInspector soi = (StructObjectInspector) serde.getObjectInspector(); List fieldRefs = soi.getAllStructFieldRefs(); - RowSet rowSet = new RowSet(); Object[] deserializedFields = new Object[fieldRefs.size()]; Object rowObj; ObjectInspector fieldOI; + int protocol = getProtocolVersion().getValue(); for (Object rowString : rows) { rowObj = serde.deserialize(new BytesWritable(((String)rowString).getBytes())); for (int i = 0; i < fieldRefs.size(); i++) { StructField fieldRef = fieldRefs.get(i); fieldOI = fieldRef.getFieldObjectInspector(); Object fieldData = soi.getStructFieldData(rowObj, fieldRef); - deserializedFields[i] = SerDeUtils.toThriftPayload(fieldData, fieldOI); + deserializedFields[i] = SerDeUtils.toThriftPayload(fieldData, fieldOI, protocol); } - rowSet.addRow(resultSchema, deserializedFields); + rowSet.addRow(deserializedFields); } return rowSet; } diff --git service/src/java/org/apache/hive/service/cli/session/HiveSession.java service/src/java/org/apache/hive/service/cli/session/HiveSession.java index 00058cc..c8fb8ec 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSession.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSession.java @@ -33,8 +33,12 @@ import org.apache.hive.service.cli.SessionHandle; import org.apache.hive.service.cli.TableSchema; import org.apache.hive.service.cli.operation.OperationManager; +import org.apache.hive.service.cli.thrift.TProtocolVersion; public interface HiveSession { + + TProtocolVersion getProtocolVersion(); + /** * Set the session manager for the session * @param sessionManager diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java index 46645e4..445c858 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java @@ -54,6 +54,7 @@ import org.apache.hive.service.cli.operation.GetTypeInfoOperation; import org.apache.hive.service.cli.operation.MetadataOperation; import org.apache.hive.service.cli.operation.OperationManager; +import org.apache.hive.service.cli.thrift.TProtocolVersion; /** * HiveSession @@ -61,7 +62,8 @@ */ public class HiveSessionImpl implements HiveSession { - private final SessionHandle sessionHandle = new SessionHandle(); + private final SessionHandle sessionHandle; + private String username; private final String password; private final Map sessionConf = new HashMap(); @@ -78,9 +80,11 @@ private IMetaStoreClient metastoreClient = null; private final Set opHandleSet = new HashSet(); - public HiveSessionImpl(String username, String password, Map sessionConf) { + public HiveSessionImpl(TProtocolVersion protocol, String username, String password, + Map sessionConf) { this.username = username; this.password = password; + this.sessionHandle = new SessionHandle(protocol); if (sessionConf != null) { for (Map.Entry entry : sessionConf.entrySet()) { @@ -93,10 +97,15 @@ public HiveSessionImpl(String username, String password, Map ses // use thrift transportable formatter hiveConf.set(ListSinkOperator.OUTPUT_FORMATTER, FetchFormatter.ThriftFormatter.class.getName()); + hiveConf.setInt(ListSinkOperator.OUTPUT_PROTOCOL, protocol.getValue()); sessionState = new SessionState(hiveConf); SessionState.start(sessionState); } + public TProtocolVersion getProtocolVersion() { + return sessionHandle.getProtocolVersion(); + } + public SessionManager getSessionManager() { return sessionManager; } diff --git service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java index 708f4e4..e97a2f6 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hive.service.cli.thrift.TProtocolVersion; /** * @@ -40,9 +41,9 @@ private Hive sessionHive = null; private HiveSession proxySession = null; - public HiveSessionImplwithUGI(String username, String password, Map sessionConf, - String delegationToken) throws HiveSQLException { - super(username, password, sessionConf); + public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String password, + Map sessionConf, String delegationToken) throws HiveSQLException { + super(protocol, username, password, sessionConf); setSessionUGI(username); setDelegationToken(delegationToken); } diff --git service/src/java/org/apache/hive/service/cli/session/SessionManager.java service/src/java/org/apache/hive/service/cli/session/SessionManager.java index 9ecf6b2..bfe0e7b 100644 --- service/src/java/org/apache/hive/service/cli/session/SessionManager.java +++ service/src/java/org/apache/hive/service/cli/session/SessionManager.java @@ -35,6 +35,7 @@ import org.apache.hive.service.cli.HiveSQLException; import org.apache.hive.service.cli.SessionHandle; import org.apache.hive.service.cli.operation.OperationManager; +import org.apache.hive.service.cli.thrift.TProtocolVersion; /** * SessionManager. @@ -92,24 +93,25 @@ public synchronized void stop() { } } - public SessionHandle openSession(String username, String password, Map sessionConf) - throws HiveSQLException { - return openSession(username, password, sessionConf, false, null); + public SessionHandle openSession(TProtocolVersion protocol, String username, String password, + Map sessionConf) throws HiveSQLException { + return openSession(protocol, username, password, sessionConf, false, null); } - public SessionHandle openSession(String username, String password, Map sessionConf, - boolean withImpersonation, String delegationToken) throws HiveSQLException { + public SessionHandle openSession(TProtocolVersion protocol, String username, String password, + Map sessionConf, boolean withImpersonation, String delegationToken) + throws HiveSQLException { if (username == null) { username = threadLocalUserName.get(); } HiveSession session; if (withImpersonation) { - HiveSessionImplwithUGI hiveSessionUgi = new HiveSessionImplwithUGI(username, password, - sessionConf, delegationToken); + HiveSessionImplwithUGI hiveSessionUgi = new HiveSessionImplwithUGI(protocol, username, password, + sessionConf, delegationToken); session = HiveSessionProxy.getProxy(hiveSessionUgi, hiveSessionUgi.getSessionUgi()); hiveSessionUgi.setProxySession(session); } else { - session = new HiveSessionImpl(username, password, sessionConf); + session = new HiveSessionImpl(protocol, username, password, sessionConf); } session.setSessionManager(this); session.setOperationManager(operationManager); diff --git service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java index 83f2535..62b1d9c 100644 --- service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java +++ service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java @@ -20,6 +20,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hive.service.cli.CLIService; +import org.apache.hive.service.cli.ICLIService; /** @@ -34,4 +35,8 @@ public EmbeddedThriftBinaryCLIService() { cliService.init(new HiveConf()); cliService.start(); } + + public ICLIService getService() { + return cliService; + } } diff --git service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java index 2d32ffe..b5a6138 100644 --- service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -117,7 +117,7 @@ public TOpenSessionResp OpenSession(TOpenSessionReq req) throws TException { LOG.info("Client protocol version: " + req.getClient_protocol()); TOpenSessionResp resp = new TOpenSessionResp(); try { - SessionHandle sessionHandle = getSessionHandle(req); + SessionHandle sessionHandle = getSessionHandle(req, resp); resp.setSessionHandle(sessionHandle.toTSessionHandle()); // TODO: set real configuration map resp.setConfiguration(new HashMap()); @@ -138,35 +138,48 @@ private String getUserName(TOpenSessionReq req) { } } - SessionHandle getSessionHandle(TOpenSessionReq req) + SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res) throws HiveSQLException, LoginException, IOException { String userName = getUserName(req); + TProtocolVersion protocol = getMinVersion(CLIService.SERVER_VERSION, req.getClient_protocol()); - SessionHandle sessionHandle = null; - if ( - cliService.getHiveConf().getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION) - .equals(HiveAuthFactory.AuthTypes.KERBEROS.toString()) - && - cliService.getHiveConf(). - getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS) - ) - { + SessionHandle sessionHandle; + if (cliService.getHiveConf().getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION) + .equals(HiveAuthFactory.AuthTypes.KERBEROS.toString()) && + cliService.getHiveConf().getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS)) { String delegationTokenStr = null; try { delegationTokenStr = cliService.getDelegationTokenFromMetaStore(userName); } catch (UnsupportedOperationException e) { // The delegation token is not applicable in the given deployment mode } - sessionHandle = cliService.openSessionWithImpersonation(userName, req.getPassword(), - req.getConfiguration(), delegationTokenStr); + sessionHandle = cliService.openSessionWithImpersonation(protocol, userName, + req.getPassword(), req.getConfiguration(), delegationTokenStr); } else { - sessionHandle = cliService.openSession(userName, req.getPassword(), + sessionHandle = cliService.openSession(protocol, userName, req.getPassword(), req.getConfiguration()); } + res.setServerProtocolVersion(protocol); return sessionHandle; } + private TProtocolVersion getMinVersion(TProtocolVersion... versions) { + TProtocolVersion[] values = TProtocolVersion.values(); + int current = values[values.length - 1].getValue(); + for (TProtocolVersion version : versions) { + if (current > version.getValue()) { + current = version.getValue(); + } + } + for (TProtocolVersion version : values) { + if (version.getValue() == current) { + return version; + } + } + throw new IllegalArgumentException("never"); + } + @Override public TCloseSessionResp CloseSession(TCloseSessionReq req) throws TException { TCloseSessionResp resp = new TCloseSessionResp(); diff --git service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java index edad8ea..3675e86 100644 --- service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java @@ -30,6 +30,7 @@ import org.apache.hive.service.cli.OperationState; import org.apache.hive.service.cli.OperationStatus; import org.apache.hive.service.cli.RowSet; +import org.apache.hive.service.cli.RowSetFactory; import org.apache.hive.service.cli.SessionHandle; import org.apache.hive.service.cli.TableSchema; @@ -64,7 +65,7 @@ public SessionHandle openSession(String username, String password, req.setConfiguration(configuration); TOpenSessionResp resp = cliService.OpenSession(req); checkStatus(resp.getStatus()); - return new SessionHandle(resp.getSessionHandle()); + return new SessionHandle(resp.getSessionHandle(), resp.getServerProtocolVersion()); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -146,7 +147,8 @@ private OperationHandle executeStatementInternal(SessionHandle sessionHandle, St req.setRunAsync(isAsync); TExecuteStatementResp resp = cliService.ExecuteStatement(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -163,7 +165,8 @@ public OperationHandle getTypeInfo(SessionHandle sessionHandle) throws HiveSQLEx TGetTypeInfoReq req = new TGetTypeInfoReq(sessionHandle.toTSessionHandle()); TGetTypeInfoResp resp = cliService.GetTypeInfo(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -180,7 +183,8 @@ public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLEx TGetCatalogsReq req = new TGetCatalogsReq(sessionHandle.toTSessionHandle()); TGetCatalogsResp resp = cliService.GetCatalogs(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -201,7 +205,8 @@ public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogNam req.setSchemaName(schemaName); TGetSchemasResp resp = cliService.GetSchemas(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -223,7 +228,8 @@ public OperationHandle getTables(SessionHandle sessionHandle, String catalogName req.setSchemaName(schemaName); TGetTablesResp resp = cliService.GetTables(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -240,7 +246,8 @@ public OperationHandle getTableTypes(SessionHandle sessionHandle) throws HiveSQL TGetTableTypesReq req = new TGetTableTypesReq(sessionHandle.toTSessionHandle()); TGetTableTypesResp resp = cliService.GetTableTypes(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -264,7 +271,8 @@ public OperationHandle getColumns(SessionHandle sessionHandle, req.setColumnName(columnName); TGetColumnsResp resp = cliService.GetColumns(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -284,7 +292,8 @@ public OperationHandle getFunctions(SessionHandle sessionHandle, req.setSchemaName(schemaName); TGetFunctionsResp resp = cliService.GetFunctions(req); checkStatus(resp.getStatus()); - return new OperationHandle(resp.getOperationHandle()); + TProtocolVersion protocol = sessionHandle.getProtocolVersion(); + return new OperationHandle(resp.getOperationHandle(), protocol); } catch (HiveSQLException e) { throw e; } catch (Exception e) { @@ -379,7 +388,7 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio req.setMaxRows(maxRows); TFetchResultsResp resp = cliService.FetchResults(req); checkStatus(resp.getStatus()); - return new RowSet(resp.getResults()); + return RowSetFactory.create(resp.getResults(), opHandle.getProtocolVersion()); } catch (HiveSQLException e) { throw e; } catch (Exception e) { diff --git service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java index 249148d..3b24d4e 100644 --- service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java +++ service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java @@ -357,8 +357,9 @@ public void testDoAs() throws HiveSQLException, LoginException, IOException { cliService.init(hconf); ThriftCLIService tcliService = new ThriftBinaryCLIService(cliService); TOpenSessionReq req = new TOpenSessionReq(); + TOpenSessionResp res = new TOpenSessionResp(); req.setUsername("testuser1"); - SessionHandle sHandle = tcliService.getSessionHandle(req ); + SessionHandle sHandle = tcliService.getSessionHandle(req, res); SessionManager sManager = getSessionManager(cliService.getServices()); HiveSession session = sManager.getSession(sHandle);