risdenk commented on a change in pull request #717:
URL: https://github.com/apache/solr/pull/717#discussion_r817885920
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -1142,79 +1275,104 @@ public void testFacetStream() throws Exception {
}
// Select and export should be identical sort orders I think.
- private void checkSort(JettySolrRunner jetty, String field, String sortDir,
String[] fields) throws IOException, SolrServerException {
+ private void checkSort(JettySolrRunner jetty, String field, String sortDir,
String[] fields)
+ throws IOException, SolrServerException {
// Comes back after after LUCENE-7548
-// SolrQuery query = new SolrQuery("*:*");
-// query.addSort(field, ("asc".equals(sortDir) ? SolrQuery.ORDER.asc :
SolrQuery.ORDER.desc));
-// query.addSort("id", SolrQuery.ORDER.asc);
-// query.addField("id");
-// query.addField(field);
-// query.setRequestHandler("standard");
-// query.setRows(100);
-//
-// List<String> selectOrder = new ArrayList<>();
-//
-// String url = jetty.getBaseUrl() + "/" + COLLECTION;
-//
-// try (HttpSolrClient client = getHttpSolrClient(url)) {
-// client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
-// QueryResponse rsp = client.query(query);
-// for (SolrDocument doc : rsp.getResults()) {
-// selectOrder.add((String) doc.getFieldValue("id"));
-// }
-// }
-// SolrParams exportParams = params("q", "*:*", "qt", "/export", "fl",
"id," + field, "sort", field + " " + sortDir + ",id asc");
-// try (CloudSolrStream solrStream = new CloudSolrStream(zkHost,
COLLECTIONORALIAS, exportParams)) {
-// List<Tuple> tuples = getTuples(solrStream);
-// assertEquals("There should be exactly 32 responses returned", 32,
tuples.size());
-// // Since the getTuples method doesn't return the EOF tuple, these two
entries should be the same size.
-// assertEquals("Tuple count should exactly match sort array size for
field " + field + " sort order " + sortDir, selectOrder.size(), tuples.size());
-//
-// for (int idx = 0; idx < selectOrder.size(); ++idx) { // Tuples should
be in lock step with the orders from select.
-// assertEquals("Order for missing docValues fields wrong for field '"
+ field + "' sort direction '" + sortDir,
-// tuples.get(idx).getString("id"), selectOrder.get(idx));
-// }
-// }
+ // SolrQuery query = new SolrQuery("*:*");
+ // query.addSort(field, ("asc".equals(sortDir) ? SolrQuery.ORDER.asc :
+ // SolrQuery.ORDER.desc));
+ // query.addSort("id", SolrQuery.ORDER.asc);
+ // query.addField("id");
+ // query.addField(field);
+ // query.setRequestHandler("standard");
+ // query.setRows(100);
+ //
+ // List<String> selectOrder = new ArrayList<>();
+ //
+ // String url = jetty.getBaseUrl() + "/" + COLLECTION;
+ //
+ // try (HttpSolrClient client = getHttpSolrClient(url)) {
+ // client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
+ // QueryResponse rsp = client.query(query);
+ // for (SolrDocument doc : rsp.getResults()) {
+ // selectOrder.add((String) doc.getFieldValue("id"));
+ // }
+ // }
+ // SolrParams exportParams = params("q", "*:*", "qt", "/export", "fl",
"id," + field, "sort",
+ // field + " " + sortDir + ",id asc");
+ // try (CloudSolrStream solrStream = new CloudSolrStream(zkHost,
COLLECTIONORALIAS,
+ // exportParams)) {
+ // List<Tuple> tuples = getTuples(solrStream);
+ // assertEquals("There should be exactly 32 responses returned", 32,
tuples.size());
+ // // Since the getTuples method doesn't return the EOF tuple, these
two entries should be
+ // the same size.
+ // assertEquals("Tuple count should exactly match sort array size for
field " + field + "
+ // sort order " + sortDir, selectOrder.size(), tuples.size());
+ //
+ // for (int idx = 0; idx < selectOrder.size(); ++idx) { // Tuples
should be in lock step
+ // with the orders from select.
+ // assertEquals("Order for missing docValues fields wrong for field
'" + field + "' sort
+ // direction '" + sortDir,
+ // tuples.get(idx).getString("id"), selectOrder.get(idx));
+ // }
+ // }
// Remove below and uncomment above after LUCENE-7548
- List<String> selectOrder = ("asc".equals(sortDir)) ?
Arrays.asList(ascOrder) : Arrays.asList(descOrder);
- List<String> selectOrderBool = ("asc".equals(sortDir)) ?
Arrays.asList(ascOrderBool) : Arrays.asList(descOrderBool);
- SolrParams exportParams = params("q", "*:*", "qt", "/export", "fl", "id,"
+ field, "sort", field + " " + sortDir + ",id asc");
+ List<String> selectOrder =
+ ("asc".equals(sortDir)) ? Arrays.asList(ascOrder) :
Arrays.asList(descOrder);
+ List<String> selectOrderBool =
+ ("asc".equals(sortDir)) ? Arrays.asList(ascOrderBool) :
Arrays.asList(descOrderBool);
+ SolrParams exportParams =
+ params(
+ "q",
+ "*:*",
+ "qt",
+ "/export",
+ "fl",
+ "id," + field,
+ "sort",
+ field + " " + sortDir + ",id asc");
StreamContext streamContext = new StreamContext();
SolrClientCache solrClientCache = new SolrClientCache();
streamContext.setSolrClientCache(solrClientCache);
- try (CloudSolrStream solrStream = new CloudSolrStream(zkHost,
COLLECTIONORALIAS, exportParams)) {
+ try (CloudSolrStream solrStream =
+ new CloudSolrStream(zkHost, COLLECTIONORALIAS, exportParams)) {
solrStream.setStreamContext(streamContext);
List<Tuple> tuples = getTuples(solrStream);
assertEquals("There should be exactly 32 responses returned", 32,
tuples.size());
- // Since the getTuples method doesn't return the EOF tuple, these two
entries should be the same size.
- assertEquals("Tuple count should exactly match sort array size for field
" + field + " sort order " + sortDir, selectOrder.size(), tuples.size());
-
- for (int idx = 0; idx < selectOrder.size(); ++idx) { // Tuples should be
in lock step with the orders passed in.
- assertEquals("Order for missing docValues fields wrong for field '" +
field + "' sort direction '" + sortDir +
- "' RESTORE GETTING selectOrder from select statement after
LUCENE-7548",
- tuples.get(idx).getString("id"), (field.startsWith("b_") ?
selectOrderBool.get(idx) : selectOrder.get(idx)));
+ // Since the getTuples method doesn't return the EOF tuple, these two
entries should be the
+ // same size.
+ assertEquals(
+ "Tuple count should exactly match sort array size for field "
+ + field
+ + " sort order "
+ + sortDir,
+ selectOrder.size(),
+ tuples.size());
+
+ for (int idx = 0;
+ idx < selectOrder.size();
+ ++idx) { // Tuples should be in lock step with the orders passed in.
Review comment:
Fix this
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -1133,7 +1262,11 @@ public void testFacetStream() throws Exception {
pairs.add("d_sing");
pairs.add(Double.toString(iSeq + 5)); // 105
pairs.add("dt_sing");
- pairs.add(String.format(Locale.ROOT, "2000-01-01T%02d:00:00Z", base)); //
Works as long as we add fewer than 60 docs
+ pairs.add(
+ String.format(
+ Locale.ROOT,
+ "2000-01-01T%02d:00:00Z",
+ base)); // Works as long as we add fewer than 60 docs
Review comment:
Fix this
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -2007,7 +2187,8 @@ public void testParallelRollupStream() throws Exception {
}
@Test
- // commented out on: 17-Feb-2019
@BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") //
6-Sep-2018
+ // commented out on: 17-Feb-2019
+ // @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") //
6-Sep-2018
Review comment:
Fix this
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -2488,112 +2769,200 @@ private void trySortWithQt(String which) throws
Exception {
assertEquals(5, tuples.size());
assertOrder(tuples, 2, 0, 1, 4, 3);
- //Basic CloudSolrStream Test ates desc
+ // Basic CloudSolrStream Test ates desc
sParams = params("q", "*:*", "qt", which, "fl", "id,dt_sing", "sort",
"dt_sing asc,id desc");
stream = new CloudSolrStream(zkHost, COLLECTIONORALIAS, sParams);
stream.setStreamContext(streamContext);
tuples = getTuples(stream);
- assertEquals (5,tuples.size());
+ assertEquals(5, tuples.size());
assertOrder(tuples, 3, 4, 1, 0, 2);
} finally {
solrClientCache.close();
}
-
}
-
@Test
public void testAllValidExportTypes() throws Exception {
- //Test whether all the expected types are actually returned, including
booleans and dates.
- // The contract is that the /select and /export handlers return the same
format, so we can test this once each
+ // Test whether all the expected types are actually returned, including
booleans and dates.
+ // The contract is that the /select and /export handlers return the same
format, so we can test
+ // this once each
// way
Review comment:
Fix this
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -2166,7 +2374,8 @@ public void testMergeStream() throws Exception {
}
@Test
- // commented out on: 17-Feb-2019
@BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") //
6-Sep-2018
+ // commented out on: 17-Feb-2019
+ // @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") //
6-Sep-2018
Review comment:
Fix this
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -2488,112 +2769,200 @@ private void trySortWithQt(String which) throws
Exception {
assertEquals(5, tuples.size());
assertOrder(tuples, 2, 0, 1, 4, 3);
- //Basic CloudSolrStream Test ates desc
+ // Basic CloudSolrStream Test ates desc
sParams = params("q", "*:*", "qt", which, "fl", "id,dt_sing", "sort",
"dt_sing asc,id desc");
stream = new CloudSolrStream(zkHost, COLLECTIONORALIAS, sParams);
stream.setStreamContext(streamContext);
tuples = getTuples(stream);
- assertEquals (5,tuples.size());
+ assertEquals(5, tuples.size());
assertOrder(tuples, 3, 4, 1, 0, 2);
} finally {
solrClientCache.close();
}
-
}
-
@Test
public void testAllValidExportTypes() throws Exception {
- //Test whether all the expected types are actually returned, including
booleans and dates.
- // The contract is that the /select and /export handlers return the same
format, so we can test this once each
+ // Test whether all the expected types are actually returned, including
booleans and dates.
+ // The contract is that the /select and /export handlers return the same
format, so we can test
+ // this once each
// way
new UpdateRequest()
- .add(id, "0", "i_sing", "11", "i_multi", "12", "i_multi", "13",
- "l_sing", "14", "l_multi", "15", "l_multi", "16",
- "f_sing", "1.70", "f_multi", "1.80", "f_multi", "1.90",
- "d_sing", "1.20", "d_multi", "1.21", "d_multi", "1.22",
- "s_sing", "single", "s_multi", "sm1", "s_multi", "sm2",
- "dt_sing", "1980-01-02T11:11:33.89Z", "dt_multi",
"1981-03-04T01:02:03.78Z", "dt_multi", "1981-05-24T04:05:06.99Z",
- "b_sing", "true", "b_multi", "false", "b_multi", "true"
- )
+ .add(
+ id,
+ "0",
+ "i_sing",
+ "11",
+ "i_multi",
+ "12",
+ "i_multi",
+ "13",
+ "l_sing",
+ "14",
+ "l_multi",
+ "15",
+ "l_multi",
+ "16",
+ "f_sing",
+ "1.70",
+ "f_multi",
+ "1.80",
+ "f_multi",
+ "1.90",
+ "d_sing",
+ "1.20",
+ "d_multi",
+ "1.21",
+ "d_multi",
+ "1.22",
+ "s_sing",
+ "single",
+ "s_multi",
+ "sm1",
+ "s_multi",
+ "sm2",
+ "dt_sing",
+ "1980-01-02T11:11:33.89Z",
+ "dt_multi",
+ "1981-03-04T01:02:03.78Z",
+ "dt_multi",
+ "1981-05-24T04:05:06.99Z",
+ "b_sing",
+ "true",
+ "b_multi",
+ "false",
+ "b_multi",
+ "true")
.commit(cluster.getSolrClient(), COLLECTIONORALIAS);
tryWithQt("/export");
tryWithQt("/select");
}
- // We should be getting the exact same thing back with both the export and
select handlers, so test
+ // We should be getting the exact same thing back with both the export and
select handlers, so
+ // test
private void tryWithQt(String which) throws IOException {
StreamContext streamContext = new StreamContext();
SolrClientCache solrClientCache = new SolrClientCache();
streamContext.setSolrClientCache(solrClientCache);
- SolrParams sParams = params("q", "*:*", "qt", which, "fl",
-
"id,i_sing,i_multi,l_sing,l_multi,f_sing,f_multi,d_sing,d_multi,dt_sing,dt_multi,s_sing,s_multi,b_sing,b_multi",
- "sort", "i_sing asc");
+ SolrParams sParams =
+ params(
+ "q",
+ "*:*",
+ "qt",
+ which,
+ "fl",
+
"id,i_sing,i_multi,l_sing,l_multi,f_sing,f_multi,d_sing,d_multi,dt_sing,dt_multi,s_sing,s_multi,b_sing,b_multi",
+ "sort",
+ "i_sing asc");
try (CloudSolrStream stream = new CloudSolrStream(zkHost,
COLLECTIONORALIAS, sParams)) {
stream.setStreamContext(streamContext);
- Tuple tuple = getTuple(stream); // All I really care about is that all
the fields are returned. There's
+ Tuple tuple =
+ getTuple(stream); // All I really care about is that all the fields
are returned. There's
Review comment:
Fix this
##########
File path:
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamingTest.java
##########
@@ -2727,8 +3115,10 @@ public void testCloudStreamClientCache() throws
Exception {
List<TupleStream> solrStreams = stream.children();
assertEquals(expectedNumStreams, solrStreams.size());
for (TupleStream next : solrStreams) {
- SolrStream ss = (SolrStream)next;
- assertTrue(baseUrls.contains(ss.getBaseUrl())); // SolrStream uses the
baseUrl of the replica and not the coreUrl
+ SolrStream ss = (SolrStream) next;
+ assertTrue(
+ baseUrls.contains(
+ ss.getBaseUrl())); // SolrStream uses the baseUrl of the
replica and not the coreUrl
Review comment:
Fix this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]