use of org.apache.thrift.TSerializer in project hive by apache.
the class PartitionSerializer method writeTo.
@Override
public void writeTo(JsonWriter writer, ReplicationSpec additionalPropertiesProvider) throws SemanticException, IOException {
try {
TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
// Remove all the entries from the parameters which are added by repl tasks internally.
Map<String, String> parameters = partition.getParameters();
if (parameters != null) {
parameters.entrySet().removeIf(e -> e.getKey().equals(ReplUtils.REPL_CHECKPOINT_KEY));
}
if (additionalPropertiesProvider.isInReplicationScope()) {
// Event replication State will be null in case of bootstrap dump.
if (additionalPropertiesProvider.getReplSpecType() != ReplicationSpec.Type.INCREMENTAL_DUMP) {
partition.putToParameters(ReplicationSpec.KEY.CURR_STATE_ID_SOURCE.toString(), additionalPropertiesProvider.getCurrentReplicationState());
}
}
writer.jsonGenerator.writeString(serializer.toString(partition));
writer.jsonGenerator.flush();
} catch (TException e) {
throw new SemanticException(ErrorMsg.ERROR_SERIALIZE_METASTORE.getMsg(), e);
}
}
use of org.apache.thrift.TSerializer in project hive by apache.
the class MessageBuilder method createTableObjJson.
public static String createTableObjJson(Table tableObj) throws TException {
// Note: The parameters of the Table object will be removed in the filter if it matches
// any pattern provided through EVENT_NOTIFICATION_PARAMETERS_EXCLUDE_PATTERNS
filterMapkeys(tableObj.getParameters(), paramsFilter);
TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
return serializer.toString(tableObj);
}
use of org.apache.thrift.TSerializer in project hive by apache.
the class MessageBuilder method createPartitionObjJson.
public static String createPartitionObjJson(Partition partitionObj) throws TException {
// Note: The parameters of the Partition object will be removed in the filter if it matches
// any pattern provided through EVENT_NOTIFICATION_PARAMETERS_EXCLUDE_PATTERNS
filterMapkeys(partitionObj.getParameters(), paramsFilter);
TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
return serializer.toString(partitionObj);
}
use of org.apache.thrift.TSerializer in project vcell by virtualcell.
the class VisMeshUtils method writeFiniteVolumeIndexData.
static void writeFiniteVolumeIndexData(File finiteVolumeIndexFile, FiniteVolumeIndexData finiteVolumeIndexData) throws IOException {
TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
try {
byte[] blob = serializer.serialize(finiteVolumeIndexData);
FileUtils.writeByteArrayToFile(finiteVolumeIndexFile, blob);
} catch (TException e) {
e.printStackTrace();
throw new IOException("error writing FiniteVolumeIndexData to file " + finiteVolumeIndexFile.getPath() + ": " + e.getMessage(), e);
}
}
use of org.apache.thrift.TSerializer in project vcell by virtualcell.
the class VisMeshUtils method writeVisMesh.
static void writeVisMesh(File visMeshFile, VisMesh visMesh) throws IOException {
TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
try {
byte[] blob = serializer.serialize(visMesh);
FileUtils.writeByteArrayToFile(visMeshFile, blob);
} catch (TException e) {
e.printStackTrace();
throw new IOException("error writing VisMesh to file " + visMeshFile.getPath() + ": " + e.getMessage(), e);
}
}
Aggregations