Skip to content

Commit 377f66d

Browse files
committed
SOLR-17952: Stream decorator test refactoring - use underscore rather than dot in aliases (#3761)
1 parent cf4d1cb commit 377f66d

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

solr/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Other Changes
6060
* SOLR-17541: Deprecate `CloudHttp2SolrClient.Builder#withHttpClient` in favor of `CloudHttp2SolrClient.Builder#withInternalClientBuilder`.
6161
Deprecate `LBHttp2SolrClient.Builder#withListenerFactory` in favor of `LBHttp2SolrClient.Builder#withListenerFactories`. (James Dyer)
6262

63+
* SOLR-17952: Stream decorator test refactoring - use underscore rather than dot in aliases (Andy Webb)
64+
6365
================== 9.9.1 ==================
6466
Bug Fixes
6567
---------------------

solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,8 +2373,8 @@ public void testInnerJoinStream() throws Exception {
23732373
+ ", q=\"side_s:left\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"ident_s asc\"),"
23742374
+ "search("
23752375
+ COLLECTIONORALIAS
2376-
+ ", q=\"side_s:right\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"ident_s asc\", aliases=\"id=right.id, join1_i=right.join1_i, join2_s=right.join2_s, ident_s=right.ident_s\"),"
2377-
+ "on=\"ident_s=right.ident_s\")");
2376+
+ ", q=\"side_s:right\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"ident_s asc\", aliases=\"id=right_id, join1_i=right_join1_i, join2_s=right_join2_s, ident_s=right_ident_s\"),"
2377+
+ "on=\"ident_s=right_ident_s\")");
23782378
stream = new InnerJoinStream(expression, factory);
23792379
stream.setStreamContext(streamContext);
23802380
tuples = getTuples(stream);
@@ -2495,8 +2495,8 @@ public void testLeftOuterJoinStream() throws Exception {
24952495
+ ", q=\"side_s:left\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"ident_s asc\"),"
24962496
+ "search("
24972497
+ COLLECTIONORALIAS
2498-
+ ", q=\"side_s:right\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"ident_s asc\", aliases=\"id=right.id, join1_i=right.join1_i, join2_s=right.join2_s, ident_s=right.ident_s\"),"
2499-
+ "on=\"ident_s=right.ident_s\")");
2498+
+ ", q=\"side_s:right\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"ident_s asc\", aliases=\"id=right_id, join1_i=right_join1_i, join2_s=right_join2_s, ident_s=right_ident_s\"),"
2499+
+ "on=\"ident_s=right_ident_s\")");
25002500
stream = new LeftOuterJoinStream(expression, factory);
25012501
stream.setStreamContext(streamContext);
25022502
tuples = getTuples(stream);
@@ -3090,49 +3090,49 @@ public void testSelectStream() throws Exception {
30903090
clause =
30913091
"innerJoin("
30923092
+ "select("
3093-
+ "id, join1_i as left.join1, join2_s as left.join2, ident_s as left.ident,"
3093+
+ "id, join1_i as left_join1, join2_s as left_join2, ident_s as left_ident,"
30943094
+ "search(collection1, q=\"side_s:left\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"join1_i asc, join2_s asc, id asc\")"
30953095
+ "),"
30963096
+ "select("
3097-
+ "join3_i as right.join1, join2_s as right.join2, ident_s as right.ident,"
3097+
+ "join3_i as right_join1, join2_s as right_join2, ident_s as right_ident,"
30983098
+ "search(collection1, q=\"side_s:right\", fl=\"join3_i,join2_s,ident_s\", sort=\"join3_i asc, join2_s asc\"),"
30993099
+ "),"
3100-
+ "on=\"left.join1=right.join1, left.join2=right.join2\""
3100+
+ "on=\"left_join1=right_join1, left_join2=right_join2\""
31013101
+ ")";
31023102
stream = factory.constructStream(clause);
31033103
stream.setStreamContext(streamContext);
31043104
tuples = getTuples(stream);
31053105
assertFields(
31063106
tuples,
31073107
"id",
3108-
"left.join1",
3109-
"left.join2",
3110-
"left.ident",
3111-
"right.join1",
3112-
"right.join2",
3113-
"right.ident");
3108+
"left_join1",
3109+
"left_join2",
3110+
"left_ident",
3111+
"right_join1",
3112+
"right_join2",
3113+
"right_ident");
31143114

