diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index e971644..1dcd67d 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -763,6 +763,8 @@ HIVE_SERVER2_TABLE_TYPE_MAPPING("hive.server2.table.type.mapping", "CLASSIC"), HIVE_SERVER2_SESSION_HOOK("hive.server2.session.hook", ""), + HIVE_SERVER2_IN_MEM_LOGGING("hive.server2.in.mem.logging", true), + HIVE_SERVER2_IN_MEM_LOG_SIZE("hive.server2.in.mem.log.size", 128 * 1024), HIVE_CONF_RESTRICTED_LIST("hive.conf.restricted.list", null), // If this is set all move tasks at the end of a multi-insert query will only begin once all diff --git conf/hive-default.xml.template conf/hive-default.xml.template index 1ee756c..92d1065 100644 --- conf/hive-default.xml.template +++ conf/hive-default.xml.template @@ -1780,6 +1780,22 @@ + hive.server2.in.mem.logging + true + + Whether to turn on hiveserver2 in memory logging + + + + + hive.server2.in.mem.log.size + 131072 + + Maximum size of the hiveserver2 in memory query log. Note that the size is per query. + + + + hive.decode.partition.name false Whether to show the unquoted partition names in query results. diff --git jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java index 2912ece..6b9cba3 100644 --- jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java +++ jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java @@ -32,6 +32,8 @@ import org.apache.hive.service.cli.thrift.TCloseOperationResp; import org.apache.hive.service.cli.thrift.TExecuteStatementReq; import org.apache.hive.service.cli.thrift.TExecuteStatementResp; +import org.apache.hive.service.cli.thrift.TGetLogReq; +import org.apache.hive.service.cli.thrift.TGetLogResp; import org.apache.hive.service.cli.thrift.TGetOperationStatusReq; import org.apache.hive.service.cli.thrift.TGetOperationStatusResp; import org.apache.hive.service.cli.thrift.TOperationHandle; @@ -280,6 +282,25 @@ public boolean execute(String sql, String[] columnNames) throws SQLException { throw new SQLException("Method not supported"); } + public String getLog() throws SQLException { + if (isClosed) { + throw new SQLException("Can't get log for statement after statement has been closed"); + } + + TGetLogReq getLogReq = new TGetLogReq(); + TGetLogResp getLogResp; + getLogReq.setOperationHandle(stmtHandle); + try { + getLogResp = client.GetLog(getLogReq); + Utils.verifySuccessWithInfo(getLogResp.getStatus()); + } catch (SQLException e) { + throw e; + } catch (Exception e) { + throw new SQLException(e.toString(), "08S01", e); + } + return getLogResp.getLog(); + } + /* * (non-Javadoc) * diff --git jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java index 09ab3c2..be592c5 100644 --- jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java +++ jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java @@ -806,6 +806,30 @@ private void doTestErrorCase(String sql, String expectedMessage, exceptionFound); } + public void testGetLog() throws Exception { + HiveStatement stmt = (HiveStatement)con.createStatement(); + assertNotNull("Statement is null", stmt); + + ResultSet res = stmt.executeQuery("select count(*) from " + tableName); + ResultSetMetaData meta = res.getMetaData(); + + boolean moreRow = res.next(); + while (moreRow) { + try { + moreRow = res.next(); + } catch (SQLException e) { + throw e; + } + } + + String log = stmt.getLog(); + assertTrue("Operation Log looks incorrect" , + log.contains("Parsing command: select count(*) from testHiveJdbcDriver_Table")); + assertTrue("Operation Log looks incorrect", + log.contains( "select count(*) from testHiveJdbcDriver_Table")); + + } + public void testShowTables() throws SQLException { Statement stmt = con.createStatement(); assertNotNull("Statement is null", stmt); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Database.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Database.java index 8fd2024..2d55c55 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Database.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Database.java @@ -708,7 +708,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Database struct) th for (int _i79 = 0; _i79 < _map78.size; ++_i79) { String _key80; // required - String _val81; // required + String _val81; // optional _key80 = iprot.readString(); _val81 = iprot.readString(); struct.parameters.put(_key80, _val81); @@ -858,7 +858,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Database struct) thr for (int _i85 = 0; _i85 < _map84.size; ++_i85) { String _key86; // required - String _val87; // required + String _val87; // optional _key86 = iprot.readString(); _val87 = iprot.readString(); struct.parameters.put(_key86, _val87); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/EnvironmentContext.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/EnvironmentContext.java index d97a190..541eb8e 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/EnvironmentContext.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/EnvironmentContext.java @@ -356,7 +356,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, EnvironmentContext for (int _i247 = 0; _i247 < _map246.size; ++_i247) { String _key248; // required - String _val249; // required + String _val249; // optional _key248 = iprot.readString(); _val249 = iprot.readString(); struct.properties.put(_key248, _val249); @@ -439,7 +439,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, EnvironmentContext s for (int _i253 = 0; _i253 < _map252.size; ++_i253) { String _key254; // required - String _val255; // required + String _val255; // optional _key254 = iprot.readString(); _val255 = iprot.readString(); struct.properties.put(_key254, _val255); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Index.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Index.java index 72791b7..e90b7fa 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Index.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Index.java @@ -1145,7 +1145,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Index struct) throw for (int _i211 = 0; _i211 < _map210.size; ++_i211) { String _key212; // required - String _val213; // required + String _val213; // optional _key212 = iprot.readString(); _val213 = iprot.readString(); struct.parameters.put(_key212, _val213); @@ -1362,7 +1362,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Index struct) throws for (int _i217 = 0; _i217 < _map216.size; ++_i217) { String _key218; // required - String _val219; // required + String _val219; // optional _key218 = iprot.readString(); _val219 = iprot.readString(); struct.parameters.put(_key218, _val219); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java index 4329d34..cca78ba 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java @@ -1005,7 +1005,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Partition struct) t for (int _i196 = 0; _i196 < _map195.size; ++_i196) { String _key197; // required - String _val198; // required + String _val198; // optional _key197 = iprot.readString(); _val198 = iprot.readString(); struct.parameters.put(_key197, _val198); @@ -1219,7 +1219,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Partition struct) th for (int _i207 = 0; _i207 < _map206.size; ++_i207) { String _key208; // required - String _val209; // required + String _val209; // optional _key208 = iprot.readString(); _val209 = iprot.readString(); struct.parameters.put(_key208, _val209); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PrincipalPrivilegeSet.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PrincipalPrivilegeSet.java index eea86e5..73e086b 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PrincipalPrivilegeSet.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PrincipalPrivilegeSet.java @@ -580,7 +580,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, PrincipalPrivilegeS for (int _i25 = 0; _i25 < _map24.size; ++_i25) { String _key26; // required - List _val27; // required + List _val27; // optional _key26 = iprot.readString(); { org.apache.thrift.protocol.TList _list28 = iprot.readListBegin(); @@ -611,7 +611,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, PrincipalPrivilegeS for (int _i32 = 0; _i32 < _map31.size; ++_i32) { String _key33; // required - List _val34; // required + List _val34; // optional _key33 = iprot.readString(); { org.apache.thrift.protocol.TList _list35 = iprot.readListBegin(); @@ -642,7 +642,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, PrincipalPrivilegeS for (int _i39 = 0; _i39 < _map38.size; ++_i39) { String _key40; // required - List _val41; // required + List _val41; // optional _key40 = iprot.readString(); { org.apache.thrift.protocol.TList _list42 = iprot.readListBegin(); @@ -827,7 +827,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, PrincipalPrivilegeSe for (int _i58 = 0; _i58 < _map57.size; ++_i58) { String _key59; // required - List _val60; // required + List _val60; // optional _key59 = iprot.readString(); { org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); @@ -852,7 +852,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, PrincipalPrivilegeSe for (int _i65 = 0; _i65 < _map64.size; ++_i65) { String _key66; // required - List _val67; // required + List _val67; // optional _key66 = iprot.readString(); { org.apache.thrift.protocol.TList _list68 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); @@ -877,7 +877,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, PrincipalPrivilegeSe for (int _i72 = 0; _i72 < _map71.size; ++_i72) { String _key73; // required - List _val74; // required + List _val74; // optional _key73 = iprot.readString(); { org.apache.thrift.protocol.TList _list75 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Schema.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Schema.java index f6af8d9..2aa0aed 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Schema.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Schema.java @@ -476,7 +476,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Schema struct) thro for (int _i232 = 0; _i232 < _map231.size; ++_i232) { String _key233; // required - String _val234; // required + String _val234; // optional _key233 = iprot.readString(); _val234 = iprot.readString(); struct.properties.put(_key233, _val234); @@ -597,7 +597,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Schema struct) throw for (int _i243 = 0; _i243 < _map242.size; ++_i243) { String _key244; // required - String _val245; // required + String _val245; // optional _key244 = iprot.readString(); _val245 = iprot.readString(); struct.properties.put(_key244, _val245); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java index 8299b22..62de891 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java @@ -534,7 +534,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, SerDeInfo struct) t for (int _i89 = 0; _i89 < _map88.size; ++_i89) { String _key90; // required - String _val91; // required + String _val91; // optional _key90 = iprot.readString(); _val91 = iprot.readString(); struct.parameters.put(_key90, _val91); @@ -647,7 +647,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, SerDeInfo struct) th for (int _i95 = 0; _i95 < _map94.size; ++_i95) { String _key96; // required - String _val97; // required + String _val97; // optional _key96 = iprot.readString(); _val97 = iprot.readString(); struct.parameters.put(_key96, _val97); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java index 2ad42a2..018ee77 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java @@ -613,7 +613,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, SkewedInfo struct) for (int _i108 = 0; _i108 < _map107.size; ++_i108) { List _key109; // required - String _val110; // required + String _val110; // optional { org.apache.thrift.protocol.TList _list111 = iprot.readListBegin(); _key109 = new ArrayList(_list111.size); @@ -815,7 +815,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, SkewedInfo struct) t for (int _i134 = 0; _i134 < _map133.size; ++_i134) { List _key135; // required - String _val136; // required + String _val136; // optional { org.apache.thrift.protocol.TList _list137 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); _key135 = new ArrayList(_list137.size); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java index 0a2f2c2..dd73bb7 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java @@ -1410,7 +1410,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, StorageDescriptor s for (int _i150 = 0; _i150 < _map149.size; ++_i150) { String _key151; // required - String _val152; // required + String _val152; // optional _key151 = iprot.readString(); _val152 = iprot.readString(); struct.parameters.put(_key151, _val152); @@ -1734,7 +1734,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, StorageDescriptor st for (int _i171 = 0; _i171 < _map170.size; ++_i171) { String _key172; // required - String _val173; // required + String _val173; // optional _key172 = iprot.readString(); _val173 = iprot.readString(); struct.parameters.put(_key172, _val173); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java index 377cafe..97915c3 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java @@ -1423,7 +1423,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Table struct) throw for (int _i178 = 0; _i178 < _map177.size; ++_i178) { String _key179; // required - String _val180; // required + String _val180; // optional _key179 = iprot.readString(); _val180 = iprot.readString(); struct.parameters.put(_key179, _val180); @@ -1723,7 +1723,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Table struct) throws for (int _i189 = 0; _i189 < _map188.size; ++_i189) { String _key190; // required - String _val191; // required + String _val191; // optional _key190 = iprot.readString(); _val191 = iprot.readString(); struct.parameters.put(_key190, _val191); diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java index 4f34b18..99b2153 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java @@ -17468,7 +17468,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, get_type_all_result for (int _i273 = 0; _i273 < _map272.size; ++_i273) { String _key274; // required - Type _val275; // required + Type _val275; // optional _key274 = iprot.readString(); _val275 = new Type(); _val275.read(iprot); @@ -17572,7 +17572,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, get_type_all_result for (int _i279 = 0; _i279 < _map278.size; ++_i279) { String _key280; // required - Type _val281; // required + Type _val281; // optional _key280 = iprot.readString(); _val281 = new Type(); _val281.read(iprot); @@ -47656,7 +47656,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, exchange_partition_ for (int _i387 = 0; _i387 < _map386.size; ++_i387) { String _key388; // required - String _val389; // required + String _val389; // optional _key388 = iprot.readString(); _val389 = iprot.readString(); struct.partitionSpecs.put(_key388, _val389); @@ -47815,7 +47815,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, exchange_partition_a for (int _i393 = 0; _i393 < _map392.size; ++_i393) { String _key394; // required - String _val395; // required + String _val395; // optional _key394 = iprot.readString(); _val395 = iprot.readString(); struct.partitionSpecs.put(_key394, _val395); @@ -69781,7 +69781,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, partition_name_to_s for (int _i557 = 0; _i557 < _map556.size; ++_i557) { String _key558; // required - String _val559; // required + String _val559; // optional _key558 = iprot.readString(); _val559 = iprot.readString(); struct.success.put(_key558, _val559); @@ -69884,7 +69884,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, partition_name_to_sp for (int _i563 = 0; _i563 < _map562.size; ++_i563) { String _key564; // required - String _val565; // required + String _val565; // optional _key564 = iprot.readString(); _val565 = iprot.readString(); struct.success.put(_key564, _val565); @@ -70498,7 +70498,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, markPartitionForEve for (int _i567 = 0; _i567 < _map566.size; ++_i567) { String _key568; // required - String _val569; // required + String _val569; // optional _key568 = iprot.readString(); _val569 = iprot.readString(); struct.part_vals.put(_key568, _val569); @@ -70630,7 +70630,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, markPartitionForEven for (int _i573 = 0; _i573 < _map572.size; ++_i573) { String _key574; // required - String _val575; // required + String _val575; // optional _key574 = iprot.readString(); _val575 = iprot.readString(); struct.part_vals.put(_key574, _val575); @@ -72133,7 +72133,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, isPartitionMarkedFo for (int _i577 = 0; _i577 < _map576.size; ++_i577) { String _key578; // required - String _val579; // required + String _val579; // optional _key578 = iprot.readString(); _val579 = iprot.readString(); struct.part_vals.put(_key578, _val579); @@ -72265,7 +72265,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, isPartitionMarkedFor for (int _i583 = 0; _i583 < _map582.size; ++_i583) { String _key584; // required - String _val585; // required + String _val585; // optional _key584 = iprot.readString(); _val585 = iprot.readString(); struct.part_vals.put(_key584, _val585); 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/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Operator.java ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Operator.java index f1c9e2d..47079ce 100644 --- ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Operator.java +++ ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Operator.java @@ -810,7 +810,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Operator struct) th for (int _i25 = 0; _i25 < _map24.size; ++_i25) { String _key26; // required - String _val27; // required + String _val27; // optional _key26 = iprot.readString(); _val27 = iprot.readString(); struct.operatorAttributes.put(_key26, _val27); @@ -830,7 +830,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Operator struct) th for (int _i29 = 0; _i29 < _map28.size; ++_i29) { String _key30; // required - long _val31; // required + long _val31; // optional _key30 = iprot.readString(); _val31 = iprot.readI64(); struct.operatorCounters.put(_key30, _val31); @@ -1003,7 +1003,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Operator struct) thr for (int _i37 = 0; _i37 < _map36.size; ++_i37) { String _key38; // required - String _val39; // required + String _val39; // optional _key38 = iprot.readString(); _val39 = iprot.readString(); struct.operatorAttributes.put(_key38, _val39); @@ -1018,7 +1018,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Operator struct) thr for (int _i41 = 0; _i41 < _map40.size; ++_i41) { String _key42; // required - long _val43; // required + long _val43; // optional _key42 = iprot.readString(); _val43 = iprot.readI64(); struct.operatorCounters.put(_key42, _val43); diff --git ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Query.java ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Query.java index e0d77e8..0a10e54 100644 --- ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Query.java +++ ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Query.java @@ -983,7 +983,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Query struct) throw for (int _i101 = 0; _i101 < _map100.size; ++_i101) { String _key102; // required - String _val103; // required + String _val103; // optional _key102 = iprot.readString(); _val103 = iprot.readString(); struct.queryAttributes.put(_key102, _val103); @@ -1003,7 +1003,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Query struct) throw for (int _i105 = 0; _i105 < _map104.size; ++_i105) { String _key106; // required - long _val107; // required + long _val107; // optional _key106 = iprot.readString(); _val107 = iprot.readI64(); struct.queryCounters.put(_key106, _val107); @@ -1239,7 +1239,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Query struct) throws for (int _i118 = 0; _i118 < _map117.size; ++_i118) { String _key119; // required - String _val120; // required + String _val120; // optional _key119 = iprot.readString(); _val120 = iprot.readString(); struct.queryAttributes.put(_key119, _val120); @@ -1254,7 +1254,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Query struct) throws for (int _i122 = 0; _i122 < _map121.size; ++_i122) { String _key123; // required - long _val124; // required + long _val124; // optional _key123 = iprot.readString(); _val124 = iprot.readI64(); struct.queryCounters.put(_key123, _val124); diff --git ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Stage.java ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Stage.java index c341db2..cf2a52b 100644 --- ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Stage.java +++ ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Stage.java @@ -911,7 +911,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Stage struct) throw for (int _i73 = 0; _i73 < _map72.size; ++_i73) { String _key74; // required - String _val75; // required + String _val75; // optional _key74 = iprot.readString(); _val75 = iprot.readString(); struct.stageAttributes.put(_key74, _val75); @@ -931,7 +931,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Stage struct) throw for (int _i77 = 0; _i77 < _map76.size; ++_i77) { String _key78; // required - long _val79; // required + long _val79; // optional _key78 = iprot.readString(); _val79 = iprot.readI64(); struct.stageCounters.put(_key78, _val79); @@ -1147,7 +1147,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Stage struct) throws for (int _i90 = 0; _i90 < _map89.size; ++_i90) { String _key91; // required - String _val92; // required + String _val92; // optional _key91 = iprot.readString(); _val92 = iprot.readString(); struct.stageAttributes.put(_key91, _val92); @@ -1162,7 +1162,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Stage struct) throws for (int _i94 = 0; _i94 < _map93.size; ++_i94) { String _key95; // required - long _val96; // required + long _val96; // optional _key95 = iprot.readString(); _val96 = iprot.readI64(); struct.stageCounters.put(_key95, _val96); diff --git ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Task.java ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Task.java index fc4313f..f7bfabf 100644 --- ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Task.java +++ ql/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/ql/plan/api/Task.java @@ -996,7 +996,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Task struct) throws for (int _i45 = 0; _i45 < _map44.size; ++_i45) { String _key46; // required - String _val47; // required + String _val47; // optional _key46 = iprot.readString(); _val47 = iprot.readString(); struct.taskAttributes.put(_key46, _val47); @@ -1016,7 +1016,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Task struct) throws for (int _i49 = 0; _i49 < _map48.size; ++_i49) { String _key50; // required - long _val51; // required + long _val51; // optional _key50 = iprot.readString(); _val51 = iprot.readI64(); struct.taskCounters.put(_key50, _val51); @@ -1256,7 +1256,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Task struct) throws for (int _i62 = 0; _i62 < _map61.size; ++_i62) { String _key63; // required - String _val64; // required + String _val64; // optional _key63 = iprot.readString(); _val64 = iprot.readString(); struct.taskAttributes.put(_key63, _val64); @@ -1271,7 +1271,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Task struct) throws for (int _i66 = 0; _i66 < _map65.size; ++_i66) { String _key67; // required - long _val68; // required + long _val68; // optional _key67 = iprot.readString(); _val68 = iprot.readI64(); struct.taskCounters.put(_key67, _val68); diff --git serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java index dda3c5f..1b708dd 100644 --- serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java +++ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/test/ThriftTestObj.java @@ -528,7 +528,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftTestObj struc struct.field3 = new ArrayList(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - InnerStruct _elem2; // optional + InnerStruct _elem2; // required _elem2 = new InnerStruct(); _elem2.read(iprot); struct.field3.add(_elem2); @@ -636,7 +636,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, ThriftTestObj struct struct.field3 = new ArrayList(_list5.size); for (int _i6 = 0; _i6 < _list5.size; ++_i6) { - InnerStruct _elem7; // optional + InnerStruct _elem7; // required _elem7 = new InnerStruct(); _elem7.read(iprot); struct.field3.add(_elem7); diff --git serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java index aa404bf..71e836c 100644 --- serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java +++ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/Complex.java @@ -836,7 +836,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr struct.lint = new ArrayList(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - int _elem2; // optional + int _elem2; // required _elem2 = iprot.readI32(); struct.lint.add(_elem2); } @@ -854,7 +854,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr struct.lString = new ArrayList(_list3.size); for (int _i4 = 0; _i4 < _list3.size; ++_i4) { - String _elem5; // optional + String _elem5; // required _elem5 = iprot.readString(); struct.lString.add(_elem5); } @@ -872,7 +872,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr struct.lintString = new ArrayList(_list6.size); for (int _i7 = 0; _i7 < _list6.size; ++_i7) { - IntString _elem8; // optional + IntString _elem8; // required _elem8 = new IntString(); _elem8.read(iprot); struct.lintString.add(_elem8); @@ -892,7 +892,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, Complex struct) thr for (int _i10 = 0; _i10 < _map9.size; ++_i10) { String _key11; // required - String _val12; // required + String _val12; // optional _key11 = iprot.readString(); _val12 = iprot.readString(); struct.mStringString.put(_key11, _val12); @@ -1074,7 +1074,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro struct.lint = new ArrayList(_list21.size); for (int _i22 = 0; _i22 < _list21.size; ++_i22) { - int _elem23; // optional + int _elem23; // required _elem23 = iprot.readI32(); struct.lint.add(_elem23); } @@ -1087,7 +1087,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro struct.lString = new ArrayList(_list24.size); for (int _i25 = 0; _i25 < _list24.size; ++_i25) { - String _elem26; // optional + String _elem26; // required _elem26 = iprot.readString(); struct.lString.add(_elem26); } @@ -1100,7 +1100,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro struct.lintString = new ArrayList(_list27.size); for (int _i28 = 0; _i28 < _list27.size; ++_i28) { - IntString _elem29; // optional + IntString _elem29; // required _elem29 = new IntString(); _elem29.read(iprot); struct.lintString.add(_elem29); @@ -1115,7 +1115,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, Complex struct) thro for (int _i31 = 0; _i31 < _map30.size; ++_i31) { String _key32; // required - String _val33; // required + String _val33; // optional _key32 = iprot.readString(); _val33 = iprot.readString(); struct.mStringString.put(_key32, _val33); diff --git serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java index fba49e4..b41eb82 100644 --- serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java +++ serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde2/thrift/test/MegaStruct.java @@ -2192,7 +2192,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i1 = 0; _i1 < _map0.size; ++_i1) { String _key2; // required - String _val3; // required + String _val3; // optional _key2 = iprot.readString(); _val3 = iprot.readString(); struct.my_string_string_map.put(_key2, _val3); @@ -2212,7 +2212,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i5 = 0; _i5 < _map4.size; ++_i5) { String _key6; // required - MyEnum _val7; // required + MyEnum _val7; // optional _key6 = iprot.readString(); _val7 = MyEnum.findByValue(iprot.readI32()); struct.my_string_enum_map.put(_key6, _val7); @@ -2232,7 +2232,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i9 = 0; _i9 < _map8.size; ++_i9) { MyEnum _key10; // required - String _val11; // required + String _val11; // optional _key10 = MyEnum.findByValue(iprot.readI32()); _val11 = iprot.readString(); struct.my_enum_string_map.put(_key10, _val11); @@ -2252,7 +2252,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i13 = 0; _i13 < _map12.size; ++_i13) { MyEnum _key14; // required - MiniStruct _val15; // required + MiniStruct _val15; // optional _key14 = MyEnum.findByValue(iprot.readI32()); _val15 = new MiniStruct(); _val15.read(iprot); @@ -2273,14 +2273,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i17 = 0; _i17 < _map16.size; ++_i17) { MyEnum _key18; // required - List _val19; // required + List _val19; // optional _key18 = MyEnum.findByValue(iprot.readI32()); { org.apache.thrift.protocol.TList _list20 = iprot.readListBegin(); _val19 = new ArrayList(_list20.size); for (int _i21 = 0; _i21 < _list20.size; ++_i21) { - String _elem22; // optional + String _elem22; // required _elem22 = iprot.readString(); _val19.add(_elem22); } @@ -2303,14 +2303,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) for (int _i24 = 0; _i24 < _map23.size; ++_i24) { MyEnum _key25; // required - List _val26; // required + List _val26; // optional _key25 = MyEnum.findByValue(iprot.readI32()); { org.apache.thrift.protocol.TList _list27 = iprot.readListBegin(); _val26 = new ArrayList(_list27.size); for (int _i28 = 0; _i28 < _list27.size; ++_i28) { - MiniStruct _elem29; // optional + MiniStruct _elem29; // required _elem29 = new MiniStruct(); _elem29.read(iprot); _val26.add(_elem29); @@ -2333,7 +2333,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_stringlist = new ArrayList(_list30.size); for (int _i31 = 0; _i31 < _list30.size; ++_i31) { - String _elem32; // optional + String _elem32; // required _elem32 = iprot.readString(); struct.my_stringlist.add(_elem32); } @@ -2351,7 +2351,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_structlist = new ArrayList(_list33.size); for (int _i34 = 0; _i34 < _list33.size; ++_i34) { - MiniStruct _elem35; // optional + MiniStruct _elem35; // required _elem35 = new MiniStruct(); _elem35.read(iprot); struct.my_structlist.add(_elem35); @@ -2370,7 +2370,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_enumlist = new ArrayList(_list36.size); for (int _i37 = 0; _i37 < _list36.size; ++_i37) { - MyEnum _elem38; // optional + MyEnum _elem38; // required _elem38 = MyEnum.findByValue(iprot.readI32()); struct.my_enumlist.add(_elem38); } @@ -2388,7 +2388,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_stringset = new HashSet(2*_set39.size); for (int _i40 = 0; _i40 < _set39.size; ++_i40) { - String _elem41; // optional + String _elem41; // required _elem41 = iprot.readString(); struct.my_stringset.add(_elem41); } @@ -2406,7 +2406,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_enumset = new HashSet(2*_set42.size); for (int _i43 = 0; _i43 < _set42.size; ++_i43) { - MyEnum _elem44; // optional + MyEnum _elem44; // required _elem44 = MyEnum.findByValue(iprot.readI32()); struct.my_enumset.add(_elem44); } @@ -2424,7 +2424,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, MegaStruct struct) struct.my_structset = new HashSet(2*_set45.size); for (int _i46 = 0; _i46 < _set45.size; ++_i46) { - MiniStruct _elem47; // optional + MiniStruct _elem47; // required _elem47 = new MiniStruct(); _elem47.read(iprot); struct.my_structset.add(_elem47); @@ -2955,7 +2955,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t for (int _i77 = 0; _i77 < _map76.size; ++_i77) { String _key78; // required - String _val79; // required + String _val79; // optional _key78 = iprot.readString(); _val79 = iprot.readString(); struct.my_string_string_map.put(_key78, _val79); @@ -2970,7 +2970,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t for (int _i81 = 0; _i81 < _map80.size; ++_i81) { String _key82; // required - MyEnum _val83; // required + MyEnum _val83; // optional _key82 = iprot.readString(); _val83 = MyEnum.findByValue(iprot.readI32()); struct.my_string_enum_map.put(_key82, _val83); @@ -2985,7 +2985,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t for (int _i85 = 0; _i85 < _map84.size; ++_i85) { MyEnum _key86; // required - String _val87; // required + String _val87; // optional _key86 = MyEnum.findByValue(iprot.readI32()); _val87 = iprot.readString(); struct.my_enum_string_map.put(_key86, _val87); @@ -3000,7 +3000,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t for (int _i89 = 0; _i89 < _map88.size; ++_i89) { MyEnum _key90; // required - MiniStruct _val91; // required + MiniStruct _val91; // optional _key90 = MyEnum.findByValue(iprot.readI32()); _val91 = new MiniStruct(); _val91.read(iprot); @@ -3016,14 +3016,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t for (int _i93 = 0; _i93 < _map92.size; ++_i93) { MyEnum _key94; // required - List _val95; // required + List _val95; // optional _key94 = MyEnum.findByValue(iprot.readI32()); { org.apache.thrift.protocol.TList _list96 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); _val95 = new ArrayList(_list96.size); for (int _i97 = 0; _i97 < _list96.size; ++_i97) { - String _elem98; // optional + String _elem98; // required _elem98 = iprot.readString(); _val95.add(_elem98); } @@ -3040,14 +3040,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t for (int _i100 = 0; _i100 < _map99.size; ++_i100) { MyEnum _key101; // required - List _val102; // required + List _val102; // optional _key101 = MyEnum.findByValue(iprot.readI32()); { org.apache.thrift.protocol.TList _list103 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); _val102 = new ArrayList(_list103.size); for (int _i104 = 0; _i104 < _list103.size; ++_i104) { - MiniStruct _elem105; // optional + MiniStruct _elem105; // required _elem105 = new MiniStruct(); _elem105.read(iprot); _val102.add(_elem105); @@ -3064,7 +3064,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_stringlist = new ArrayList(_list106.size); for (int _i107 = 0; _i107 < _list106.size; ++_i107) { - String _elem108; // optional + String _elem108; // required _elem108 = iprot.readString(); struct.my_stringlist.add(_elem108); } @@ -3077,7 +3077,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_structlist = new ArrayList(_list109.size); for (int _i110 = 0; _i110 < _list109.size; ++_i110) { - MiniStruct _elem111; // optional + MiniStruct _elem111; // required _elem111 = new MiniStruct(); _elem111.read(iprot); struct.my_structlist.add(_elem111); @@ -3091,7 +3091,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_enumlist = new ArrayList(_list112.size); for (int _i113 = 0; _i113 < _list112.size; ++_i113) { - MyEnum _elem114; // optional + MyEnum _elem114; // required _elem114 = MyEnum.findByValue(iprot.readI32()); struct.my_enumlist.add(_elem114); } @@ -3104,7 +3104,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_stringset = new HashSet(2*_set115.size); for (int _i116 = 0; _i116 < _set115.size; ++_i116) { - String _elem117; // optional + String _elem117; // required _elem117 = iprot.readString(); struct.my_stringset.add(_elem117); } @@ -3117,7 +3117,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_enumset = new HashSet(2*_set118.size); for (int _i119 = 0; _i119 < _set118.size; ++_i119) { - MyEnum _elem120; // optional + MyEnum _elem120; // required _elem120 = MyEnum.findByValue(iprot.readI32()); struct.my_enumset.add(_elem120); } @@ -3130,7 +3130,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, MegaStruct struct) t struct.my_structset = new HashSet(2*_set121.size); for (int _i122 = 0; _i122 < _set121.size; ++_i122) { - MiniStruct _elem123; // optional + MiniStruct _elem123; // required _elem123 = new MiniStruct(); _elem123.read(iprot); struct.my_structset.add(_elem123); diff --git service/if/TCLIService.thrift service/if/TCLIService.thrift index 6e20375..db50266 100644 --- service/if/TCLIService.thrift +++ service/if/TCLIService.thrift @@ -208,7 +208,7 @@ struct TUnionTypeEntry { } struct TUserDefinedTypeEntry { - // The fully qualified name of the class implementing this type. + // The fully qualified name of the class implementing this type. 1: required string typeClassName } @@ -995,6 +995,22 @@ struct TFetchResultsResp { 3: optional TRowSet results } +// GetLog() +// +// Fetch operation log from the server corresponding to +// a particular OperationHandle. +struct TGetLogReq { + // Operation whose log is requested + 1: required TOperationHandle operationHandle +} + +struct TGetLogResp { + 1: required TStatus status + + 2: required string log + +} + service TCLIService { TOpenSessionResp OpenSession(1:TOpenSessionReq req); @@ -1028,4 +1044,6 @@ service TCLIService { TGetResultSetMetadataResp GetResultSetMetadata(1:TGetResultSetMetadataReq req); TFetchResultsResp FetchResults(1:TFetchResultsReq req); + + TGetLogResp GetLog(1:TGetLogReq req); } diff --git service/src/gen/thrift/gen-cpp/TCLIService.cpp service/src/gen/thrift/gen-cpp/TCLIService.cpp index f8afc09..645c9a6 100644 --- service/src/gen/thrift/gen-cpp/TCLIService.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService.cpp @@ -2600,6 +2600,168 @@ uint32_t TCLIService_FetchResults_presult::read(::apache::thrift::protocol::TPro return xfer; } +uint32_t TCLIService_GetLog_args::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->req.read(iprot); + this->__isset.req = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TCLIService_GetLog_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TCLIService_GetLog_args"); + + xfer += oprot->writeFieldBegin("req", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->req.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t TCLIService_GetLog_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TCLIService_GetLog_pargs"); + + xfer += oprot->writeFieldBegin("req", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->req)).write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t TCLIService_GetLog_result::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 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->success.read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t TCLIService_GetLog_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("TCLIService_GetLog_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); + xfer += this->success.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t TCLIService_GetLog_presult::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 0: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += (*(this->success)).read(iprot); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + void TCLIServiceClient::OpenSession(TOpenSessionResp& _return, const TOpenSessionReq& req) { send_OpenSession(req); @@ -3528,6 +3690,64 @@ void TCLIServiceClient::recv_FetchResults(TFetchResultsResp& _return) throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "FetchResults failed: unknown result"); } +void TCLIServiceClient::GetLog(TGetLogResp& _return, const TGetLogReq& req) +{ + send_GetLog(req); + recv_GetLog(_return); +} + +void TCLIServiceClient::send_GetLog(const TGetLogReq& req) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("GetLog", ::apache::thrift::protocol::T_CALL, cseqid); + + TCLIService_GetLog_pargs args; + args.req = &req; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void TCLIServiceClient::recv_GetLog(TGetLogResp& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("GetLog") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + TCLIService_GetLog_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "GetLog failed: unknown result"); +} + bool TCLIServiceProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { ProcessMap::iterator pfn; pfn = processMap_.find(fname); @@ -4411,6 +4631,60 @@ void TCLIServiceProcessor::process_FetchResults(int32_t seqid, ::apache::thrift: } } +void TCLIServiceProcessor::process_GetLog(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("TCLIService.GetLog", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "TCLIService.GetLog"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "TCLIService.GetLog"); + } + + TCLIService_GetLog_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "TCLIService.GetLog", bytes); + } + + TCLIService_GetLog_result result; + try { + iface_->GetLog(result.success, args.req); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "TCLIService.GetLog"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("GetLog", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "TCLIService.GetLog"); + } + + oprot->writeMessageBegin("GetLog", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "TCLIService.GetLog", bytes); + } +} + ::boost::shared_ptr< ::apache::thrift::TProcessor > TCLIServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< TCLIServiceIfFactory > cleanup(handlerFactory_); ::boost::shared_ptr< TCLIServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup); diff --git service/src/gen/thrift/gen-cpp/TCLIService.h service/src/gen/thrift/gen-cpp/TCLIService.h index 055cfa6..e48b443 100644 --- service/src/gen/thrift/gen-cpp/TCLIService.h +++ service/src/gen/thrift/gen-cpp/TCLIService.h @@ -31,6 +31,7 @@ class TCLIServiceIf { virtual void CloseOperation(TCloseOperationResp& _return, const TCloseOperationReq& req) = 0; virtual void GetResultSetMetadata(TGetResultSetMetadataResp& _return, const TGetResultSetMetadataReq& req) = 0; virtual void FetchResults(TFetchResultsResp& _return, const TFetchResultsReq& req) = 0; + virtual void GetLog(TGetLogResp& _return, const TGetLogReq& req) = 0; }; class TCLIServiceIfFactory { @@ -108,6 +109,9 @@ class TCLIServiceNull : virtual public TCLIServiceIf { void FetchResults(TFetchResultsResp& /* _return */, const TFetchResultsReq& /* req */) { return; } + void GetLog(TGetLogResp& /* _return */, const TGetLogReq& /* req */) { + return; + } }; typedef struct _TCLIService_OpenSession_args__isset { @@ -1838,6 +1842,114 @@ class TCLIService_FetchResults_presult { }; +typedef struct _TCLIService_GetLog_args__isset { + _TCLIService_GetLog_args__isset() : req(false) {} + bool req; +} _TCLIService_GetLog_args__isset; + +class TCLIService_GetLog_args { + public: + + TCLIService_GetLog_args() { + } + + virtual ~TCLIService_GetLog_args() throw() {} + + TGetLogReq req; + + _TCLIService_GetLog_args__isset __isset; + + void __set_req(const TGetLogReq& val) { + req = val; + } + + bool operator == (const TCLIService_GetLog_args & rhs) const + { + if (!(req == rhs.req)) + return false; + return true; + } + bool operator != (const TCLIService_GetLog_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetLog_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class TCLIService_GetLog_pargs { + public: + + + virtual ~TCLIService_GetLog_pargs() throw() {} + + const TGetLogReq* req; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetLog_result__isset { + _TCLIService_GetLog_result__isset() : success(false) {} + bool success; +} _TCLIService_GetLog_result__isset; + +class TCLIService_GetLog_result { + public: + + TCLIService_GetLog_result() { + } + + virtual ~TCLIService_GetLog_result() throw() {} + + TGetLogResp success; + + _TCLIService_GetLog_result__isset __isset; + + void __set_success(const TGetLogResp& val) { + success = val; + } + + bool operator == (const TCLIService_GetLog_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const TCLIService_GetLog_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCLIService_GetLog_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _TCLIService_GetLog_presult__isset { + _TCLIService_GetLog_presult__isset() : success(false) {} + bool success; +} _TCLIService_GetLog_presult__isset; + +class TCLIService_GetLog_presult { + public: + + + virtual ~TCLIService_GetLog_presult() throw() {} + + TGetLogResp* success; + + _TCLIService_GetLog_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + class TCLIServiceClient : virtual public TCLIServiceIf { public: TCLIServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : @@ -1906,6 +2018,9 @@ class TCLIServiceClient : virtual public TCLIServiceIf { void FetchResults(TFetchResultsResp& _return, const TFetchResultsReq& req); void send_FetchResults(const TFetchResultsReq& req); void recv_FetchResults(TFetchResultsResp& _return); + void GetLog(TGetLogResp& _return, const TGetLogReq& req); + void send_GetLog(const TGetLogReq& req); + void recv_GetLog(TGetLogResp& _return); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; @@ -1937,6 +2052,7 @@ class TCLIServiceProcessor : public ::apache::thrift::TDispatchProcessor { void process_CloseOperation(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_GetResultSetMetadata(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_FetchResults(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_GetLog(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: TCLIServiceProcessor(boost::shared_ptr iface) : iface_(iface) { @@ -1956,6 +2072,7 @@ class TCLIServiceProcessor : public ::apache::thrift::TDispatchProcessor { processMap_["CloseOperation"] = &TCLIServiceProcessor::process_CloseOperation; processMap_["GetResultSetMetadata"] = &TCLIServiceProcessor::process_GetResultSetMetadata; processMap_["FetchResults"] = &TCLIServiceProcessor::process_FetchResults; + processMap_["GetLog"] = &TCLIServiceProcessor::process_GetLog; } virtual ~TCLIServiceProcessor() {} @@ -2144,6 +2261,16 @@ class TCLIServiceMultiface : virtual public TCLIServiceIf { return; } + void GetLog(TGetLogResp& _return, const TGetLogReq& req) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->GetLog(_return, req); + } + ifaces_[i]->GetLog(_return, req); + return; + } + }; }}}}} // namespace diff --git service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp index d1d31cb..df99f93 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService_server.skeleton.cpp @@ -102,6 +102,11 @@ class TCLIServiceHandler : virtual public TCLIServiceIf { printf("FetchResults\n"); } + void GetLog(TGetLogResp& _return, const TGetLogReq& req) { + // Your implementation goes here + printf("GetLog\n"); + } + }; int main(int argc, char **argv) { diff --git service/src/gen/thrift/gen-cpp/TCLIService_types.cpp service/src/gen/thrift/gen-cpp/TCLIService_types.cpp index a3fd46c..8611f62 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_types.cpp +++ service/src/gen/thrift/gen-cpp/TCLIService_types.cpp @@ -5603,4 +5603,148 @@ void swap(TFetchResultsResp &a, TFetchResultsResp &b) { swap(a.__isset, b.__isset); } +const char* TGetLogReq::ascii_fingerprint = "414FA38522AE6B9CEC1438B56CA1DE5A"; +const uint8_t TGetLogReq::binary_fingerprint[16] = {0x41,0x4F,0xA3,0x85,0x22,0xAE,0x6B,0x9C,0xEC,0x14,0x38,0xB5,0x6C,0xA1,0xDE,0x5A}; + +uint32_t TGetLogReq::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_operationHandle = 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_STRUCT) { + xfer += this->operationHandle.read(iprot); + isset_operationHandle = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_operationHandle) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetLogReq::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TGetLogReq"); + + xfer += oprot->writeFieldBegin("operationHandle", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->operationHandle.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetLogReq &a, TGetLogReq &b) { + using ::std::swap; + swap(a.operationHandle, b.operationHandle); +} + +const char* TGetLogResp::ascii_fingerprint = "08A7F68AF7400F358E5CF08185165CB7"; +const uint8_t TGetLogResp::binary_fingerprint[16] = {0x08,0xA7,0xF6,0x8A,0xF7,0x40,0x0F,0x35,0x8E,0x5C,0xF0,0x81,0x85,0x16,0x5C,0xB7}; + +uint32_t TGetLogResp::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_status = false; + bool isset_log = 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_STRUCT) { + xfer += this->status.read(iprot); + isset_status = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->log); + isset_log = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_status) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_log) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t TGetLogResp::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("TGetLogResp"); + + xfer += oprot->writeFieldBegin("status", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->status.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("log", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->log); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TGetLogResp &a, TGetLogResp &b) { + using ::std::swap; + swap(a.status, b.status); + swap(a.log, b.log); +} + }}}}} // namespace diff --git service/src/gen/thrift/gen-cpp/TCLIService_types.h service/src/gen/thrift/gen-cpp/TCLIService_types.h index 490b393..761786a 100644 --- service/src/gen/thrift/gen-cpp/TCLIService_types.h +++ service/src/gen/thrift/gen-cpp/TCLIService_types.h @@ -3321,6 +3321,87 @@ class TFetchResultsResp { void swap(TFetchResultsResp &a, TFetchResultsResp &b); + +class TGetLogReq { + public: + + static const char* ascii_fingerprint; // = "414FA38522AE6B9CEC1438B56CA1DE5A"; + static const uint8_t binary_fingerprint[16]; // = {0x41,0x4F,0xA3,0x85,0x22,0xAE,0x6B,0x9C,0xEC,0x14,0x38,0xB5,0x6C,0xA1,0xDE,0x5A}; + + TGetLogReq() { + } + + virtual ~TGetLogReq() throw() {} + + TOperationHandle operationHandle; + + void __set_operationHandle(const TOperationHandle& val) { + operationHandle = val; + } + + bool operator == (const TGetLogReq & rhs) const + { + if (!(operationHandle == rhs.operationHandle)) + return false; + return true; + } + bool operator != (const TGetLogReq &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetLogReq & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TGetLogReq &a, TGetLogReq &b); + + +class TGetLogResp { + public: + + static const char* ascii_fingerprint; // = "08A7F68AF7400F358E5CF08185165CB7"; + static const uint8_t binary_fingerprint[16]; // = {0x08,0xA7,0xF6,0x8A,0xF7,0x40,0x0F,0x35,0x8E,0x5C,0xF0,0x81,0x85,0x16,0x5C,0xB7}; + + TGetLogResp() : log() { + } + + virtual ~TGetLogResp() throw() {} + + TStatus status; + std::string log; + + void __set_status(const TStatus& val) { + status = val; + } + + void __set_log(const std::string& val) { + log = val; + } + + bool operator == (const TGetLogResp & rhs) const + { + if (!(status == rhs.status)) + return false; + if (!(log == rhs.log)) + return false; + return true; + } + bool operator != (const TGetLogResp &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TGetLogResp & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TGetLogResp &a, TGetLogResp &b); + }}}}} // namespace #endif diff --git service/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java service/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java index 1c44789..745e6cc 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java +++ service/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java @@ -3023,7 +3023,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, fetchN_result struc struct.success = new ArrayList(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { - String _elem2; // optional + String _elem2; // required _elem2 = iprot.readString(); struct.success.add(_elem2); } @@ -3122,7 +3122,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, fetchN_result struct struct.success = new ArrayList(_list5.size); for (int _i6 = 0; _i6 < _list5.size; ++_i6) { - String _elem7; // optional + String _elem7; // required _elem7 = iprot.readString(); struct.success.add(_elem7); } @@ -3785,7 +3785,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, fetchAll_result str struct.success = new ArrayList(_list8.size); for (int _i9 = 0; _i9 < _list8.size; ++_i9) { - String _elem10; // optional + String _elem10; // required _elem10 = iprot.readString(); struct.success.add(_elem10); } @@ -3884,7 +3884,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, fetchAll_result stru struct.success = new ArrayList(_list13.size); for (int _i14 = 0; _i14 < _list13.size; ++_i14) { - String _elem15; // optional + String _elem15; // required _elem15 = iprot.readString(); struct.success.add(_elem15); } diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java index b296c66..3e628dd 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TCLIService.java @@ -67,6 +67,8 @@ public TFetchResultsResp FetchResults(TFetchResultsReq req) throws org.apache.thrift.TException; + public TGetLogResp GetLog(TGetLogReq req) throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -103,6 +105,8 @@ public void FetchResults(TFetchResultsReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void GetLog(TGetLogReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -493,6 +497,29 @@ public TFetchResultsResp recv_FetchResults() throws org.apache.thrift.TException throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "FetchResults failed: unknown result"); } + public TGetLogResp GetLog(TGetLogReq req) throws org.apache.thrift.TException + { + send_GetLog(req); + return recv_GetLog(); + } + + public void send_GetLog(TGetLogReq req) throws org.apache.thrift.TException + { + GetLog_args args = new GetLog_args(); + args.setReq(req); + sendBase("GetLog", args); + } + + public TGetLogResp recv_GetLog() throws org.apache.thrift.TException + { + GetLog_result result = new GetLog_result(); + receiveBase(result, "GetLog"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "GetLog failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { @@ -1023,6 +1050,38 @@ public TFetchResultsResp getResult() throws org.apache.thrift.TException { } } + public void GetLog(TGetLogReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + GetLog_call method_call = new GetLog_call(req, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class GetLog_call extends org.apache.thrift.async.TAsyncMethodCall { + private TGetLogReq req; + public GetLog_call(TGetLogReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.req = req; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("GetLog", org.apache.thrift.protocol.TMessageType.CALL, 0)); + GetLog_args args = new GetLog_args(); + args.setReq(req); + args.write(prot); + prot.writeMessageEnd(); + } + + public TGetLogResp getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_GetLog(); + } + } + } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -1052,6 +1111,7 @@ protected Processor(I iface, Map extends org.apache.thrift.ProcessFunction { + public GetLog() { + super("GetLog"); + } + + public GetLog_args getEmptyArgsInstance() { + return new GetLog_args(); + } + + protected boolean isOneway() { + return false; + } + + public GetLog_result getResult(I iface, GetLog_args args) throws org.apache.thrift.TException { + GetLog_result result = new GetLog_result(); + result.success = iface.GetLog(args.req); + return result; + } + } + } public static class OpenSession_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { @@ -12993,4 +13073,730 @@ public void read(org.apache.thrift.protocol.TProtocol prot, FetchResults_result } + public static class GetLog_args 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("GetLog_args"); + + private static final org.apache.thrift.protocol.TField REQ_FIELD_DESC = new org.apache.thrift.protocol.TField("req", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new GetLog_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetLog_argsTupleSchemeFactory()); + } + + private TGetLogReq req; // 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 { + REQ((short)1, "req"); + + 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: // REQ + return REQ; + 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.REQ, new org.apache.thrift.meta_data.FieldMetaData("req", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetLogReq.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetLog_args.class, metaDataMap); + } + + public GetLog_args() { + } + + public GetLog_args( + TGetLogReq req) + { + this(); + this.req = req; + } + + /** + * Performs a deep copy on other. + */ + public GetLog_args(GetLog_args other) { + if (other.isSetReq()) { + this.req = new TGetLogReq(other.req); + } + } + + public GetLog_args deepCopy() { + return new GetLog_args(this); + } + + @Override + public void clear() { + this.req = null; + } + + public TGetLogReq getReq() { + return this.req; + } + + public void setReq(TGetLogReq req) { + this.req = req; + } + + public void unsetReq() { + this.req = null; + } + + /** Returns true if field req is set (has been assigned a value) and false otherwise */ + public boolean isSetReq() { + return this.req != null; + } + + public void setReqIsSet(boolean value) { + if (!value) { + this.req = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case REQ: + if (value == null) { + unsetReq(); + } else { + setReq((TGetLogReq)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case REQ: + return getReq(); + + } + 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 REQ: + return isSetReq(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof GetLog_args) + return this.equals((GetLog_args)that); + return false; + } + + public boolean equals(GetLog_args that) { + if (that == null) + return false; + + boolean this_present_req = true && this.isSetReq(); + boolean that_present_req = true && that.isSetReq(); + if (this_present_req || that_present_req) { + if (!(this_present_req && that_present_req)) + return false; + if (!this.req.equals(that.req)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_req = true && (isSetReq()); + builder.append(present_req); + if (present_req) + builder.append(req); + + return builder.toHashCode(); + } + + public int compareTo(GetLog_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + GetLog_args typedOther = (GetLog_args)other; + + lastComparison = Boolean.valueOf(isSetReq()).compareTo(typedOther.isSetReq()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReq()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.req, typedOther.req); + 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("GetLog_args("); + boolean first = true; + + sb.append("req:"); + if (this.req == null) { + sb.append("null"); + } else { + sb.append(this.req); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (req != null) { + req.validate(); + } + } + + 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 GetLog_argsStandardSchemeFactory implements SchemeFactory { + public GetLog_argsStandardScheme getScheme() { + return new GetLog_argsStandardScheme(); + } + } + + private static class GetLog_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetLog_args 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: // REQ + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.req = new TGetLogReq(); + struct.req.read(iprot); + struct.setReqIsSet(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, GetLog_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.req != null) { + oprot.writeFieldBegin(REQ_FIELD_DESC); + struct.req.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class GetLog_argsTupleSchemeFactory implements SchemeFactory { + public GetLog_argsTupleScheme getScheme() { + return new GetLog_argsTupleScheme(); + } + } + + private static class GetLog_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetLog_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetReq()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetReq()) { + struct.req.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, GetLog_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.req = new TGetLogReq(); + struct.req.read(iprot); + struct.setReqIsSet(true); + } + } + } + + } + + public static class GetLog_result 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("GetLog_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new GetLog_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new GetLog_resultTupleSchemeFactory()); + } + + private TGetLogResp success; // 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 { + SUCCESS((short)0, "success"); + + 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 0: // SUCCESS + return SUCCESS; + 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetLogResp.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetLog_result.class, metaDataMap); + } + + public GetLog_result() { + } + + public GetLog_result( + TGetLogResp success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public GetLog_result(GetLog_result other) { + if (other.isSetSuccess()) { + this.success = new TGetLogResp(other.success); + } + } + + public GetLog_result deepCopy() { + return new GetLog_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TGetLogResp getSuccess() { + return this.success; + } + + public void setSuccess(TGetLogResp success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TGetLogResp)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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 SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof GetLog_result) + return this.equals((GetLog_result)that); + return false; + } + + public boolean equals(GetLog_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_success = true && (isSetSuccess()); + builder.append(present_success); + if (present_success) + builder.append(success); + + return builder.toHashCode(); + } + + public int compareTo(GetLog_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + GetLog_result typedOther = (GetLog_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + 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("GetLog_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + 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 GetLog_resultStandardSchemeFactory implements SchemeFactory { + public GetLog_resultStandardScheme getScheme() { + return new GetLog_resultStandardScheme(); + } + } + + private static class GetLog_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, GetLog_result 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 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new TGetLogResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(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, GetLog_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class GetLog_resultTupleSchemeFactory implements SchemeFactory { + public GetLog_resultTupleScheme getScheme() { + return new GetLog_resultTupleScheme(); + } + } + + private static class GetLog_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, GetLog_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, GetLog_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TGetLogResp(); + struct.success.read(iprot); + struct.setSuccessIsSet(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 497cc01..310fbc3 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 @@ -259,7 +259,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip boolColumn = new ArrayList(_list46.size); for (int _i47 = 0; _i47 < _list46.size; ++_i47) { - TBoolValue _elem48; // optional + TBoolValue _elem48; // required _elem48 = new TBoolValue(); _elem48.read(iprot); boolColumn.add(_elem48); @@ -279,7 +279,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip byteColumn = new ArrayList(_list49.size); for (int _i50 = 0; _i50 < _list49.size; ++_i50) { - TByteValue _elem51; // optional + TByteValue _elem51; // required _elem51 = new TByteValue(); _elem51.read(iprot); byteColumn.add(_elem51); @@ -299,7 +299,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip i16Column = new ArrayList(_list52.size); for (int _i53 = 0; _i53 < _list52.size; ++_i53) { - TI16Value _elem54; // optional + TI16Value _elem54; // required _elem54 = new TI16Value(); _elem54.read(iprot); i16Column.add(_elem54); @@ -319,7 +319,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip i32Column = new ArrayList(_list55.size); for (int _i56 = 0; _i56 < _list55.size; ++_i56) { - TI32Value _elem57; // optional + TI32Value _elem57; // required _elem57 = new TI32Value(); _elem57.read(iprot); i32Column.add(_elem57); @@ -339,7 +339,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip i64Column = new ArrayList(_list58.size); for (int _i59 = 0; _i59 < _list58.size; ++_i59) { - TI64Value _elem60; // optional + TI64Value _elem60; // required _elem60 = new TI64Value(); _elem60.read(iprot); i64Column.add(_elem60); @@ -359,7 +359,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip doubleColumn = new ArrayList(_list61.size); for (int _i62 = 0; _i62 < _list61.size; ++_i62) { - TDoubleValue _elem63; // optional + TDoubleValue _elem63; // required _elem63 = new TDoubleValue(); _elem63.read(iprot); doubleColumn.add(_elem63); @@ -379,7 +379,7 @@ protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol ip stringColumn = new ArrayList(_list64.size); for (int _i65 = 0; _i65 < _list64.size; ++_i65) { - TStringValue _elem66; // optional + TStringValue _elem66; // required _elem66 = new TStringValue(); _elem66.read(iprot); stringColumn.add(_elem66); @@ -496,7 +496,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot boolColumn = new ArrayList(_list74.size); for (int _i75 = 0; _i75 < _list74.size; ++_i75) { - TBoolValue _elem76; // optional + TBoolValue _elem76; // required _elem76 = new TBoolValue(); _elem76.read(iprot); boolColumn.add(_elem76); @@ -511,7 +511,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot byteColumn = new ArrayList(_list77.size); for (int _i78 = 0; _i78 < _list77.size; ++_i78) { - TByteValue _elem79; // optional + TByteValue _elem79; // required _elem79 = new TByteValue(); _elem79.read(iprot); byteColumn.add(_elem79); @@ -526,7 +526,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot i16Column = new ArrayList(_list80.size); for (int _i81 = 0; _i81 < _list80.size; ++_i81) { - TI16Value _elem82; // optional + TI16Value _elem82; // required _elem82 = new TI16Value(); _elem82.read(iprot); i16Column.add(_elem82); @@ -541,7 +541,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot i32Column = new ArrayList(_list83.size); for (int _i84 = 0; _i84 < _list83.size; ++_i84) { - TI32Value _elem85; // optional + TI32Value _elem85; // required _elem85 = new TI32Value(); _elem85.read(iprot); i32Column.add(_elem85); @@ -556,7 +556,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot i64Column = new ArrayList(_list86.size); for (int _i87 = 0; _i87 < _list86.size; ++_i87) { - TI64Value _elem88; // optional + TI64Value _elem88; // required _elem88 = new TI64Value(); _elem88.read(iprot); i64Column.add(_elem88); @@ -571,7 +571,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot doubleColumn = new ArrayList(_list89.size); for (int _i90 = 0; _i90 < _list89.size; ++_i90) { - TDoubleValue _elem91; // optional + TDoubleValue _elem91; // required _elem91 = new TDoubleValue(); _elem91.read(iprot); doubleColumn.add(_elem91); @@ -586,7 +586,7 @@ protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot stringColumn = new ArrayList(_list92.size); for (int _i93 = 0; _i93 < _list92.size; ++_i93) { - TStringValue _elem94; // optional + TStringValue _elem94; // required _elem94 = new TStringValue(); _elem94.read(iprot); stringColumn.add(_elem94); 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..012edb5 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 @@ -629,7 +629,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TExecuteStatementRe for (int _i155 = 0; _i155 < _map154.size; ++_i155) { String _key156; // required - String _val157; // required + String _val157; // optional _key156 = iprot.readString(); _val157 = iprot.readString(); struct.confOverlay.put(_key156, _val157); @@ -750,7 +750,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TExecuteStatementReq for (int _i161 = 0; _i161 < _map160.size; ++_i161) { String _key162; // required - String _val163; // required + String _val163; // optional _key162 = iprot.readString(); _val163 = iprot.readString(); struct.confOverlay.put(_key162, _val163); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetLogReq.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetLogReq.java new file mode 100644 index 0000000..48cd64f --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetLogReq.java @@ -0,0 +1,390 @@ +/** + * 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 TGetLogReq 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("TGetLogReq"); + + private static final org.apache.thrift.protocol.TField OPERATION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationHandle", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TGetLogReqStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TGetLogReqTupleSchemeFactory()); + } + + private TOperationHandle operationHandle; // 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 { + OPERATION_HANDLE((short)1, "operationHandle"); + + 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: // OPERATION_HANDLE + return OPERATION_HANDLE; + 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.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetLogReq.class, metaDataMap); + } + + public TGetLogReq() { + } + + public TGetLogReq( + TOperationHandle operationHandle) + { + this(); + this.operationHandle = operationHandle; + } + + /** + * Performs a deep copy on other. + */ + public TGetLogReq(TGetLogReq other) { + if (other.isSetOperationHandle()) { + this.operationHandle = new TOperationHandle(other.operationHandle); + } + } + + public TGetLogReq deepCopy() { + return new TGetLogReq(this); + } + + @Override + public void clear() { + this.operationHandle = null; + } + + public TOperationHandle getOperationHandle() { + return this.operationHandle; + } + + public void setOperationHandle(TOperationHandle operationHandle) { + this.operationHandle = operationHandle; + } + + public void unsetOperationHandle() { + this.operationHandle = null; + } + + /** Returns true if field operationHandle is set (has been assigned a value) and false otherwise */ + public boolean isSetOperationHandle() { + return this.operationHandle != null; + } + + public void setOperationHandleIsSet(boolean value) { + if (!value) { + this.operationHandle = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case OPERATION_HANDLE: + if (value == null) { + unsetOperationHandle(); + } else { + setOperationHandle((TOperationHandle)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case OPERATION_HANDLE: + return getOperationHandle(); + + } + 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 OPERATION_HANDLE: + return isSetOperationHandle(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TGetLogReq) + return this.equals((TGetLogReq)that); + return false; + } + + public boolean equals(TGetLogReq that) { + if (that == null) + return false; + + boolean this_present_operationHandle = true && this.isSetOperationHandle(); + boolean that_present_operationHandle = true && that.isSetOperationHandle(); + if (this_present_operationHandle || that_present_operationHandle) { + if (!(this_present_operationHandle && that_present_operationHandle)) + return false; + if (!this.operationHandle.equals(that.operationHandle)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_operationHandle = true && (isSetOperationHandle()); + builder.append(present_operationHandle); + if (present_operationHandle) + builder.append(operationHandle); + + return builder.toHashCode(); + } + + public int compareTo(TGetLogReq other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TGetLogReq typedOther = (TGetLogReq)other; + + lastComparison = Boolean.valueOf(isSetOperationHandle()).compareTo(typedOther.isSetOperationHandle()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOperationHandle()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, typedOther.operationHandle); + 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("TGetLogReq("); + boolean first = true; + + sb.append("operationHandle:"); + if (this.operationHandle == null) { + sb.append("null"); + } else { + sb.append(this.operationHandle); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetOperationHandle()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'operationHandle' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (operationHandle != null) { + operationHandle.validate(); + } + } + + 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 TGetLogReqStandardSchemeFactory implements SchemeFactory { + public TGetLogReqStandardScheme getScheme() { + return new TGetLogReqStandardScheme(); + } + } + + private static class TGetLogReqStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TGetLogReq 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: // OPERATION_HANDLE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.operationHandle = new TOperationHandle(); + struct.operationHandle.read(iprot); + struct.setOperationHandleIsSet(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, TGetLogReq struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.operationHandle != null) { + oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC); + struct.operationHandle.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TGetLogReqTupleSchemeFactory implements SchemeFactory { + public TGetLogReqTupleScheme getScheme() { + return new TGetLogReqTupleScheme(); + } + } + + private static class TGetLogReqTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TGetLogReq struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.operationHandle.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TGetLogReq struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.operationHandle = new TOperationHandle(); + struct.operationHandle.read(iprot); + struct.setOperationHandleIsSet(true); + } + } + +} + diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetLogResp.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetLogResp.java new file mode 100644 index 0000000..a9e5a4b --- /dev/null +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TGetLogResp.java @@ -0,0 +1,491 @@ +/** + * 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 TGetLogResp 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("TGetLogResp"); + + private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField LOG_FIELD_DESC = new org.apache.thrift.protocol.TField("log", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TGetLogRespStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TGetLogRespTupleSchemeFactory()); + } + + private TStatus status; // required + private String log; // 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 { + STATUS((short)1, "status"), + LOG((short)2, "log"); + + 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: // STATUS + return STATUS; + case 2: // LOG + return LOG; + 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class))); + tmpMap.put(_Fields.LOG, new org.apache.thrift.meta_data.FieldMetaData("log", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetLogResp.class, metaDataMap); + } + + public TGetLogResp() { + } + + public TGetLogResp( + TStatus status, + String log) + { + this(); + this.status = status; + this.log = log; + } + + /** + * Performs a deep copy on other. + */ + public TGetLogResp(TGetLogResp other) { + if (other.isSetStatus()) { + this.status = new TStatus(other.status); + } + if (other.isSetLog()) { + this.log = other.log; + } + } + + public TGetLogResp deepCopy() { + return new TGetLogResp(this); + } + + @Override + public void clear() { + this.status = null; + this.log = null; + } + + public TStatus getStatus() { + return this.status; + } + + public void setStatus(TStatus status) { + this.status = status; + } + + public void unsetStatus() { + this.status = null; + } + + /** Returns true if field status is set (has been assigned a value) and false otherwise */ + public boolean isSetStatus() { + return this.status != null; + } + + public void setStatusIsSet(boolean value) { + if (!value) { + this.status = null; + } + } + + public String getLog() { + return this.log; + } + + public void setLog(String log) { + this.log = log; + } + + public void unsetLog() { + this.log = null; + } + + /** Returns true if field log is set (has been assigned a value) and false otherwise */ + public boolean isSetLog() { + return this.log != null; + } + + public void setLogIsSet(boolean value) { + if (!value) { + this.log = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case STATUS: + if (value == null) { + unsetStatus(); + } else { + setStatus((TStatus)value); + } + break; + + case LOG: + if (value == null) { + unsetLog(); + } else { + setLog((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case STATUS: + return getStatus(); + + case LOG: + return getLog(); + + } + 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 STATUS: + return isSetStatus(); + case LOG: + return isSetLog(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TGetLogResp) + return this.equals((TGetLogResp)that); + return false; + } + + public boolean equals(TGetLogResp that) { + if (that == null) + return false; + + boolean this_present_status = true && this.isSetStatus(); + boolean that_present_status = true && that.isSetStatus(); + if (this_present_status || that_present_status) { + if (!(this_present_status && that_present_status)) + return false; + if (!this.status.equals(that.status)) + return false; + } + + boolean this_present_log = true && this.isSetLog(); + boolean that_present_log = true && that.isSetLog(); + if (this_present_log || that_present_log) { + if (!(this_present_log && that_present_log)) + return false; + if (!this.log.equals(that.log)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + HashCodeBuilder builder = new HashCodeBuilder(); + + boolean present_status = true && (isSetStatus()); + builder.append(present_status); + if (present_status) + builder.append(status); + + boolean present_log = true && (isSetLog()); + builder.append(present_log); + if (present_log) + builder.append(log); + + return builder.toHashCode(); + } + + public int compareTo(TGetLogResp other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TGetLogResp typedOther = (TGetLogResp)other; + + lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetStatus()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLog()).compareTo(typedOther.isSetLog()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLog()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.log, typedOther.log); + 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("TGetLogResp("); + boolean first = true; + + sb.append("status:"); + if (this.status == null) { + sb.append("null"); + } else { + sb.append(this.status); + } + first = false; + if (!first) sb.append(", "); + sb.append("log:"); + if (this.log == null) { + sb.append("null"); + } else { + sb.append(this.log); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetStatus()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString()); + } + + if (!isSetLog()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'log' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + if (status != null) { + status.validate(); + } + } + + 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 TGetLogRespStandardSchemeFactory implements SchemeFactory { + public TGetLogRespStandardScheme getScheme() { + return new TGetLogRespStandardScheme(); + } + } + + private static class TGetLogRespStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TGetLogResp 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: // STATUS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.status = new TStatus(); + struct.status.read(iprot); + struct.setStatusIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // LOG + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.log = iprot.readString(); + struct.setLogIsSet(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, TGetLogResp struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.status != null) { + oprot.writeFieldBegin(STATUS_FIELD_DESC); + struct.status.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.log != null) { + oprot.writeFieldBegin(LOG_FIELD_DESC); + oprot.writeString(struct.log); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TGetLogRespTupleSchemeFactory implements SchemeFactory { + public TGetLogRespTupleScheme getScheme() { + return new TGetLogRespTupleScheme(); + } + } + + private static class TGetLogRespTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TGetLogResp struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.status.write(oprot); + oprot.writeString(struct.log); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TGetLogResp struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.status = new TStatus(); + struct.status.read(iprot); + struct.setStatusIsSet(true); + struct.log = iprot.readString(); + struct.setLogIsSet(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 1cb5147..dfd62ab 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 @@ -715,7 +715,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TGetTablesReq struc struct.tableTypes = new ArrayList(_list164.size); for (int _i165 = 0; _i165 < _list164.size; ++_i165) { - String _elem166; // optional + String _elem166; // required _elem166 = iprot.readString(); struct.tableTypes.add(_elem166); } @@ -856,7 +856,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TGetTablesReq struct struct.tableTypes = new ArrayList(_list169.size); for (int _i170 = 0; _i170 < _list169.size; ++_i170) { - String _elem171; // optional + String _elem171; // required _elem171 = iprot.readString(); struct.tableTypes.add(_elem171); } 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 8ab8297..797c38f 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 @@ -643,7 +643,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TOpenSessionReq str for (int _i135 = 0; _i135 < _map134.size; ++_i135) { String _key136; // required - String _val137; // required + String _val137; // optional _key136 = iprot.readString(); _val137 = iprot.readString(); struct.configuration.put(_key136, _val137); @@ -770,7 +770,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TOpenSessionReq stru for (int _i141 = 0; _i141 < _map140.size; ++_i141) { String _key142; // required - String _val143; // required + String _val143; // optional _key142 = iprot.readString(); _val143 = iprot.readString(); struct.configuration.put(_key142, _val143); 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 5d353f7..93d46d6 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 @@ -655,7 +655,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TOpenSessionResp st for (int _i145 = 0; _i145 < _map144.size; ++_i145) { String _key146; // required - String _val147; // required + String _val147; // optional _key146 = iprot.readString(); _val147 = iprot.readString(); struct.configuration.put(_key146, _val147); @@ -775,7 +775,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TOpenSessionResp str for (int _i151 = 0; _i151 < _map150.size; ++_i151) { String _key152; // required - String _val153; // required + String _val153; // optional _key152 = iprot.readString(); _val153 = iprot.readString(); struct.configuration.put(_key152, _val153); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRow.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRow.java index 0b6772c..b7cb55d 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRow.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TRow.java @@ -354,7 +354,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TRow struct) throws struct.colVals = new ArrayList(_list102.size); for (int _i103 = 0; _i103 < _list102.size; ++_i103) { - TColumnValue _elem104; // optional + TColumnValue _elem104; // required _elem104 = new TColumnValue(); _elem104.read(iprot); struct.colVals.add(_elem104); @@ -425,7 +425,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TRow struct) throws struct.colVals = new ArrayList(_list107.size); for (int _i108 = 0; _i108 < _list107.size; ++_i108) { - TColumnValue _elem109; // optional + TColumnValue _elem109; // required _elem109 = new TColumnValue(); _elem109.read(iprot); struct.colVals.add(_elem109); 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 db2262d..3ab822c 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 @@ -549,7 +549,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TRowSet struct) thr struct.rows = new ArrayList(_list110.size); for (int _i111 = 0; _i111 < _list110.size; ++_i111) { - TRow _elem112; // optional + TRow _elem112; // required _elem112 = new TRow(); _elem112.read(iprot); struct.rows.add(_elem112); @@ -568,7 +568,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TRowSet struct) thr struct.columns = new ArrayList(_list113.size); for (int _i114 = 0; _i114 < _list113.size; ++_i114) { - TColumn _elem115; // optional + TColumn _elem115; // required _elem115 = new TColumn(); _elem115.read(iprot); struct.columns.add(_elem115); @@ -673,7 +673,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) thro struct.rows = new ArrayList(_list120.size); for (int _i121 = 0; _i121 < _list120.size; ++_i121) { - TRow _elem122; // optional + TRow _elem122; // required _elem122 = new TRow(); _elem122.read(iprot); struct.rows.add(_elem122); @@ -687,7 +687,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TRowSet struct) thro struct.columns = new ArrayList(_list123.size); for (int _i124 = 0; _i124 < _list123.size; ++_i124) { - TColumn _elem125; // optional + TColumn _elem125; // required _elem125 = new TColumn(); _elem125.read(iprot); struct.columns.add(_elem125); 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 81c2f16..1143425 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 @@ -698,7 +698,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TStatus struct) thr struct.infoMessages = new ArrayList(_list126.size); for (int _i127 = 0; _i127 < _list126.size; ++_i127) { - String _elem128; // optional + String _elem128; // required _elem128 = iprot.readString(); struct.infoMessages.add(_elem128); } @@ -848,7 +848,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TStatus struct) thro struct.infoMessages = new ArrayList(_list131.size); for (int _i132 = 0; _i132 < _list131.size; ++_i132) { - String _elem133; // optional + String _elem133; // required _elem133 = iprot.readString(); struct.infoMessages.add(_elem133); } diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStructTypeEntry.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStructTypeEntry.java index 20f5fb6..5c2609a 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStructTypeEntry.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TStructTypeEntry.java @@ -360,7 +360,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TStructTypeEntry st for (int _i11 = 0; _i11 < _map10.size; ++_i11) { String _key12; // required - int _val13; // required + int _val13; // optional _key12 = iprot.readString(); _val13 = iprot.readI32(); struct.nameToTypePtr.put(_key12, _val13); @@ -434,7 +434,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TStructTypeEntry str for (int _i17 = 0; _i17 < _map16.size; ++_i17) { String _key18; // required - int _val19; // required + int _val19; // optional _key18 = iprot.readString(); _val19 = iprot.readI32(); struct.nameToTypePtr.put(_key18, _val19); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTableSchema.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTableSchema.java index ff5e54d..e2882c2 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTableSchema.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTableSchema.java @@ -354,7 +354,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TTableSchema struct struct.columns = new ArrayList(_list38.size); for (int _i39 = 0; _i39 < _list38.size; ++_i39) { - TColumnDesc _elem40; // optional + TColumnDesc _elem40; // required _elem40 = new TColumnDesc(); _elem40.read(iprot); struct.columns.add(_elem40); @@ -425,7 +425,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TTableSchema struct) struct.columns = new ArrayList(_list43.size); for (int _i44 = 0; _i44 < _list43.size; ++_i44) { - TColumnDesc _elem45; // optional + TColumnDesc _elem45; // required _elem45 = new TColumnDesc(); _elem45.read(iprot); struct.columns.add(_elem45); diff --git service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeDesc.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeDesc.java index 251f86a..d6a6d23 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeDesc.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TTypeDesc.java @@ -354,7 +354,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TTypeDesc struct) t struct.types = new ArrayList(_list30.size); for (int _i31 = 0; _i31 < _list30.size; ++_i31) { - TTypeEntry _elem32; // optional + TTypeEntry _elem32; // required _elem32 = new TTypeEntry(); _elem32.read(iprot); struct.types.add(_elem32); @@ -425,7 +425,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TTypeDesc struct) th struct.types = new ArrayList(_list35.size); for (int _i36 = 0; _i36 < _list35.size; ++_i36) { - TTypeEntry _elem37; // optional + TTypeEntry _elem37; // required _elem37 = new TTypeEntry(); _elem37.read(iprot); struct.types.add(_elem37); 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-javabean/org/apache/hive/service/cli/thrift/TUnionTypeEntry.java service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TUnionTypeEntry.java index 73dd45d..d7cd264 100644 --- service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TUnionTypeEntry.java +++ service/src/gen/thrift/gen-javabean/org/apache/hive/service/cli/thrift/TUnionTypeEntry.java @@ -360,7 +360,7 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, TUnionTypeEntry str for (int _i21 = 0; _i21 < _map20.size; ++_i21) { String _key22; // required - int _val23; // required + int _val23; // optional _key22 = iprot.readString(); _val23 = iprot.readI32(); struct.nameToTypePtr.put(_key22, _val23); @@ -434,7 +434,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, TUnionTypeEntry stru for (int _i27 = 0; _i27 < _map26.size; ++_i27) { String _key28; // required - int _val29; // required + int _val29; // optional _key28 = iprot.readString(); _val29 = iprot.readI32(); struct.nameToTypePtr.put(_key28, _val29); diff --git service/src/gen/thrift/gen-php/TCLIService.php service/src/gen/thrift/gen-php/TCLIService.php index bbb6b0f..1e51c75 100644 --- service/src/gen/thrift/gen-php/TCLIService.php +++ service/src/gen/thrift/gen-php/TCLIService.php @@ -32,6 +32,7 @@ interface TCLIServiceIf { public function CloseOperation(\TCloseOperationReq $req); public function GetResultSetMetadata(\TGetResultSetMetadataReq $req); public function FetchResults(\TFetchResultsReq $req); + public function GetLog(\TGetLogReq $req); } class TCLIServiceClient implements \TCLIServiceIf { @@ -861,6 +862,57 @@ class TCLIServiceClient implements \TCLIServiceIf { throw new \Exception("FetchResults failed: unknown result"); } + public function GetLog(\TGetLogReq $req) + { + $this->send_GetLog($req); + return $this->recv_GetLog(); + } + + public function send_GetLog(\TGetLogReq $req) + { + $args = new \TCLIService_GetLog_args(); + $args->req = $req; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'GetLog', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('GetLog', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_GetLog() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\TCLIService_GetLog_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new \TCLIService_GetLog_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("GetLog failed: unknown result"); + } + } // HELPER FUNCTIONS AND STRUCTURES @@ -3329,4 +3381,158 @@ class TCLIService_FetchResults_result { } +class TCLIService_GetLog_args { + static $_TSPEC; + + public $req = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'req', + 'type' => TType::STRUCT, + 'class' => '\TGetLogReq', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['req'])) { + $this->req = $vals['req']; + } + } + } + + public function getName() { + return 'TCLIService_GetLog_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRUCT) { + $this->req = new \TGetLogReq(); + $xfer += $this->req->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('TCLIService_GetLog_args'); + if ($this->req !== null) { + if (!is_object($this->req)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('req', TType::STRUCT, 1); + $xfer += $this->req->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TCLIService_GetLog_result { + static $_TSPEC; + + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\TGetLogResp', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'TCLIService_GetLog_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::STRUCT) { + $this->success = new \TGetLogResp(); + $xfer += $this->success->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('TCLIService_GetLog_result'); + if ($this->success !== null) { + if (!is_object($this->success)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); + $xfer += $this->success->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + 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 index ab0d501..3007749 --- service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote +++ service/src/gen/thrift/gen-py/TCLIService/TCLIService-remote @@ -39,6 +39,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' TCloseOperationResp CloseOperation(TCloseOperationReq req)' print ' TGetResultSetMetadataResp GetResultSetMetadata(TGetResultSetMetadataReq req)' print ' TFetchResultsResp FetchResults(TFetchResultsReq req)' + print ' TGetLogResp GetLog(TGetLogReq req)' print '' sys.exit(0) @@ -186,6 +187,12 @@ elif cmd == 'FetchResults': sys.exit(1) pp.pprint(client.FetchResults(eval(args[0]),)) +elif cmd == 'GetLog': + if len(args) != 1: + print 'GetLog requires 1 args' + sys.exit(1) + pp.pprint(client.GetLog(eval(args[0]),)) + else: print 'Unrecognized method %s' % cmd sys.exit(1) diff --git service/src/gen/thrift/gen-py/TCLIService/TCLIService.py service/src/gen/thrift/gen-py/TCLIService/TCLIService.py index 6d2255b..cb2c607 100644 --- service/src/gen/thrift/gen-py/TCLIService/TCLIService.py +++ service/src/gen/thrift/gen-py/TCLIService/TCLIService.py @@ -130,6 +130,13 @@ def FetchResults(self, req): """ pass + def GetLog(self, req): + """ + Parameters: + - req + """ + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -618,6 +625,36 @@ def recv_FetchResults(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "FetchResults failed: unknown result"); + def GetLog(self, req): + """ + Parameters: + - req + """ + self.send_GetLog(req) + return self.recv_GetLog() + + def send_GetLog(self, req): + self._oprot.writeMessageBegin('GetLog', TMessageType.CALL, self._seqid) + args = GetLog_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetLog(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = GetLog_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetLog failed: unknown result"); + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -639,6 +676,7 @@ def __init__(self, handler): self._processMap["CloseOperation"] = Processor.process_CloseOperation self._processMap["GetResultSetMetadata"] = Processor.process_GetResultSetMetadata self._processMap["FetchResults"] = Processor.process_FetchResults + self._processMap["GetLog"] = Processor.process_GetLog def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -831,6 +869,17 @@ def process_FetchResults(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_GetLog(self, seqid, iprot, oprot): + args = GetLog_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetLog_result() + result.success = self._handler.GetLog(args.req) + oprot.writeMessageBegin("GetLog", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -2769,3 +2818,124 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) + +class GetLog_args: + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetLogReq, TGetLogReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + 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.req = TGetLogReq() + self.req.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('GetLog_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.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 GetLog_result: + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetLogResp, TGetLogResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + 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 == 0: + if ftype == TType.STRUCT: + self.success = TGetLogResp() + self.success.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('GetLog_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.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) diff --git service/src/gen/thrift/gen-py/TCLIService/ttypes.py service/src/gen/thrift/gen-py/TCLIService/ttypes.py index b286b05..5bd3867 100644 --- service/src/gen/thrift/gen-py/TCLIService/ttypes.py +++ service/src/gen/thrift/gen-py/TCLIService/ttypes.py @@ -5244,3 +5244,143 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) + +class TGetLogReq: + """ + Attributes: + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, operationHandle=None,): + self.operationHandle = operationHandle + + 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.operationHandle = TOperationHandle() + self.operationHandle.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('TGetLogReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocol.TProtocolException(message='Required field operationHandle 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 TGetLogResp: + """ + Attributes: + - status + - log + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRING, 'log', None, None, ), # 2 + ) + + def __init__(self, status=None, log=None,): + self.status = status + self.log = log + + 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.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.log = 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('TGetLogResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.log is not None: + oprot.writeFieldBegin('log', TType.STRING, 2) + oprot.writeString(self.log) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocol.TProtocolException(message='Required field status is unset!') + if self.log is None: + raise TProtocol.TProtocolException(message='Required field log 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) 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.rb service/src/gen/thrift/gen-rb/t_c_l_i_service.rb index 2455e3b..346fd57 100644 --- service/src/gen/thrift/gen-rb/t_c_l_i_service.rb +++ service/src/gen/thrift/gen-rb/t_c_l_i_service.rb @@ -251,6 +251,21 @@ module TCLIService raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'FetchResults failed: unknown result') end + def GetLog(req) + send_GetLog(req) + return recv_GetLog() + end + + def send_GetLog(req) + send_message('GetLog', GetLog_args, :req => req) + end + + def recv_GetLog() + result = receive_message(GetLog_result) + return result.success unless result.success.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetLog failed: unknown result') + end + end class Processor @@ -368,6 +383,13 @@ module TCLIService write_result(result, oprot, 'FetchResults', seqid) end + def process_GetLog(seqid, iprot, oprot) + args = read_args(iprot, GetLog_args) + result = GetLog_result.new() + result.success = @handler.GetLog(args.req) + write_result(result, oprot, 'GetLog', seqid) + end + end # HELPER FUNCTIONS AND STRUCTURES @@ -884,5 +906,37 @@ module TCLIService ::Thrift::Struct.generate_accessors self end + class GetLog_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQ = 1 + + FIELDS = { + REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::TGetLogReq} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class GetLog_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::TGetLogResp} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + end 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 c608364..a6d7046 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 @@ -1463,3 +1463,40 @@ class TFetchResultsResp ::Thrift::Struct.generate_accessors self end +class TGetLogReq + include ::Thrift::Struct, ::Thrift::Struct_Union + OPERATIONHANDLE = 1 + + FIELDS = { + OPERATIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'operationHandle', :class => ::TOperationHandle} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field operationHandle is unset!') unless @operationHandle + end + + ::Thrift::Struct.generate_accessors self +end + +class TGetLogResp + include ::Thrift::Struct, ::Thrift::Struct_Union + STATUS = 1 + LOG = 2 + + FIELDS = { + STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus}, + LOG => {:type => ::Thrift::Types::STRING, :name => 'log'} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field log is unset!') unless @log + end + + ::Thrift::Struct.generate_accessors self +end + diff --git service/src/java/org/apache/hive/service/cli/CLIService.java service/src/java/org/apache/hive/service/cli/CLIService.java index 1a7f338..16ec330 100644 --- service/src/java/org/apache/hive/service/cli/CLIService.java +++ service/src/java/org/apache/hive/service/cli/CLIService.java @@ -35,6 +35,7 @@ import org.apache.hive.service.CompositeService; import org.apache.hive.service.ServiceException; import org.apache.hive.service.auth.HiveAuthFactory; +import org.apache.hive.service.cli.log.OperationLog; import org.apache.hive.service.cli.session.SessionManager; /** @@ -258,8 +259,10 @@ public OperationHandle getFunctions(SessionHandle sessionHandle, @Override public OperationState getOperationStatus(OperationHandle opHandle) throws HiveSQLException { + startLogCapture(opHandle); OperationState opState = sessionManager.getOperationManager().getOperationState(opHandle); LOG.info(opHandle + ": getOperationStatus()"); + stopLogCapture(); return opState; } @@ -269,9 +272,12 @@ public OperationState getOperationStatus(OperationHandle opHandle) @Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { + startLogCapture(opHandle); sessionManager.getOperationManager().getOperation(opHandle). getParentSession().cancelOperation(opHandle); LOG.info(opHandle + ": cancelOperation()"); + sessionManager.getLogManager().destroyOperationLog(opHandle); + stopLogCapture(); } /* (non-Javadoc) @@ -280,9 +286,12 @@ public void cancelOperation(OperationHandle opHandle) @Override public void closeOperation(OperationHandle opHandle) throws HiveSQLException { + startLogCapture(opHandle); sessionManager.getOperationManager().getOperation(opHandle). getParentSession().closeOperation(opHandle); LOG.info(opHandle + ": closeOperation"); + sessionManager.getLogManager().destroyOperationLog(opHandle); + stopLogCapture(); } /* (non-Javadoc) @@ -291,9 +300,11 @@ public void closeOperation(OperationHandle opHandle) @Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { + startLogCapture(opHandle); TableSchema tableSchema = sessionManager.getOperationManager().getOperation(opHandle). getParentSession().getResultSetMetadata(opHandle); LOG.info(opHandle + ": getResultSetMetadata()"); + stopLogCapture(); return tableSchema; } @@ -303,9 +314,11 @@ public TableSchema getResultSetMetadata(OperationHandle opHandle) @Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows) throws HiveSQLException { + startLogCapture(opHandle); RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle). getParentSession().fetchResults(opHandle, orientation, maxRows); LOG.info(opHandle + ": fetchResults()"); + stopLogCapture(); return rowSet; } @@ -315,9 +328,11 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio @Override public RowSet fetchResults(OperationHandle opHandle) throws HiveSQLException { + startLogCapture(opHandle); RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle). getParentSession().fetchResults(opHandle); LOG.info(opHandle + ": fetchResults()"); + stopLogCapture(); return rowSet; } @@ -341,4 +356,24 @@ public synchronized String getDelegationTokenFromMetaStore(String owner) } } } + + /* (non-Javadoc) + * @see org.apache.hive.service.cli.ICLIService#getLog(org.apache.hive.service.cli.OperationHandle) + */ + @Override + public String getLog(OperationHandle opHandle) + throws HiveSQLException { + OperationLog log = sessionManager.getLogManager().getOperationLogByOperation(opHandle, false); + LOG.info(opHandle + ": getLog()"); + return log.readOperationLog(); + } + + private void startLogCapture(OperationHandle operationHandle) throws HiveSQLException { + sessionManager.getLogManager().unregisterCurrentThread(); + sessionManager.getLogManager().registerCurrentThread(operationHandle); + } + + private void stopLogCapture() { + sessionManager.getLogManager().unregisterCurrentThread(); + } } diff --git service/src/java/org/apache/hive/service/cli/CLIServiceClient.java service/src/java/org/apache/hive/service/cli/CLIServiceClient.java index 14ef54f..8bd23bf 100644 --- service/src/java/org/apache/hive/service/cli/CLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/CLIServiceClient.java @@ -158,4 +158,7 @@ public RowSet fetchResults(OperationHandle opHandle) throws HiveSQLException { return fetchResults(opHandle, FetchOrientation.FETCH_NEXT, 1000); } + @Override + public abstract String getLog(OperationHandle opHandle) throws HiveSQLException; + } diff --git service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java index 9dca874..4a725b1 100644 --- service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java @@ -188,4 +188,9 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio return cliService.fetchResults(opHandle, orientation, maxRows); } + @Override + public String getLog(OperationHandle opHandle) + throws HiveSQLException { + return cliService.getLog(opHandle); + } } diff --git service/src/java/org/apache/hive/service/cli/ICLIService.java service/src/java/org/apache/hive/service/cli/ICLIService.java index f647ce6..a9ab35e 100644 --- service/src/java/org/apache/hive/service/cli/ICLIService.java +++ service/src/java/org/apache/hive/service/cli/ICLIService.java @@ -91,4 +91,6 @@ public abstract RowSet fetchResults(OperationHandle opHandle, FetchOrientation o public abstract RowSet fetchResults(OperationHandle opHandle) throws HiveSQLException; + public abstract String getLog(OperationHandle opHandle) + throws HiveSQLException; } diff --git service/src/java/org/apache/hive/service/cli/log/LinkedStringBuffer.java service/src/java/org/apache/hive/service/cli/log/LinkedStringBuffer.java new file mode 100644 index 0000000..c4a5106 --- /dev/null +++ service/src/java/org/apache/hive/service/cli/log/LinkedStringBuffer.java @@ -0,0 +1,80 @@ +/** + * 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.log; + +import java.util.LinkedList; + +/** + * A linked string buffer with a capacity limit. + */ +public class LinkedStringBuffer { + + private final LinkedList list; + private final long capacity; + private int size; + + /** + * Create a buffer with the specified capacity on the number of characters. + */ + public LinkedStringBuffer(long capacity) { + this.capacity = capacity; + list = new LinkedList(); + } + + /** + * @return Size (number of characters) in the buffer + */ + public synchronized long size() { + return size; + } + + /** + * Write to the buffer, which will remove previously written strings if + * we don't fit in capacity. + */ + public synchronized void write(String data) { + list.add(data); + size += data.length(); + + // Trim from the front + while (size > capacity) { + String evicted = list.remove(0); + size -= evicted.length(); + } + } + + /** + * @return All the data in the buffer. + */ + public synchronized String read() { + StringBuilder sb = new StringBuilder(size); + for (String s : list) { + sb.append(s); + } + return sb.toString(); + } + + /** + * Remove all stored data. + */ + public synchronized void clear() { + list.clear(); + size = 0; + } +} diff --git service/src/java/org/apache/hive/service/cli/log/LogDivertAppender.java service/src/java/org/apache/hive/service/cli/log/LogDivertAppender.java new file mode 100644 index 0000000..5629881 --- /dev/null +++ service/src/java/org/apache/hive/service/cli/log/LogDivertAppender.java @@ -0,0 +1,92 @@ +/** + * 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.log; + +import java.io.CharArrayWriter; + +import org.apache.log4j.Layout; +import org.apache.log4j.Logger; +import org.apache.log4j.WriterAppender; +import org.apache.log4j.spi.Filter; +import org.apache.log4j.spi.LoggingEvent; + +/** + * An Appender to divert logs from individual threads to the LogObject they belong to. + */ +public class LogDivertAppender extends WriterAppender { + private static final Logger LOG = Logger.getLogger(LogDivertAppender.class.getName()); + private final LogManager logManager; + + /** + * A log filter that exclude messages coming from the logger with the given name. + * We apply this filter on the Loggers used by the log diversion stuff, so that + * they don't generate more logs for themselves when they process logs. + */ + private class NameExclusionFilter extends Filter { + private String excludeLoggerName = null; + + public NameExclusionFilter(String excludeLoggerName) { + super(); + this.excludeLoggerName = excludeLoggerName; + } + + @Override + public int decide(LoggingEvent ev) { + if (ev.getLoggerName().equals(excludeLoggerName)) { + return Filter.DENY; + } + return Filter.NEUTRAL; + } + } + + /** This is where the log message will go to */ + private final CharArrayWriter writer = new CharArrayWriter(); + + public LogDivertAppender(Layout layout, LogManager logManager) { + super(); + this.setLayout(layout); + this.setWriter(writer); + this.setName("LogDivertAppender"); + this.logManager = logManager; + + // Filter out messages coming from log processing classes, or we'll run an infinite loop. + this.addFilter(new NameExclusionFilter(LOG.getName())); + this.addFilter(new NameExclusionFilter(OperationLog.class.getName())); + this.addFilter(new NameExclusionFilter(LogManager.class.getName())); + } + + /** + * Overrides WriterAppender.subAppend(), which does the real logging. + * No need to worry about concurrency since log4j calls this synchronously. + */ + @Override + protected void subAppend(LoggingEvent event) { + super.subAppend(event); + // That should've gone into our writer. Notify the LogContext. + String logOutput = writer.toString(); + writer.reset(); + + OperationLog log = logManager.getOperationLogByThreadName(event.getThreadName()); + if (log == null) { + LOG.debug(" ---+++=== Dropped log event from thread " + event.getThreadName()); + return; + } + log.writeOperationLog(logOutput); + } +} diff --git service/src/java/org/apache/hive/service/cli/log/LogManager.java service/src/java/org/apache/hive/service/cli/log/LogManager.java new file mode 100644 index 0000000..8ed7541 --- /dev/null +++ service/src/java/org/apache/hive/service/cli/log/LogManager.java @@ -0,0 +1,184 @@ +/** + * 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.log; + + +import java.util.Enumeration; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hive.service.AbstractService; +import org.apache.hive.service.cli.HiveSQLException; +import org.apache.hive.service.cli.OperationHandle; +import org.apache.hive.service.cli.session.SessionManager; +import org.apache.log4j.Appender; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Layout; +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; + +/** + * LogManager - LogManager is responsible for managing the lifecycle of in memory operation logs for HS2. + * Each log object is maintained as a rolling log whose size can't exceed 1MB. + * LogManager tracks the log objects by operation handle as well as by the thread whose output will + * be redirected to these log objects. + */ +public class LogManager extends AbstractService { + private HiveConf hiveConf; + + private final Map OperationLogByOperation = + new ConcurrentHashMap (); + private final Map OperationLogByThreadName = + new ConcurrentHashMap (); + + private boolean isOperationLogCaptureIntialized = false; + + private static final String DEFAULT_LAYOUT_PATTERN = "%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n"; + + private static Logger LOG = Logger.getLogger(LogManager.class.getName()); + private SessionManager sessionManager; + + public LogManager() { + super("LogManager"); + } + + public void setSessionManager(SessionManager sessionManager) { + this.sessionManager = sessionManager; + } + + public SessionManager getSessionManager() { + return sessionManager; + } + + public void initOperationLogCapture() { + if (isOperationLogCaptureIntialized) { + return; + } + + // There should be a ConsoleAppender. Copy its Layout. + Logger root = Logger.getRootLogger(); + Layout layout = null; + + Enumeration appenders = root.getAllAppenders(); + while (appenders.hasMoreElements()) { + Appender ap = (Appender) appenders.nextElement(); + if (ap.getClass().equals(ConsoleAppender.class)) { + layout = ap.getLayout(); + break; + } + } + + if (layout == null) { + layout = new PatternLayout(DEFAULT_LAYOUT_PATTERN); + LOG.info("Cannot find a Layout from a ConsoleAppender. Using default Layout pattern."); + } + + // Register another Appender (with the same layout) that talks to us. + Appender ap = new LogDivertAppender(layout, this); + root.addAppender(ap); + + isOperationLogCaptureIntialized = true; + } + + public OperationLog createNewOperationLog(OperationHandle operationHandle, String name) { + int size = HiveConf.getIntVar(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_IN_MEM_LOG_SIZE); + LOG.info("Operation log size: " + size); + OperationLog OperationLog = new OperationLog(name, size); + OperationLogByOperation.put(operationHandle, OperationLog); + return OperationLog; + } + + public boolean destroyOperationLog(OperationHandle operationHandle) { + OperationLog OperationLog = OperationLogByOperation.remove(operationHandle); + if (OperationLog == null) { + LOG.debug("No OperationLog found for operation: " + operationHandle.hashCode()); + return false; + } + return true; + } + + public void registerCurrentThread(OperationHandle operationHandle) throws HiveSQLException { + String threadName = Thread.currentThread().getName(); + + OperationLog OperationLog = getOperationLogByOperation(operationHandle, true); + + if (OperationLogByThreadName.containsKey(threadName)) { + LOG.debug("Thread: " + threadName + " is already registered."); + } + OperationLogByThreadName.put(threadName, OperationLog); + } + + public void registerCurrentThread(OperationLog OperationLog) { + String threadName = Thread.currentThread().getName(); + OperationLogByThreadName.put(threadName, OperationLog); + } + + public boolean unregisterCurrentThread() { + String threadName = Thread.currentThread().getName(); + OperationLog OperationLog = OperationLogByThreadName.remove(threadName); + if (OperationLog == null) { + LOG.debug("Failed to unregister thread " + threadName + ": OperationLog object is currently " + + "not regsitered"); + return false; + } + return true; + } + + public OperationLog getOperationLogByThreadName(String threadName) { + OperationLog OperationLog = OperationLogByThreadName.get(threadName); + if (OperationLog == null) { + LOG.debug("Operation log assocaited with thread: " + threadName + " couldn't be found."); + } + return OperationLog; + } + + public OperationLog getOperationLogByOperation(OperationHandle operationHandle, + boolean createIfAbsent) throws HiveSQLException { + OperationLog operationLog = OperationLogByOperation.get(operationHandle); + if (operationLog == null && createIfAbsent) { + operationLog = createNewOperationLog(operationHandle, operationHandle.toString()); + } else if (operationLog == null) { + throw new HiveSQLException("Couldn't find log associated with operation handle: " + + operationHandle.toString()); + } + return operationLog; + } + + @Override + public synchronized void init(HiveConf hiveConf) { + this.hiveConf = hiveConf; + super.init(hiveConf); + if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_IN_MEM_LOGGING)) { + initOperationLogCapture(); + } else { + LOG.info("Opeation level logging is turned off"); + } + } + + @Override + public synchronized void start() { + super.start(); + } + + @Override + public synchronized void stop() { + super.stop(); + } +} diff --git service/src/java/org/apache/hive/service/cli/log/OperationLog.java service/src/java/org/apache/hive/service/cli/log/OperationLog.java new file mode 100644 index 0000000..d2351a7 --- /dev/null +++ service/src/java/org/apache/hive/service/cli/log/OperationLog.java @@ -0,0 +1,92 @@ +/** + * 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.log; + +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.log4j.Logger; + +import com.google.common.base.Charsets; + +public class OperationLog { + + private static final String HIVE_ENCODING = Charsets.UTF_8.name(); + + // This OperationLogger's name is added to an exclusion list in OperationLogDivertAppender + private static Logger LOG = Logger.getLogger(OperationLog.class.getName()); + + private final String operationLogName; + private final LinkedStringBuffer operationLogBuffer; + private final long creationTime; + + OperationLog(String name, int size) { + this.operationLogName = name; + this.operationLogBuffer = new LinkedStringBuffer(size); + this.creationTime = System.currentTimeMillis(); + } + + public void writeOperationLog(String OperationLogMessage) { + operationLogBuffer.write(OperationLogMessage); + } + + public String readOperationLog() { + return operationLogBuffer.read(); + } + + public void resetOperationLog() { + operationLogBuffer.clear(); + } + + /** + * The OperationLogOutputStream helps translate a OperationLog to an OutputStream. + */ + private static class OperationLogOutputStream extends OutputStream { + private final LinkedStringBuffer backingStore; + + public OperationLogOutputStream(LinkedStringBuffer operationLogBuffer) { + super(); + backingStore = operationLogBuffer; + } + + @Override + public void write(byte[] b) throws IOException { + backingStore.write(new String(b, HIVE_ENCODING)); + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + backingStore.write(new String(b, off, len, HIVE_ENCODING)); + } + + @Override + public void write(int b) throws IOException { + byte[] buf = { (byte) b }; + this.write(buf); + } + } + + public OutputStream getOutputStream() { + return new OperationLogOutputStream(operationLogBuffer); + } + + public String getName() { + return operationLogName; + } +} \ No newline at end of file diff --git service/src/java/org/apache/hive/service/cli/operation/OperationManager.java service/src/java/org/apache/hive/service/cli/operation/OperationManager.java index 1f78a1d..2805fee 100644 --- service/src/java/org/apache/hive/service/cli/operation/OperationManager.java +++ service/src/java/org/apache/hive/service/cli/operation/OperationManager.java @@ -31,6 +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.session.SessionManager; /** * OperationManager. @@ -41,6 +42,7 @@ private HiveConf hiveConf; private final Map handleToOperation = new HashMap(); + private SessionManager sessionManager; public OperationManager() { super("OperationManager"); @@ -65,6 +67,13 @@ public synchronized void stop() { super.stop(); } + public void setSessionManager(SessionManager sessionManager) { + this.sessionManager = sessionManager; + } + + public SessionManager getSessionManager() { + return sessionManager; + } public ExecuteStatementOperation newExecuteStatementOperation(HiveSession parentSession, String statement, Map confOverlay, boolean runAsync) { ExecuteStatementOperation executeStatementOperation = ExecuteStatementOperation @@ -168,5 +177,5 @@ public RowSet getOperationNextRowSet(OperationHandle opHandle, FetchOrientation orientation, long maxRows) throws HiveSQLException { return getOperation(opHandle).getNextRowSet(orientation, maxRows); - } + } } 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..901ac05 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSession.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSession.java @@ -32,6 +32,7 @@ import org.apache.hive.service.cli.RowSet; import org.apache.hive.service.cli.SessionHandle; import org.apache.hive.service.cli.TableSchema; +import org.apache.hive.service.cli.log.LogManager; import org.apache.hive.service.cli.operation.OperationManager; public interface HiveSession { @@ -179,4 +180,9 @@ public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientatio public String getUserName(); public void setUserName(String userName); + + public void setLogManager(LogManager logManager); + + public LogManager getLogManager(); + } 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 11c96b2..f714d3d 100644 --- service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java +++ service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java @@ -43,6 +43,7 @@ import org.apache.hive.service.cli.RowSet; import org.apache.hive.service.cli.SessionHandle; import org.apache.hive.service.cli.TableSchema; +import org.apache.hive.service.cli.log.LogManager; import org.apache.hive.service.cli.operation.ExecuteStatementOperation; import org.apache.hive.service.cli.operation.GetCatalogsOperation; import org.apache.hive.service.cli.operation.GetColumnsOperation; @@ -73,6 +74,7 @@ private SessionManager sessionManager; private OperationManager operationManager; + private LogManager logManager; private IMetaStoreClient metastoreClient = null; private final Set opHandleSet = new HashSet(); @@ -133,6 +135,14 @@ public HiveConf getHiveConf() { return hiveConf; } + public LogManager getLogManager() { + return logManager; + } + + public void setLogManager(LogManager logManager) { + this.logManager = logManager; + } + public IMetaStoreClient getMetaStoreClient() throws HiveSQLException { if (metastoreClient == null) { try { @@ -163,7 +173,7 @@ public GetInfoValue getInfo(GetInfoType getInfoType) return new GetInfoValue(128); case CLI_TXN_CAPABLE: default: - throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); + throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); } } finally { release(); @@ -187,8 +197,12 @@ private OperationHandle executeStatementInternal(String statement, Map handleToSession = new HashMap(); private OperationManager operationManager = new OperationManager(); + private LogManager logManager = new LogManager(); private static final Object sessionMapLock = new Object(); private ExecutorService backgroundOperationPool; @@ -60,6 +62,10 @@ public synchronized void init(HiveConf hiveConf) { LOG.info("HiveServer2: Async execution pool size" + backgroundPoolSize); backgroundOperationPool = Executors.newFixedThreadPool(backgroundPoolSize); addService(operationManager); + logManager = new LogManager(); + logManager.setSessionManager(this); + + addService(logManager); super.init(hiveConf); } @@ -107,6 +113,7 @@ public SessionHandle openSession(String username, String password, Map threadLocalIpAddress = new ThreadLocal() { @Override protected synchronized String initialValue() { 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 2f2866f..4c1edec 100644 --- service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -58,7 +58,6 @@ public static final Log LOG = LogFactory.getLog(ThriftCLIService.class.getName()); - protected CLIService cliService; private static final TStatus OK_STATUS = new TStatus(TStatusCode.SUCCESS_STATUS); private static final TStatus ERROR_STATUS = new TStatus(TStatusCode.ERROR_STATUS); @@ -108,6 +107,20 @@ public synchronized void stop() { super.stop(); } + @Override + public TGetLogResp GetLog(TGetLogReq req) throws TException { + TGetLogResp resp = new TGetLogResp(); + try { + String log = cliService.getLog(new OperationHandle(req.getOperationHandle())); + resp.setStatus(OK_STATUS); + resp.setLog(log); + } catch (Exception e) { + e.printStackTrace(); + resp.setStatus(HiveSQLException.toTStatus(e)); + } + return resp; + } + @Override public TOpenSessionResp OpenSession(TOpenSessionReq req) throws TException { @@ -442,4 +455,6 @@ public void run() { } } + + } 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 9bb2a0f..24ad23f 100644 --- service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java +++ service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java @@ -388,4 +388,19 @@ public RowSet fetchResults(OperationHandle opHandle) throws HiveSQLException { // TODO: set the correct default fetch size return fetchResults(opHandle, FetchOrientation.FETCH_NEXT, 10000); } + + @Override + public String getLog(OperationHandle opHandle) throws HiveSQLException { + try { + TGetLogReq req = new TGetLogReq(); + req.setOperationHandle(opHandle.toTOperationHandle()); + TGetLogResp resp = cliService.GetLog(req); + checkStatus(resp.getStatus()); + return new String(resp.getLog()); + } catch (HiveSQLException e) { + throw e; + } catch (Exception e) { + throw new HiveSQLException(e); + } + } }