use of org.apache.thrift.protocol.TProtocolException in project pinpoint by naver.
the class TAnnotationValue method tupleSchemeReadValue.
@Override
protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(fieldID);
if (setField != null) {
switch(setField) {
case STRING_VALUE:
String stringValue;
stringValue = iprot.readString();
return stringValue;
case BOOL_VALUE:
Boolean boolValue;
boolValue = iprot.readBool();
return boolValue;
case INT_VALUE:
Integer intValue;
intValue = iprot.readI32();
return intValue;
case LONG_VALUE:
Long longValue;
longValue = iprot.readI64();
return longValue;
case SHORT_VALUE:
Short shortValue;
shortValue = iprot.readI16();
return shortValue;
case DOUBLE_VALUE:
Double doubleValue;
doubleValue = iprot.readDouble();
return doubleValue;
case BINARY_VALUE:
ByteBuffer binaryValue;
binaryValue = iprot.readBinary();
return binaryValue;
case BYTE_VALUE:
Byte byteValue;
byteValue = iprot.readByte();
return byteValue;
case INT_STRING_VALUE:
TIntStringValue intStringValue;
intStringValue = new TIntStringValue();
intStringValue.read(iprot);
return intStringValue;
case INT_STRING_STRING_VALUE:
TIntStringStringValue intStringStringValue;
intStringStringValue = new TIntStringStringValue();
intStringStringValue.read(iprot);
return intStringStringValue;
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
throw new TProtocolException("Couldn't find a field with field id " + fieldID);
}
}
use of org.apache.thrift.protocol.TProtocolException in project hive by apache.
the class TUGIBasedProcessor method handleSetUGI.
private void handleSetUGI(TUGIContainingTransport ugiTrans, ThriftHiveMetastore.Processor.set_ugi<Iface> fn, TMessage msg, TProtocol iprot, TProtocol oprot) throws TException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
UserGroupInformation clientUgi = ugiTrans.getClientUGI();
if (null != clientUgi) {
throw new TException(new IllegalStateException("UGI is already set. Resetting is not " + "allowed. Current ugi is: " + clientUgi.getUserName()));
}
set_ugi_args args = fn.getEmptyArgsInstance();
try {
args.read(iprot);
} catch (TProtocolException e) {
iprot.readMessageEnd();
TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return;
}
iprot.readMessageEnd();
set_ugi_result result = fn.getResult(iface, args);
List<String> principals = result.getSuccess();
// Store the ugi in transport and then continue as usual.
ugiTrans.setClientUGI(UserGroupInformation.createRemoteUser(principals.remove(principals.size() - 1)));
oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.REPLY, msg.seqid));
result.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
}
use of org.apache.thrift.protocol.TProtocolException in project hive by apache.
the class TestListPartitions method testListPartitionValuesNullSchema.
@Test
public void testListPartitionValuesNullSchema() throws Exception {
try {
createTable4PartColsParts(client);
PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, TABLE_NAME, null);
client.listPartitionValues(request);
fail("Should have thrown exception");
} catch (NullPointerException | TProtocolException e) {
// TODO: should not throw different exceptions for different HMS deployment types
}
}
use of org.apache.thrift.protocol.TProtocolException in project hive by apache.
the class TestListPartitions method testListPartitionValuesNullTblName.
@Test
public void testListPartitionValuesNullTblName() throws Exception {
try {
createTable4PartColsParts(client);
List<FieldSchema> partitionSchema = Lists.newArrayList(new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", ""));
PartitionValuesRequest request = new PartitionValuesRequest(DB_NAME, null, partitionSchema);
client.listPartitionValues(request);
fail("Should have thrown exception");
} catch (NullPointerException | TProtocolException e) {
// TODO: should not throw different exceptions for different HMS deployment types
}
}
use of org.apache.thrift.protocol.TProtocolException in project hive by apache.
the class TestListPartitions method testListPartitionValuesNullDbName.
@Test
public void testListPartitionValuesNullDbName() throws Exception {
try {
createTable4PartColsParts(client);
List<FieldSchema> partitionSchema = Lists.newArrayList(new FieldSchema("yyyy", "string", ""), new FieldSchema("mm", "string", ""));
PartitionValuesRequest request = new PartitionValuesRequest(null, TABLE_NAME, partitionSchema);
client.listPartitionValues(request);
fail("Should have thrown exception");
} catch (NullPointerException | TProtocolException e) {
// TODO: should not throw different exceptions for different HMS deployment types
}
}
Aggregations