31153115
// Wrapped select test
31163116
clause =
31173117
"select("
3118-
+ "id, left.ident, right.ident,"
3118+
+ "id, left_ident, right_ident,"
31193119
+ "innerJoin("
31203120
+ "select("
3121-
+ "id, join1_i as left.join1, join2_s as left.join2, ident_s as left.ident,"
3121+
+ "id, join1_i as left_join1, join2_s as left_join2, ident_s as left_ident,"
31223122
+ "search(collection1, q=\"side_s:left\", fl=\"id,join1_i,join2_s,ident_s\", sort=\"join1_i asc, join2_s asc, id asc\")"
31233123
+ "),"
31243124
+ "select("
3125-
+ "join3_i as right.join1, join2_s as right.join2, ident_s as right.ident,"
3125+
+ "join3_i as right_join1, join2_s as right_join2, ident_s as right_ident,"
31263126
+ "search(collection1, q=\"side_s:right\", fl=\"join3_i,join2_s,ident_s\", sort=\"join3_i asc, join2_s asc\"),"
31273127
+ "),"
3128-
+ "on=\"left.join1=right.join1, left.join2=right.join2\""
3128+
+ "on=\"left_join1=right_join1, left_join2=right_join2\""
31293129
+ ")"
31303130
+ ")";
31313131
stream = factory.constructStream(clause);
31323132
stream.setStreamContext(streamContext);
31333133
tuples = getTuples(stream);
3134-
assertFields(tuples, "id", "left.ident", "right.ident");
3135-
assertNotFields(tuples, "left.join1", "left.join2", "right.join1", "right.join2");
3134+
assertFields(tuples, "id", "left_ident", "right_ident");
3135+
assertNotFields(tuples, "left_join1", "left_join2", "right_join1", "right_join2");
31363136
} finally {
31373137
solrClientCache.close();
31383138
}

solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ public void testCloudSolrStream() throws Exception {
169169
StreamExpressionParser.parse(
170170
"search("
171171
+ COLLECTIONORALIAS
172-
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_i asc\", aliases=\"a_i=alias.a_i, a_s=name\")");
172+
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_i asc\", aliases=\"a_i=alias_a_i, a_s=name\")");
173173
stream = new CloudSolrStream(expression, factory);
174174
stream.setStreamContext(streamContext);
175175
tuples = getTuples(stream);
176176

177177
assertEquals(5, tuples.size());
178178
assertOrder(tuples, 0, 2, 1, 3, 4);
179-
assertLong(tuples.get(0), "alias.a_i", 0);
179+
assertLong(tuples.get(0), "alias_a_i", 0);
180180
assertString(tuples.get(0), "name", "hello0");
181181

182182
// Basic filtered test
@@ -439,7 +439,7 @@ public void testCloudSolrStreamWithZkHost() throws Exception {
439439
StreamExpressionParser.parse(
440440
"search("
441441
+ COLLECTIONORALIAS
442-
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_i asc\", aliases=\"a_i=alias.a_i, a_s=name\", zkHost="
442+
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc, a_i asc\", aliases=\"a_i=alias_a_i, a_s=name\", zkHost="
443443
+ cluster.getZkServer().getZkAddress()
444444
+ ")");
445445
stream = new CloudSolrStream(expression, factory);
@@ -448,7 +448,7 @@ public void testCloudSolrStreamWithZkHost() throws Exception {
448448

449449
assertEquals(5, tuples.size());
450450
assertOrder(tuples, 0, 2, 1, 3, 4);
451-
assertLong(tuples.get(0), "alias.a_i", 0);
451+
assertLong(tuples.get(0), "alias_a_i", 0);
452452
assertString(tuples.get(0), "name", "hello0");
453453

454454
// Basic filtered test

solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/expr/StreamExpressionParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public StreamExpressionParserTest() {
3030
public void testParsing() {
3131
StreamExpression actual, expected;
3232

33-
actual = StreamExpressionParser.parse("aliases(a_i=alias.a_i)");
33+
actual = StreamExpressionParser.parse("aliases(a_i=alias_a_i)");
3434
expected =
3535
new StreamExpression("aliases")
36-
.withParameter(new StreamExpressionNamedParameter("a_i", "alias.a_i"));
36+
.withParameter(new StreamExpressionNamedParameter("a_i", "alias_a_i"));
3737
assertEquals(expected, actual);
3838

3939
actual = StreamExpressionParser.parse("search(a,b)");

0 commit comments

Comments
 (0)