Search in sources :

Example 11 with Expressible

use of org.apache.solr.client.solrj.io.stream.expr.Expressible in project lucene-solr by apache.

the class HashJoinStream method toExpression.

private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
    // function name
    StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
    if (includeStreams) {
        // streams
        if (hashStream instanceof Expressible && fullStream instanceof Expressible) {
            expression.addParameter(((Expressible) fullStream).toExpression(factory));
            expression.addParameter(new StreamExpressionNamedParameter("hashed", ((Expressible) hashStream).toExpression(factory)));
        } else {
            throw new IOException("This HashJoinStream contains a non-expressible TupleStream - it cannot be converted to an expression");
        }
    } else {
        expression.addParameter("<stream>");
        expression.addParameter("hashed=<stream>");
    }
    // on
    StringBuilder sb = new StringBuilder();
    for (int idx = 0; idx < leftHashOn.size(); ++idx) {
        if (sb.length() > 0) {
            sb.append(",");
        }
        // we know that left and right hashOns are the same size
        String left = leftHashOn.get(idx);
        String right = rightHashOn.get(idx);
        if (left.equals(right)) {
            sb.append(left);
        } else {
            sb.append(left);
            sb.append("=");
            sb.append(right);
        }
    }
    expression.addParameter(new StreamExpressionNamedParameter("on", sb.toString()));
    return expression;
}
Also used : StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) Expressible(org.apache.solr.client.solrj.io.stream.expr.Expressible) StreamExpressionNamedParameter(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter) IOException(java.io.IOException)

Example 12 with Expressible

use of org.apache.solr.client.solrj.io.stream.expr.Expressible in project lucene-solr by apache.

the class ParallelStream method toExpression.

private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
    // function name
    StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
    // collection
    expression.addParameter(collection);
    // workers
    expression.addParameter(new StreamExpressionNamedParameter("workers", Integer.toString(workers)));
    if (includeStreams) {
        if (tupleStream instanceof Expressible) {
            expression.addParameter(((Expressible) tupleStream).toExpression(factory));
        } else {
            throw new IOException("This ParallelStream contains a non-expressible TupleStream - it cannot be converted to an expression");
        }
    } else {
        expression.addParameter("<stream>");
    }
    // sort
    expression.addParameter(new StreamExpressionNamedParameter(SORT, comp.toExpression(factory)));
    // zkHost
    expression.addParameter(new StreamExpressionNamedParameter("zkHost", zkHost));
    return expression;
}
Also used : StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) StreamExpressionNamedParameter(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter) Expressible(org.apache.solr.client.solrj.io.stream.expr.Expressible) IOException(java.io.IOException)

Example 13 with Expressible

use of org.apache.solr.client.solrj.io.stream.expr.Expressible in project lucene-solr by apache.

the class FetchStream method toExpression.

private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
    // function name
    StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
    expression.addParameter(collection);
    expression.addParameter(new StreamExpressionNamedParameter("on", leftKey + "=" + rightKey));
    expression.addParameter(new StreamExpressionNamedParameter("fl", fieldList));
    expression.addParameter(new StreamExpressionNamedParameter("batchSize", Integer.toString(batchSize)));
    // stream
    if (includeStreams) {
        if (stream instanceof Expressible) {
            expression.addParameter(((Expressible) stream).toExpression(factory));
        } else {
            throw new IOException("The FetchStream contains a non-expressible TupleStream - it cannot be converted to an expression");
        }
    }
    return expression;
}
Also used : StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) StreamExpressionNamedParameter(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter) Expressible(org.apache.solr.client.solrj.io.stream.expr.Expressible) IOException(java.io.IOException)

Example 14 with Expressible

use of org.apache.solr.client.solrj.io.stream.expr.Expressible in project lucene-solr by apache.

the class IntersectStream method toExpression.

private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
    // function name
    StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
    if (includeStreams) {
        // streams
        if (streamA instanceof Expressible) {
            expression.addParameter(((Expressible) streamA).toExpression(factory));
        } else {
            throw new IOException("This IntersectStream contains a non-expressible TupleStream - it cannot be converted to an expression");
        }
        if (originalStreamB instanceof Expressible) {
            expression.addParameter(((Expressible) originalStreamB).toExpression(factory));
        } else {
            throw new IOException("This IntersectStream contains a non-expressible TupleStream - it cannot be converted to an expression");
        }
    } else {
        expression.addParameter("<stream>");
        expression.addParameter("<stream>");
    }
    // on
    expression.addParameter(new StreamExpressionNamedParameter("on", eq.toExpression(factory)));
    return expression;
}
Also used : StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) Expressible(org.apache.solr.client.solrj.io.stream.expr.Expressible) StreamExpressionNamedParameter(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter) IOException(java.io.IOException)

Example 15 with Expressible

use of org.apache.solr.client.solrj.io.stream.expr.Expressible in project lucene-solr by apache.

the class CommitStream method toExpression.

private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
    StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
    expression.addParameter(collection);
    expression.addParameter(new StreamExpressionNamedParameter("zkHost", zkHost));
    expression.addParameter(new StreamExpressionNamedParameter("batchSize", Integer.toString(commitBatchSize)));
    expression.addParameter(new StreamExpressionNamedParameter("waitFlush", Boolean.toString(waitFlush)));
    expression.addParameter(new StreamExpressionNamedParameter("waitSearcher", Boolean.toString(waitSearcher)));
    expression.addParameter(new StreamExpressionNamedParameter("softCommit", Boolean.toString(softCommit)));
    if (includeStreams) {
        if (tupleSource instanceof Expressible) {
            expression.addParameter(((Expressible) tupleSource).toExpression(factory));
        } else {
            throw new IOException("This CommitStream contains a non-expressible TupleStream - it cannot be converted to an expression");
        }
    } else {
        expression.addParameter("<stream>");
    }
    return expression;
}
Also used : StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) StreamExpressionNamedParameter(org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter) Expressible(org.apache.solr.client.solrj.io.stream.expr.Expressible) IOException(java.io.IOException)

Aggregations

Expressible (org.apache.solr.client.solrj.io.stream.expr.Expressible)17 IOException (java.io.IOException)16 StreamExpression (org.apache.solr.client.solrj.io.stream.expr.StreamExpression)15 StreamExpressionNamedParameter (org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter)15 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ModelCache (org.apache.solr.client.solrj.io.ModelCache)1 GatherNodesStream (org.apache.solr.client.solrj.io.graph.GatherNodesStream)1 ShortestPathStream (org.apache.solr.client.solrj.io.graph.ShortestPathStream)1 GroupOperation (org.apache.solr.client.solrj.io.ops.GroupOperation)1 ReplaceOperation (org.apache.solr.client.solrj.io.ops.ReplaceOperation)1 MaxMetric (org.apache.solr.client.solrj.io.stream.metrics.MaxMetric)1 SumMetric (org.apache.solr.client.solrj.io.stream.metrics.SumMetric)1 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)1 CloseHook (org.apache.solr.core.CloseHook)1 CoreContainer (org.apache.solr.core.CoreContainer)1 PluginInfo (org.apache.solr.core.PluginInfo)1 SolrCore (org.apache.solr.core.SolrCore)1