|
|
|
@ -88,7 +88,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
waitForRecoveriesToFinish(false);
|
|
|
|
|
testPredicate();
|
|
|
|
|
testBasicSelect();
|
|
|
|
|
testStringLiteralFields();
|
|
|
|
|
testMixedCaseFields();
|
|
|
|
|
testBasicGrouping();
|
|
|
|
|
testBasicGroupingFacets();
|
|
|
|
|
testSelectDistinct();
|
|
|
|
@ -233,7 +233,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
commit();
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select 'id', field_i, str_s from collection1 where 'text'='XXXX' order by field_i desc");
|
|
|
|
|
params.put("stmt", "select 'id', field_i, str_s from collection1 where 'text'='XXXX' order by field_i desc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -284,7 +284,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select id, field_i, str_s from collection1 where text='XXXX' order by field_i desc limit 1");
|
|
|
|
|
params.put("stmt", "select id, field_i, str_s from collection1 where text='XXXX' order by field_i desc limit 1");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -298,7 +298,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select id, field_i, str_s from collection1 where text='XXXX' AND id='(1 2 3)' order by field_i desc");
|
|
|
|
|
params.put("stmt", "select id, field_i, str_s from collection1 where text='XXXX' AND id='(1 2 3)' order by field_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -326,7 +326,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void testStringLiteralFields() throws Exception {
|
|
|
|
|
private void testMixedCaseFields() throws Exception {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
CloudJettyRunner jetty = this.cloudJettys.get(0);
|
|
|
|
@ -335,18 +335,18 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
commit();
|
|
|
|
|
|
|
|
|
|
indexDoc(sdoc("id", "1", "Text_t", "XXXX XXXX", "str_s", "a", "Field_i", "7"));
|
|
|
|
|
indexDoc(sdoc("id", "2", "Text_t", "XXXX XXXX", "str_s", "b", "Field_i", "8"));
|
|
|
|
|
indexDoc(sdoc("id", "3", "Text_t", "XXXX XXXX", "str_s", "a", "Field_i", "20"));
|
|
|
|
|
indexDoc(sdoc("id", "4", "Text_t", "XXXX XXXX", "str_s", "b", "Field_i", "11"));
|
|
|
|
|
indexDoc(sdoc("id", "5", "Text_t", "XXXX XXXX", "str_s", "c", "Field_i", "30"));
|
|
|
|
|
indexDoc(sdoc("id", "6", "Text_t", "XXXX XXXX", "str_s", "c", "Field_i", "40"));
|
|
|
|
|
indexDoc(sdoc("id", "7", "Text_t", "XXXX XXXX", "str_s", "c", "Field_i", "50"));
|
|
|
|
|
indexDoc(sdoc("id", "8", "Text_t", "XXXX XXXX", "str_s", "c", "Field_i", "60"));
|
|
|
|
|
indexDoc(sdoc("id", "1", "Text_t", "XXXX XXXX", "Str_s", "a", "Field_i", "7"));
|
|
|
|
|
indexDoc(sdoc("id", "2", "Text_t", "XXXX XXXX", "Str_s", "b", "Field_i", "8"));
|
|
|
|
|
indexDoc(sdoc("id", "3", "Text_t", "XXXX XXXX", "Str_s", "a", "Field_i", "20"));
|
|
|
|
|
indexDoc(sdoc("id", "4", "Text_t", "XXXX XXXX", "Str_s", "b", "Field_i", "11"));
|
|
|
|
|
indexDoc(sdoc("id", "5", "Text_t", "XXXX XXXX", "Str_s", "c", "Field_i", "30"));
|
|
|
|
|
indexDoc(sdoc("id", "6", "Text_t", "XXXX XXXX", "Str_s", "c", "Field_i", "40"));
|
|
|
|
|
indexDoc(sdoc("id", "7", "Text_t", "XXXX XXXX", "Str_s", "c", "Field_i", "50"));
|
|
|
|
|
indexDoc(sdoc("id", "8", "Text_t", "XXXX XXXX", "Str_s", "c", "Field_i", "60"));
|
|
|
|
|
commit();
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select id, 'Field_i', str_s from Collection1 where 'Text_t'='XXXX' order by 'Field_i' desc");
|
|
|
|
|
params.put("stmt", "select id, Field_i, Str_s from Collection1 where Text_t='XXXX' order by Field_i desc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -358,42 +358,77 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
tuple = tuples.get(0);
|
|
|
|
|
assert(tuple.getLong("id") == 8);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 60);
|
|
|
|
|
assert(tuple.get("str_s").equals("c"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("c"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(1);
|
|
|
|
|
assert(tuple.getLong("id") == 7);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 50);
|
|
|
|
|
assert(tuple.get("str_s").equals("c"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("c"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(2);
|
|
|
|
|
assert(tuple.getLong("id") == 6);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 40);
|
|
|
|
|
assert(tuple.get("str_s").equals("c"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("c"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(3);
|
|
|
|
|
assert(tuple.getLong("id") == 5);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 30);
|
|
|
|
|
assert(tuple.get("str_s").equals("c"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("c"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(4);
|
|
|
|
|
assert(tuple.getLong("id") == 3);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 20);
|
|
|
|
|
assert(tuple.get("str_s").equals("a"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("a"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(5);
|
|
|
|
|
assert(tuple.getLong("id") == 4);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 11);
|
|
|
|
|
assert(tuple.get("str_s").equals("b"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("b"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(6);
|
|
|
|
|
assert(tuple.getLong("id") == 2);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 8);
|
|
|
|
|
assert(tuple.get("str_s").equals("b"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("b"));
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(7);
|
|
|
|
|
assert(tuple.getLong("id") == 1);
|
|
|
|
|
assert(tuple.getLong("Field_i") == 7);
|
|
|
|
|
assert(tuple.get("str_s").equals("a"));
|
|
|
|
|
assert(tuple.get("Str_s").equals("a"));
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("stmt", "select Str_s, sum(Field_i) from Collection1 where 'id'='(1 8)' group by Str_s having (sum(Field_i) = 7 OR 'sum(Field_i)' = 60) order by 'sum(Field_i)' desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
|
|
|
|
|
|
assert(tuples.size() == 2);
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(0);
|
|
|
|
|
assert(tuple.get("Str_s").equals("c"));
|
|
|
|
|
assert(tuple.getDouble("sum(Field_i)") == 60);
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(1);
|
|
|
|
|
assert(tuple.get("Str_s").equals("a"));
|
|
|
|
|
assert(tuple.getDouble("sum(Field_i)") == 7);
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("stmt", "select Str_s, sum(Field_i) from Collection1 where 'id'='(1 8)' group by 'Str_s' having (sum(Field_i) = 7 OR 'sum(Field_i)' = 60) order by 'sum(Field_i)' desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
|
|
|
|
|
|
assert(tuples.size() == 2);
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(0);
|
|
|
|
|
assert(tuple.get("Str_s").equals("c"));
|
|
|
|
|
assert(tuple.getDouble("sum(Field_i)") == 60);
|
|
|
|
|
|
|
|
|
|
tuple = tuples.get(1);
|
|
|
|
|
assert(tuple.get("Str_s").equals("a"));
|
|
|
|
|
assert(tuple.getDouble("sum(Field_i)") == 7);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
delete();
|
|
|
|
@ -421,7 +456,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select id, field_i, str_s from collection1 where text='XXXX' order by field_iff desc");
|
|
|
|
|
params.put("stmt", "select id, field_i, str_s from collection1 where text='XXXX' order by field_iff desc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
Tuple tuple = getTuple(new ExceptionStream(solrStream));
|
|
|
|
@ -432,7 +467,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select id, field_iff, str_s from collection1 where text='XXXX' order by field_iff desc");
|
|
|
|
|
params.put("stmt", "select id, field_iff, str_s from collection1 where text='XXXX' order by field_iff desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuple = getTuple(new ExceptionStream(solrStream));
|
|
|
|
@ -443,7 +478,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_iff), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_iff) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_iff), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_iff) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuple = getTuple(new ExceptionStream(solrStream));
|
|
|
|
@ -454,7 +489,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, count(*), blah(field_iff), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_iff) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), blah(field_iff), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_iff) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuple = getTuple(new ExceptionStream(solrStream));
|
|
|
|
@ -465,7 +500,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s from collection1 where text='XXXX' group by str_s");
|
|
|
|
|
params.put("stmt", "select str_s from collection1 where text='XXXX' group by str_s");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuple = getTuple(new ExceptionStream(solrStream));
|
|
|
|
@ -498,7 +533,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
commit();
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, 'count(*)', sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by 'str_s' order by 'sum(field_i)' asc limit 2");
|
|
|
|
|
params.put("stmt", "select str_s, 'count(*)', sum('field_i'), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by 'str_s' order by 'sum(field_i)' asc limit 2");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -526,7 +561,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where (text='XXXX' AND NOT text='XXXX XXX') group by str_s order by str_s desc");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where (text='XXXX' AND NOT text='XXXX XXX') group by str_s order by str_s desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -563,7 +598,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having sum(field_i) = 19");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having sum(field_i) = 19");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -580,7 +615,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -598,7 +633,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 100))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 100))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -633,7 +668,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select distinct 'str_s', 'field_i' from collection1 order by 'str_s' asc, 'field_i' asc");
|
|
|
|
|
params.put("stmt", "select distinct 'str_s', 'field_i' from collection1 order by 'str_s' asc, 'field_i' asc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -671,7 +706,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -709,7 +744,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -730,7 +765,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -767,7 +802,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 where str_s = 'a'");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 where str_s = 'a'");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -809,7 +844,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
commit();
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select distinct 'str_s', 'field_i' from collection1 order by 'str_s' asc, 'field_i' asc");
|
|
|
|
|
params.put("stmt", "select distinct 'str_s', 'field_i' from collection1 order by 'str_s' asc, 'field_i' asc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -846,7 +881,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
//reverse the sort
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -883,7 +918,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
//test with limit
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -903,7 +938,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -938,7 +973,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 where str_s = 'a'");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 where str_s = 'a'");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -980,7 +1015,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s asc, field_i asc");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s asc, field_i asc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -1018,7 +1053,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1056,7 +1091,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1077,7 +1112,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1113,7 +1148,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select distinct str_s, field_i from collection1 where str_s = 'a'");
|
|
|
|
|
params.put("stmt", "select distinct str_s, field_i from collection1 where str_s = 'a'");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1156,7 +1191,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select 'str_s', 'count(*)', sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by 'str_s' order by 'sum(field_i)' asc limit 2");
|
|
|
|
|
params.put("stmt", "select 'str_s', 'count(*)', sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by 'str_s' order by 'sum(field_i)' asc limit 2");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -1185,7 +1220,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where (text='XXXX' AND NOT text='XXXX XXX') group by str_s order by str_s desc");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where (text='XXXX' AND NOT text='XXXX XXX') group by str_s order by str_s desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1223,7 +1258,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having sum(field_i) = 19");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having 'sum(field_i)' = 19");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1241,7 +1276,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having (('sum(field_i)' = 19) AND (min(field_i) = 8))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1260,7 +1295,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 100))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 100))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1298,7 +1333,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s order by sum(field_i) asc limit 2");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s order by sum(field_i) asc limit 2");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -1328,7 +1363,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s order by str_s desc");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s order by str_s desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1365,7 +1400,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having sum(field_i) = 19");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having sum(field_i) = 19");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1392,7 +1427,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 8))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1411,7 +1446,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", "2");
|
|
|
|
|
params.put("sql", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 100))");
|
|
|
|
|
params.put("stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), avg(field_i) from collection1 where text='XXXX' group by str_s having ((sum(field_i) = 19) AND (min(field_i) = 100))");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1447,7 +1482,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select count(*), sum(a_i), min(a_i), max(a_i), avg(a_i), sum(a_f), min(a_f), max(a_f), avg(a_f) from collection1");
|
|
|
|
|
params.put("stmt", "select count(*), sum(a_i), min(a_i), max(a_i), avg(a_i), sum(a_f), min(a_f), max(a_f), avg(a_f) from collection1");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
|
|
|
|
@ -1485,7 +1520,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select count(*), sum(a_i), min(a_i), max(a_i), avg(a_i), sum(a_f), min(a_f), max(a_f), avg(a_f) from collection1 where id = 2");
|
|
|
|
|
params.put("stmt", "select count(*), sum(a_i), min(a_i), max(a_i), avg(a_i), sum(a_f), min(a_f), max(a_f), avg(a_f) from collection1 where id = 2");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
|
|
|
|
@ -1520,7 +1555,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select count(*), sum(a_i), min(a_i), max(a_i), avg(a_i), sum(a_f), min(a_f), max(a_f), avg(a_f) from collection1 where a_s = 'blah'");
|
|
|
|
|
params.put("stmt", "select count(*), sum(a_i), min(a_i), max(a_i), avg(a_i), sum(a_f), min(a_f), max(a_f), avg(a_f) from collection1 where a_s = 'blah'");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
|
|
|
|
@ -1578,7 +1613,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
commit();
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select year_i, sum(item_i) from collection1 group by year_i order by year_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, sum(item_i) from collection1 group by year_i order by year_i desc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -1596,7 +1631,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
assert(tuple.getLong("year_i") == 2014);
|
|
|
|
|
assert(tuple.getDouble("sum(item_i)") == 7);
|
|
|
|
|
|
|
|
|
|
params.put("sql", "select year_i, month_i, sum(item_i) from collection1 group by year_i, month_i order by year_i desc, month_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, month_i, sum(item_i) from collection1 group by year_i, month_i order by year_i desc, month_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1623,7 +1658,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("sql", "select year_i, month_i, day_i, sum(item_i) from collection1 group by year_i, month_i, day_i order by year_i desc, month_i desc, day_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, month_i, day_i, sum(item_i) from collection1 group by year_i, month_i, day_i order by year_i desc, month_i desc, day_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1697,7 +1732,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select year_i, sum(item_i) from collection1 group by year_i order by year_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, sum(item_i) from collection1 group by year_i order by year_i desc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -1719,7 +1754,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select year_i, month_i, sum(item_i) from collection1 group by year_i, month_i order by year_i desc, month_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, month_i, sum(item_i) from collection1 group by year_i, month_i order by year_i desc, month_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1746,7 +1781,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("aggregationMode", "facet");
|
|
|
|
|
params.put("sql", "select year_i, month_i, day_i, sum(item_i) from collection1 group by year_i, month_i, day_i order by year_i desc, month_i desc, day_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, month_i, day_i, sum(item_i) from collection1 group by year_i, month_i, day_i order by year_i desc, month_i desc, day_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1816,7 +1851,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
Map params = new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", 2);
|
|
|
|
|
params.put("sql", "select year_i, sum(item_i) from collection1 group by year_i order by year_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, sum(item_i) from collection1 group by year_i order by year_i desc");
|
|
|
|
|
|
|
|
|
|
SolrStream solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
List<Tuple> tuples = getTuples(solrStream);
|
|
|
|
@ -1837,7 +1872,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", 2);
|
|
|
|
|
params.put("sql", "select year_i, month_i, sum(item_i) from collection1 group by year_i, month_i order by year_i desc, month_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, month_i, sum(item_i) from collection1 group by year_i, month_i order by year_i desc, month_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
@ -1866,7 +1901,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
|
|
|
|
|
new HashMap();
|
|
|
|
|
params.put(CommonParams.QT, "/sql");
|
|
|
|
|
params.put("numWorkers", 2);
|
|
|
|
|
params.put("sql", "select year_i, month_i, day_i, sum(item_i) from collection1 group by year_i, month_i, day_i order by year_i desc, month_i desc, day_i desc");
|
|
|
|
|
params.put("stmt", "select year_i, month_i, day_i, sum(item_i) from collection1 group by year_i, month_i, day_i order by year_i desc, month_i desc, day_i desc");
|
|
|
|
|
|
|
|
|
|
solrStream = new SolrStream(jetty.url, params);
|
|
|
|
|
tuples = getTuples(solrStream);
|
|
|
|
|