Search in sources :

Example 6 with DynamicColumnDescription

use of com.palantir.atlasdb.table.description.DynamicColumnDescription in project atlasdb by palantir.

the class TableMetadataDeserializer method deserializeDynamicCol.

private ColumnMetadataDescription deserializeDynamicCol(JsonNode node) {
    NameMetadataDescription col = deserializeRowish(node.get("column"));
    ColumnValueDescription val = deserializeValue(node.get("value"));
    DynamicColumnDescription dynamicCol = new DynamicColumnDescription(col, val);
    return new ColumnMetadataDescription(dynamicCol);
}
Also used : NameMetadataDescription(com.palantir.atlasdb.table.description.NameMetadataDescription) ColumnMetadataDescription(com.palantir.atlasdb.table.description.ColumnMetadataDescription) DynamicColumnDescription(com.palantir.atlasdb.table.description.DynamicColumnDescription) ColumnValueDescription(com.palantir.atlasdb.table.description.ColumnValueDescription)

Example 7 with DynamicColumnDescription

use of com.palantir.atlasdb.table.description.DynamicColumnDescription in project atlasdb by palantir.

the class TableCellValSerializer method serialize.

private static void serialize(JsonGenerator jgen, TableMetadata metadata, Entry<Cell, byte[]> result) throws IOException {
    Cell cell = result.getKey();
    byte[] row = cell.getRowName();
    byte[] col = cell.getColumnName();
    byte[] val = result.getValue();
    jgen.writeStartObject();
    AtlasSerializers.serializeRow(jgen, metadata.getRowMetadata(), row);
    ColumnMetadataDescription columns = metadata.getColumns();
    if (columns.hasDynamicColumns()) {
        DynamicColumnDescription dynamicColumn = columns.getDynamicColumn();
        AtlasSerializers.serializeDynamicColumn(jgen, dynamicColumn, col);
        jgen.writeFieldName("val");
        AtlasSerializers.serializeVal(jgen, dynamicColumn.getValue(), val);
    } else {
        String shortName = PtBytes.toString(col);
        Set<NamedColumnDescription> namedColumns = columns.getNamedColumns();
        for (NamedColumnDescription description : namedColumns) {
            if (shortName.equals(description.getShortName())) {
                AtlasSerializers.serializeNamedCol(jgen, description, val);
                break;
            }
        }
    }
    jgen.writeEndObject();
}
Also used : ColumnMetadataDescription(com.palantir.atlasdb.table.description.ColumnMetadataDescription) DynamicColumnDescription(com.palantir.atlasdb.table.description.DynamicColumnDescription) NamedColumnDescription(com.palantir.atlasdb.table.description.NamedColumnDescription) Cell(com.palantir.atlasdb.keyvalue.api.Cell)

Aggregations

DynamicColumnDescription (com.palantir.atlasdb.table.description.DynamicColumnDescription)7 ColumnMetadataDescription (com.palantir.atlasdb.table.description.ColumnMetadataDescription)6 NamedColumnDescription (com.palantir.atlasdb.table.description.NamedColumnDescription)4 NameMetadataDescription (com.palantir.atlasdb.table.description.NameMetadataDescription)3 Cell (com.palantir.atlasdb.keyvalue.api.Cell)1 ColumnValueDescription (com.palantir.atlasdb.table.description.ColumnValueDescription)1 TableMetadata (com.palantir.atlasdb.table.description.TableMetadata)1