Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc

title: >
Streaming expressions backed by CloudSolrStream (e.g. 'search', 'shuffle') now support a
'path' parameter for selecting the request handler to query, as a more explicit alternative
to embedding a 'qt' parameter.
type: added
authors:
- name: Jason Gerlowski
nick: gerlowskija
links:
- name: SOLR-18332
url: https://issues.apache.org/jira/browse/SOLR-18332
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/cli/StreamTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private PushBackStream doRemoteMode(String expr, CommandLine cli) throws Excepti
String collection = cli.getOptionValue(COLLECTION_OPTION);

return new PushBackStream(
new SolrStream(solrUrl + "/solr/" + collection, params("qt", "/stream", "expr", expr)));
new SolrStream(solrUrl + "/solr", collection, "/stream", params("expr", expr)));
}

private static ModifiableSolrParams params(String... params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
// Recipe taken from:
// http://joelsolr.blogspot.com/2016/10/solr-63-batch-jobs-parallel-etl-and.html
ModifiableSolrParams q = new ModifiableSolrParams();
q.set(CommonParams.QT, "/stream");
q.set("collection", collection);
q.set(
"expr",
Expand Down Expand Up @@ -450,7 +449,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
log.debug("- starting copying documents from {} to {}", collection, targetCollection);
SolrResponse rsp;
try {
rsp = new QueryRequest(q).process(ccc.getSolrCloudManager().getSolrClient());
rsp = new QueryRequest("/stream", q).process(ccc.getSolrCloudManager().getSolrClient());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a QueryRequest appropriate request/usage

} catch (Exception e) {
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ private TupleStream createCloudSolrStream(SolrClientCache solrClientCache) throw
}
params.set(CommonParams.FL, fromField);
params.set(CommonParams.SORT, fromField + " asc");
params.set(CommonParams.QT, "/export");
params.set(CommonParams.WT, CommonParams.JAVABIN);

StreamContext streamContext = new StreamContext();
Expand All @@ -263,7 +262,7 @@ private TupleStream createCloudSolrStream(SolrClientCache solrClientCache) throw
}

TupleStream cloudSolrStream =
new CloudSolrStream(streamingSolrConnection, collection, params);
new CloudSolrStream(streamingSolrConnection, collection, "/export", params);
TupleStream uniqueStream = new UniqueStream(cloudSolrStream, new FieldEqualitor(fromField));
uniqueStream.setStreamContext(streamContext);
return uniqueStream;
Expand Down Expand Up @@ -296,10 +295,9 @@ private TupleStream createSolrStream() {

ModifiableSolrParams params = new ModifiableSolrParams();
params.set("expr", uniqueExpr.toString());
params.set(CommonParams.QT, "/stream");
params.set(CommonParams.WT, CommonParams.JAVABIN);

return new SolrStream(solrUrl + "/" + collection, params);
return new SolrStream(solrUrl, collection, "/stream", params);
}

private DocSet getDocSet() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@ private TupleStream handleSelect(
}
return limitStream;
} else {
params.add(CommonParams.QT, "/export");
return new CloudSolrStream(solrConnection, collection, params);
return new CloudSolrStream(solrConnection, collection, "/export", params);
}
}

