use of org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter in project lucene-solr by apache.
the class UpdateStream method extractBatchSize.
private int extractBatchSize(StreamExpression expression, StreamFactory factory) throws IOException {
StreamExpressionNamedParameter batchSizeParam = factory.getNamedOperand(expression, "batchSize");
if (null == batchSizeParam || null == batchSizeParam.getParameter() || !(batchSizeParam.getParameter() instanceof StreamExpressionValue)) {
throw new IOException(String.format(Locale.ROOT, "Invalid expression %s - expecting a 'batchSize' parameter of type positive integer but didn't find one", expression));
}
String batchSizeStr = ((StreamExpressionValue) batchSizeParam.getParameter()).getValue();
return parseBatchSize(batchSizeStr, expression);
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter in project lucene-solr by apache.
the class UpdateStream 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(updateBatchSize)));
if (includeStreams) {
if (tupleSource instanceof Expressible) {
expression.addParameter(((Expressible) tupleSource).toExpression(factory));
} else {
throw new IOException("This ParallelStream contains a non-expressible TupleStream - it cannot be converted to an expression");
}
} else {
expression.addParameter("<stream>");
}
return expression;
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter in project lucene-solr by apache.
the class GroupOperation method toExpression.
public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {
StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
// n
expression.addParameter(new StreamExpressionNamedParameter("n", Integer.toString(size)));
// sort
expression.addParameter(new StreamExpressionNamedParameter(SORT, streamComparator.toExpression(factory)));
return expression;
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter in project lucene-solr by apache.
the class ReplaceWithFieldOperation method toExpression.
@Override
public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {
// function name
StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
if (wasBuiltWithFieldName) {
expression.addParameter(originalFieldName);
}
expression.addParameter(null == originalValue ? "null" : originalValue.toString());
expression.addParameter(new StreamExpressionNamedParameter("withField", replacementFieldName));
return expression;
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter in project lucene-solr by apache.
the class ExecutorStream method toExpression.
private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
// function name
StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
expression.addParameter(new StreamExpressionNamedParameter("threads", Integer.toString(threads)));
// stream
if (includeStreams) {
if (stream instanceof Expressible) {
expression.addParameter(((Expressible) stream).toExpression(factory));
} else {
throw new IOException("The ExecuteStream contains a non-expressible TupleStream - it cannot be converted to an expression");
}
}
return expression;
}
Aggregations