use of com.google.common.io.ByteArrayDataOutput in project hive by apache.
the class LlapProtocolServerImpl method getDelegationToken.
@Override
public GetTokenResponseProto getDelegationToken(RpcController controller, GetTokenRequestProto request) throws ServiceException {
if (secretManager == null) {
throw new ServiceException("Operation not supported on unsecure cluster");
}
UserGroupInformation callingUser = null;
Token<LlapTokenIdentifier> token = null;
try {
callingUser = UserGroupInformation.getCurrentUser();
// Determine if the user would need to sign fragments.
boolean isSigningRequired = determineIfSigningIsRequired(callingUser);
token = secretManager.createLlapToken(request.hasAppId() ? request.getAppId() : null, null, isSigningRequired);
} catch (IOException e) {
throw new ServiceException(e);
}
if (isRestrictedToClusterUser && !clusterUser.equals(callingUser.getShortUserName())) {
throw new ServiceException("Management protocol ACL is too permissive. The access has been" + " automatically restricted to " + clusterUser + "; " + callingUser.getShortUserName() + " is denied acccess. Please set " + ConfVars.LLAP_VALIDATE_ACLS.varname + " to false," + " or adjust " + ConfVars.LLAP_MANAGEMENT_ACL.varname + " and " + ConfVars.LLAP_MANAGEMENT_ACL_DENY.varname + " to a more restrictive ACL.");
}
ByteArrayDataOutput out = ByteStreams.newDataOutput();
try {
token.write(out);
} catch (IOException e) {
throw new ServiceException(e);
}
ByteString bs = ByteString.copyFrom(out.toByteArray());
GetTokenResponseProto response = GetTokenResponseProto.newBuilder().setToken(bs).build();
return response;
}
use of com.google.common.io.ByteArrayDataOutput in project druid by druid-io.
the class DatasourceInputSplitTest method testSerde.
@Test
public void testSerde() throws Exception {
Interval interval = Interval.parse("2000/3000");
DatasourceInputSplit expected = new DatasourceInputSplit(Lists.newArrayList(new WindowedDataSegment(new DataSegment("test", Interval.parse("2000/3000"), "ver", ImmutableMap.<String, Object>of("type", "local", "path", "/tmp/index.zip"), ImmutableList.of("host"), ImmutableList.of("visited_sum", "unique_hosts"), NoneShardSpec.instance(), 9, 12334), interval)), new String[] { "server1", "server2", "server3" });
ByteArrayDataOutput out = ByteStreams.newDataOutput();
expected.write(out);
DataInput in = ByteStreams.newDataInput(out.toByteArray());
DatasourceInputSplit actual = new DatasourceInputSplit();
actual.readFields(in);
Assert.assertEquals(expected.getSegments(), actual.getSegments());
Assert.assertArrayEquals(expected.getLocations(), actual.getLocations());
Assert.assertEquals(12334, actual.getLength());
}
use of com.google.common.io.ByteArrayDataOutput in project presto by prestodb.
the class RaptorColumnIdentity method serialize.
@Override
public byte[] serialize() {
ByteArrayDataOutput output = newDataOutput(SERIALIZED_SIZE);
output.write(CURRENT_VERSION);
output.writeLong(columnId);
return output.toByteArray();
}
use of com.google.common.io.ByteArrayDataOutput in project presto by prestodb.
the class WrappedRange method toBytes.
@JsonValue
public byte[] toBytes() throws IOException {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
range.write(out);
return out.toByteArray();
}
use of com.google.common.io.ByteArrayDataOutput in project presto by prestodb.
the class RaptorTableIdentity method serialize.
@Override
public byte[] serialize() {
ByteArrayDataOutput output = newDataOutput(SERIALIZED_SIZE);
output.write(CURRENT_VERSION);
output.writeLong(tableId);
return output.toByteArray();
}
Aggregations