Search in sources :

Example 11 with TSerializer

use of org.apache.thrift.TSerializer in project hive by apache.

the class MetadataJSONSerializer method serializePartitionSpec.

@Override
@InterfaceAudience.LimitedPrivate({ "Hive" })
@InterfaceStability.Evolving
public List<String> serializePartitionSpec(HCatPartitionSpec hcatPartitionSpec) throws HCatException {
    try {
        List<String> stringReps = new ArrayList<String>();
        TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
        for (PartitionSpec partitionSpec : hcatPartitionSpec.partitionSpecProxy.toPartitionSpec()) {
            stringReps.add(serializer.toString(partitionSpec));
        }
        return stringReps;
    } catch (TException serializationException) {
        throw new HCatException("Failed to serialize!", serializationException);
    }
}
Also used : TException(org.apache.thrift.TException) TSerializer(org.apache.thrift.TSerializer) TJSONProtocol(org.apache.thrift.protocol.TJSONProtocol) ArrayList(java.util.ArrayList) HCatException(org.apache.hive.hcatalog.common.HCatException) PartitionSpec(org.apache.hadoop.hive.metastore.api.PartitionSpec)

Example 12 with TSerializer

use of org.apache.thrift.TSerializer in project vcell by virtualcell.

the class CopasiServicePython method writeOptRunJson.

public static void writeOptRunJson(File optRunFile, OptRun optRun) throws IOException {
    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
    try {
        byte[] blob = serializer.serialize(optRun);
        FileUtils.writeByteArrayToFile(optRunFile, blob);
    } catch (TException e) {
        e.printStackTrace();
        throw new IOException("error writing optProblem to file " + optRunFile.getPath() + ": " + e.getMessage(), e);
    }
}
Also used : TException(org.apache.thrift.TException) TSerializer(org.apache.thrift.TSerializer) TJSONProtocol(org.apache.thrift.protocol.TJSONProtocol) IOException(java.io.IOException)

Example 13 with TSerializer

use of org.apache.thrift.TSerializer in project vcell by virtualcell.

the class CopasiServicePython method writeOptProblem.

public static void writeOptProblem(File optProblemFile, OptProblem optProblem) throws IOException {
    TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
    try {
        byte[] blob = serializer.serialize(optProblem);
        FileUtils.writeByteArrayToFile(optProblemFile, blob);
    } catch (TException e) {
        e.printStackTrace();
        throw new IOException("error writing optProblem to file " + optProblemFile.getPath() + ": " + e.getMessage(), e);
    }
}
Also used : TException(org.apache.thrift.TException) TSerializer(org.apache.thrift.TSerializer) TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) IOException(java.io.IOException)

Example 14 with TSerializer

use of org.apache.thrift.TSerializer in project vcell by virtualcell.

the class CopasiServicePython method writeOptProblemJson.

public static void writeOptProblemJson(File optProblemFile, OptProblem optProblem) throws IOException {
    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
    try {
        byte[] blob = serializer.serialize(optProblem);
        FileUtils.writeByteArrayToFile(optProblemFile, blob);
    } catch (TException e) {
        e.printStackTrace();
        throw new IOException("error writing optProblem to file " + optProblemFile.getPath() + ": " + e.getMessage(), e);
    }
}
Also used : TException(org.apache.thrift.TException) TSerializer(org.apache.thrift.TSerializer) TJSONProtocol(org.apache.thrift.protocol.TJSONProtocol) IOException(java.io.IOException)

Example 15 with TSerializer

use of org.apache.thrift.TSerializer in project vcell by virtualcell.

the class VisMeshUtils method writeSimulationDataSetRef.

public static void writeSimulationDataSetRef(File simDataSetRefFile, SimulationDataSetRef simDataSetRef) throws IOException {
    TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
    try {
        byte[] blob = serializer.serialize(simDataSetRef);
        FileUtils.writeByteArrayToFile(simDataSetRefFile, blob);
    } catch (TException e) {
        e.printStackTrace();
        throw new IOException("error writing SimulationDataSetRef to file " + simDataSetRefFile.getPath() + ": " + e.getMessage(), e);
    }
}
Also used : TException(org.apache.thrift.TException) TSerializer(org.apache.thrift.TSerializer) TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) IOException(java.io.IOException)

Aggregations

TSerializer (org.apache.thrift.TSerializer)35 TException (org.apache.thrift.TException)19 TJSONProtocol (org.apache.thrift.protocol.TJSONProtocol)14 IOException (java.io.IOException)12 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)8 Test (org.junit.Test)6 TDeserializer (org.apache.thrift.TDeserializer)5 ArrayList (java.util.ArrayList)4 SemanticException (org.apache.hadoop.hive.ql.parse.SemanticException)4 OptRun (org.vcell.optimization.thrift.OptRun)4 Table (org.apache.hadoop.hive.metastore.api.Table)3 TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)3 VCellApiClient (org.vcell.api.client.VCellApiClient)3 OptProblem (org.vcell.optimization.thrift.OptProblem)3 OptRunStatus (org.vcell.optimization.thrift.OptRunStatus)3 MathException (cbit.vcell.math.MathException)2 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)2 OptSolverResultSet (cbit.vcell.opt.OptSolverResultSet)2 OptRunResultSet (cbit.vcell.opt.OptSolverResultSet.OptRunResultSet)2 OptimizationException (cbit.vcell.opt.OptimizationException)2