SOLR-8601: RollupStream loses the type for group by buckets

This commit is contained in:
jbernste 2016-01-27 16:09:44 -05:00
parent b3eb7222df
commit ad96fd0d89
4 changed files with 10 additions and 14 deletions

View File

@ -2274,6 +2274,7 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
tuple = tuples.get(0);
assert(tuple.getLong("year_i") == 2015);
assert(tuple.get("year_i") instanceof Long); // SOLR-8601, This tests that the bucket is actually a Long and not parsed from a String.
assert(tuple.getDouble("sum(item_i)") == 66);
tuple = tuples.get(1);
@ -2296,6 +2297,8 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
tuple = tuples.get(0);
assert(tuple.getLong("year_i") == 2015);
assert(tuple.getLong("month_i") == 11);
assert(tuple.get("year_i") instanceof Long);
assert(tuple.get("month_i") instanceof Long);
assert(tuple.getDouble("sum(item_i)") == 57);
tuple = tuples.get(1);

View File

@ -28,17 +28,10 @@ public class HashKey implements Serializable {
public HashKey(String value) {
parts = (Object[])value.split("::");
parts = value.split("::");
}
public HashKey(Tuple t, String[] keys) {
this.parts = new Object[keys.length];
for(int i=0; i<keys.length; i++) {
parts[i] = t.get(keys[i]);
}
}
public HashKey(String[] parts) {
public HashKey(Object[] parts) {
this.parts = parts;
}

View File

@ -184,7 +184,7 @@ public class RollupStream extends TupleStream implements Expressible {
}
for(int i=0; i<buckets.length; i++) {
map.put(buckets[i].toString(), currentKey.getParts()[i].toString());
map.put(buckets[i].toString(), currentKey.getParts()[i]);
}
Tuple t = new Tuple(map);
tupleStream.pushBack(tuple);
@ -195,7 +195,7 @@ public class RollupStream extends TupleStream implements Expressible {
}
}
String[] bucketValues = new String[buckets.length];
Object[] bucketValues = new Object[buckets.length];
for(int i=0; i<buckets.length; i++) {
bucketValues[i] = buckets[i].getBucketValue(tuple);
}
@ -215,7 +215,7 @@ public class RollupStream extends TupleStream implements Expressible {
}
for(int i=0; i<buckets.length; i++) {
map.put(buckets[i].toString(), currentKey.getParts()[i].toString());
map.put(buckets[i].toString(), currentKey.getParts()[i]);
}
t = new Tuple(map);
}

View File

@ -38,8 +38,8 @@ public class Bucket implements Serializable {
this.bucketKey = bucketKey;
}
public String getBucketValue(Tuple tuple) {
return tuple.get(bucketKey).toString();
public Object getBucketValue(Tuple tuple) {
return tuple.get(bucketKey);
}
public String toString() {