use of org.apache.solr.client.solrj.io.stream.expr.StreamExpression 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.StreamExpression 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;
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpression in project lucene-solr by apache.
the class GetStream method toExpression.
private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
// function name
StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
expression.addParameter(name);
return expression;
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpression 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;
}
use of org.apache.solr.client.solrj.io.stream.expr.StreamExpression in project lucene-solr by apache.
the class JDBCStream method toExpression.
@Override
public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {
// functionName(collectionName, param1, param2, ..., paramN, sort="comp", [aliases="field=alias,..."])
// function name
StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
// connection url
expression.addParameter(new StreamExpressionNamedParameter("connection", connectionUrl));
// sql
expression.addParameter(new StreamExpressionNamedParameter("sql", sqlQuery));
// sort
expression.addParameter(new StreamExpressionNamedParameter(SORT, definedSort.toExpression(factory)));
// driver class
if (null != driverClassName) {
expression.addParameter(new StreamExpressionNamedParameter("driver", driverClassName));
}
// connection properties
if (null != connectionProperties) {
for (String propertyName : connectionProperties.stringPropertyNames()) {
expression.addParameter(new StreamExpressionNamedParameter(propertyName, connectionProperties.getProperty(propertyName)));
}
}
return expression;
}
Aggregations