Expand Down Expand Up @@ -546,9 +545,6 @@ private TupleStream handleGroupByMapReduce(
params.set(CommonParams.FL, fl);
params.set(CommonParams.Q, query);
params.set(CommonParams.WT, CommonParams.JAVABIN);
// Always use the /export handler for Group By Queries because it requires exporting full result
// sets.
params.set(CommonParams.QT, "/export");

if (numWorkers > 1) {
params.set("partitionKeys", getPartitionKeys(buckets));
Expand All @@ -558,7 +554,9 @@ private TupleStream handleGroupByMapReduce(

TupleStream tupleStream = null;

CloudSolrStream cstream = new CloudSolrStream(solrConnection, collection, params);
// Always use the /export handler for Group By Queries because it requires exporting full
// result sets.
CloudSolrStream cstream = new CloudSolrStream(solrConnection, collection, "/export", params);
tupleStream = new RollupStream(cstream, buckets, metrics);

StreamFactory factory =
Expand Down Expand Up @@ -805,9 +803,6 @@ private TupleStream handleSelectDistinctMapReduce(
params.set(CommonParams.FL, fl);
params.set(CommonParams.Q, query);
params.set(CommonParams.WT, CommonParams.JAVABIN);
// Always use the /export handler for Distinct Queries because it requires exporting full result
// sets.
params.set(CommonParams.QT, "/export");

if (numWorkers > 1) {
params.set("partitionKeys", getPartitionKeys(buckets));
Expand All @@ -817,7 +812,9 @@ private TupleStream handleSelectDistinctMapReduce(

TupleStream tupleStream = null;

CloudSolrStream cstream = new CloudSolrStream(solrConnection, collection, params);
// Always use the /export handler for Distinct Queries because it requires exporting full
// result sets.
CloudSolrStream cstream = new CloudSolrStream(solrConnection, collection, "/export", params);
tupleStream = new UniqueStream(cstream, ecomp);

if (numWorkers > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3309,8 +3309,6 @@ public void testGroupByWhereOnGroupedColumn() throws Exception {
// WHERE on the exact grouped column (equality) — Calcite 1.42 may constant-fold str_s to 'a'
SolrParams sParams =
params(
CommonParams.QT,
"/sql",
"aggregationMode",
"facet",
"stmt",
Expand All @@ -3328,8 +3326,6 @@ public void testGroupByWhereOnGroupedColumn() throws Exception {
// Same query in map_reduce mode
sParams =
params(
CommonParams.QT,
"/sql",
"aggregationMode",
"map_reduce",
"stmt",
Expand All @@ -3347,8 +3343,6 @@ public void testGroupByWhereOnGroupedColumn() throws Exception {
// WHERE on grouped column using IN — multiple constant-folded values
sParams =
params(
CommonParams.QT,
"/sql",
"aggregationMode",
"facet",
"stmt",
Expand All @@ -3365,8 +3359,6 @@ public void testGroupByWhereOnGroupedColumn() throws Exception {
// WHERE on a NON-grouped column — grouped column must still be present
sParams =
params(
CommonParams.QT,
"/sql",
"aggregationMode",
"facet",
"stmt",
Expand Down Expand Up @@ -3404,8 +3396,6 @@ public void testDistinctWhereOnDistinctColumn() throws Exception {
// WHERE on one of the DISTINCT columns (facet mode)
SolrParams sParams =
params(
CommonParams.QT,
"/sql",
"aggregationMode",
"facet",
"stmt",
Expand All @@ -3423,8 +3413,6 @@ public void testDistinctWhereOnDistinctColumn() throws Exception {
// Data with field_i>10: id=3 (a,20), id=4 (c,30), id=5 (c,50) → DISTINCT str_s = {a, c}
sParams =
params(
CommonParams.QT,
"/sql",
"aggregationMode",
"facet",
"stmt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ The sample code below shows steps 1 and 2 of the recommendation:
[source,plain]
----
nodes(logs,
search(logs, q="userID:user1", fl="articleID", sort="articleID asc", fq="action:view", qt="/export"),
search(logs, q="userID:user1", fl="articleID", sort="articleID asc", fq="action:view", path="/export"),
walk="articleID->articleID",
gather="userID",
fq="action:view",
Expand Down Expand Up @@ -505,7 +505,7 @@ top(n="5",
top(n="30",
sort="count(*) desc",
nodes(logs,
search(logs, q="userID:user1", fl="articleID", sort="articleID asc", fq="action:read", qt="/export"),
search(logs, q="userID:user1", fl="articleID", sort="articleID asc", fq="action:read", path="/export"),
walk="articleID->articleID",
gather="userID",
fq="action:read",
Expand Down
Loading
Loading