Search in sources :

Example 6 with StreamExplanation

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

the class LetStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_DECORATOR);
    explanation.setExpression(toExpression(factory, false).toString());
    explanation.addChild(stream.toExplanation(factory));
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Example 7 with StreamExplanation

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

the class ListStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_DECORATOR);
    explanation.setExpression(toExpression(factory, false).toString());
    for (TupleStream stream : streams) {
        explanation.addChild(stream.toExplanation(factory));
    }
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Example 8 with StreamExplanation

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

the class MergeStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_DECORATOR);
    explanation.setExpression(toExpression(factory, false).toString());
    explanation.addHelper(comp.toExplanation(factory));
    for (PushBackStream stream : streams) {
        explanation.addChild(stream.toExplanation(factory));
    }
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Example 9 with StreamExplanation

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

the class JDBCStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_SOURCE);
    StreamExpression expression = (StreamExpression) toExpression(factory);
    explanation.setExpression(expression.toString());
    String driverClassName = this.driverClassName;
    if (null == driverClassName) {
        try {
            driverClassName = DriverManager.getDriver(connectionUrl).getClass().getName();
        } catch (Exception e) {
            driverClassName = String.format(Locale.ROOT, "Failed to find driver for connectionUrl='%s'", connectionUrl);
        }
    }
    // child is a datastore so add it at this point
    StreamExplanation child = new StreamExplanation(getStreamNodeId() + "-datastore");
    child.setFunctionName("jdbc-source");
    child.setImplementingClass(driverClassName);
    child.setExpressionType(ExpressionType.DATASTORE);
    child.setExpression(sqlQuery);
    explanation.addChild(child);
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation) StreamExpression(org.apache.solr.client.solrj.io.stream.expr.StreamExpression) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 10 with StreamExplanation

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

the class ParallelStream method toExplanation.

@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {
    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
    explanation.setImplementingClass(this.getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_DECORATOR);
    explanation.setExpression(toExpression(factory, false).toString());
    // add a child for each worker
    for (int idx = 0; idx < workers; ++idx) {
        explanation.addChild(tupleStream.toExplanation(factory));
    }
    return explanation;
}
Also used : StreamExplanation(org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)

Aggregations

StreamExplanation (org.apache.solr.client.solrj.io.stream.expr.StreamExplanation)34 Explanation (org.apache.solr.client.solrj.io.stream.expr.Explanation)10 Test (org.junit.Test)8 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)7 StreamExpression (org.apache.solr.client.solrj.io.stream.expr.StreamExpression)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Tuple (org.apache.solr.client.solrj.io.Tuple)2 StreamFactory (org.apache.solr.client.solrj.io.stream.expr.StreamFactory)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 MethodHandles (java.lang.invoke.MethodHandles)1 SQLException (java.sql.SQLException)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Entry (java.util.Map.Entry)1 Random (java.util.Random)1