Search in sources :

Example 1 with JoinType

use of org.apache.rya.indexing.pcj.fluo.app.query.JoinMetadata.JoinType in project incubator-rya by apache.

the class JoinBatchInformationTypeAdapter method deserialize.

@Override
public JoinBatchInformation deserialize(final JsonElement element, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException {
    final JsonObject json = element.getAsJsonObject();
    final int batchSize = json.get("batchSize").getAsInt();
    final Task task = Task.valueOf(json.get("task").getAsString());
    final String[] colArray = json.get("column").getAsString().split("\u0000");
    final Column column = new Column(colArray[0], colArray[1]);
    final String[] rows = json.get("span").getAsString().split("\u0000");
    final boolean startInc = json.get("startInc").getAsBoolean();
    final boolean endInc = json.get("endInc").getAsBoolean();
    final Span span = new Span(new RowColumn(rows[0]), startInc, new RowColumn(rows[1]), endInc);
    final VariableOrder updateVarOrder = new VariableOrder(json.get("updateVarOrder").getAsString());
    final VisibilityBindingSet bs = converter.convert(json.get("bindingSet").getAsString(), updateVarOrder);
    final Side side = Side.valueOf(json.get("side").getAsString());
    final JoinType join = JoinType.valueOf(json.get("joinType").getAsString());
    return JoinBatchInformation.builder().setBatchSize(batchSize).setTask(task).setSpan(span).setColumn(column).setBs(bs).setSide(side).setJoinType(join).build();
}
Also used : Task(org.apache.rya.indexing.pcj.fluo.app.batch.BatchInformation.Task) VisibilityBindingSet(org.apache.rya.api.model.VisibilityBindingSet) RowColumn(org.apache.fluo.api.data.RowColumn) VariableOrder(org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder) JsonObject(com.google.gson.JsonObject) JoinType(org.apache.rya.indexing.pcj.fluo.app.query.JoinMetadata.JoinType) Span(org.apache.fluo.api.data.Span) Side(org.apache.rya.api.function.join.LazyJoiningIterator.Side) RowColumn(org.apache.fluo.api.data.RowColumn) Column(org.apache.fluo.api.data.Column)

Example 2 with JoinType

use of org.apache.rya.indexing.pcj.fluo.app.query.JoinMetadata.JoinType in project incubator-rya by apache.

the class FluoQueryMetadataDAO method readJoinMetadataBuilder.

private JoinMetadata.Builder readJoinMetadataBuilder(final SnapshotBase sx, final String nodeId) {
    requireNonNull(sx);
    requireNonNull(nodeId);
    // Fetch the values from the Fluo table.
    final String rowId = nodeId;
    final Map<Column, String> values = sx.gets(rowId, FluoQueryColumns.JOIN_VARIABLE_ORDER, FluoQueryColumns.JOIN_TYPE, FluoQueryColumns.JOIN_PARENT_NODE_ID, FluoQueryColumns.JOIN_LEFT_CHILD_NODE_ID, FluoQueryColumns.JOIN_BATCH_SIZE, FluoQueryColumns.JOIN_RIGHT_CHILD_NODE_ID);
    // Return an object holding them.
    final String varOrderString = values.get(FluoQueryColumns.JOIN_VARIABLE_ORDER);
    final VariableOrder varOrder = new VariableOrder(varOrderString);
    final String joinTypeString = values.get(FluoQueryColumns.JOIN_TYPE);
    final JoinType joinType = JoinType.valueOf(joinTypeString);
    final String parentNodeId = values.get(FluoQueryColumns.JOIN_PARENT_NODE_ID);
    final String leftChildNodeId = values.get(FluoQueryColumns.JOIN_LEFT_CHILD_NODE_ID);
    final int joinBatchSize = Integer.parseInt(values.get(FluoQueryColumns.JOIN_BATCH_SIZE));
    final String rightChildNodeId = values.get(FluoQueryColumns.JOIN_RIGHT_CHILD_NODE_ID);
    return JoinMetadata.builder(nodeId).setVarOrder(varOrder).setJoinType(joinType).setParentNodeId(parentNodeId).setJoinBatchSize(joinBatchSize).setLeftChildNodeId(leftChildNodeId).setRightChildNodeId(rightChildNodeId);
}
Also used : Column(org.apache.fluo.api.data.Column) VariableOrder(org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder) JoinType(org.apache.rya.indexing.pcj.fluo.app.query.JoinMetadata.JoinType)

Aggregations

Column (org.apache.fluo.api.data.Column)2 JoinType (org.apache.rya.indexing.pcj.fluo.app.query.JoinMetadata.JoinType)2 VariableOrder (org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder)2 JsonObject (com.google.gson.JsonObject)1 RowColumn (org.apache.fluo.api.data.RowColumn)1 Span (org.apache.fluo.api.data.Span)1 Side (org.apache.rya.api.function.join.LazyJoiningIterator.Side)1 VisibilityBindingSet (org.apache.rya.api.model.VisibilityBindingSet)1 Task (org.apache.rya.indexing.pcj.fluo.app.batch.BatchInformation.Task)1