Skip to content

Commit

Permalink
make Druid case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
fjy committed Nov 19, 2014
1 parent 109fdf0 commit fdeab0c
Show file tree
Hide file tree
Showing 30 changed files with 139 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public ApproximateHistogramAggregatorFactory(
)
{
this.name = name;
this.fieldName = fieldName.toLowerCase();
this.fieldName = fieldName;
this.resolution = resolution == null ? ApproximateHistogram.DEFAULT_HISTOGRAM_SIZE : resolution;
this.numBuckets = numBuckets == null ? ApproximateHistogram.DEFAULT_BUCKET_SIZE : numBuckets;
this.lowerLimit = lowerLimit == null ? Float.NEGATIVE_INFINITY : lowerLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void testGroupByWithApproximateHistogramAgg()
Arrays.<DimensionSpec>asList(
new DefaultDimensionSpec(
QueryRunnerTestHelper.marketDimension,
"marKetAlias"
"marketalias"
)
)
)
Expand All @@ -169,7 +169,7 @@ public void testGroupByWithApproximateHistogramAgg()
new DefaultLimitSpec(
Lists.newArrayList(
new OrderByColumnSpec(
"marKetAlias",
"marketalias",
OrderByColumnSpec.Direction.DESCENDING
)
), 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ protected void setup(Context context)
config = HadoopDruidIndexerConfig.fromConfiguration(context.getConfiguration());

for (AggregatorFactory factory : config.getSchema().getDataSchema().getAggregators()) {
metricNames.add(factory.getName().toLowerCase());
metricNames.add(factory.getName());
}

parser = config.getParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected AbstractTask(String id, String groupId, TaskResource taskResource, Str
this.id = Preconditions.checkNotNull(id, "id");
this.groupId = Preconditions.checkNotNull(groupId, "groupId");
this.taskResource = Preconditions.checkNotNull(taskResource, "resource");
this.dataSource = Preconditions.checkNotNull(dataSource.toLowerCase(), "dataSource");
this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource");
}

@JsonProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public String apply(DataSegment x)
return String.format(
"%s_%s",
dataSource,
Hashing.sha1().hashString(segmentIDs, Charsets.UTF_8).toString().toLowerCase()
Hashing.sha1().hashString(segmentIDs, Charsets.UTF_8).toString()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testID()
+ "_2012-01-04T00:00:00.000Z_2012-01-06T00:00:00.000Z_V1_0"
+ "_2012-01-05T00:00:00.000Z_2012-01-07T00:00:00.000Z_V1_0"
, Charsets.UTF_8
).toString().toLowerCase() + "_";
).toString() + "_";
Assert.assertEquals(
desiredPrefix,
testMergeTaskBase.getId().substring(0, desiredPrefix.length())
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<metamx.java-util.version>0.26.9</metamx.java-util.version>
<apache.curator.version>2.6.0</apache.curator.version>
<druid.api.version>0.2.18-SNAPSHOT</druid.api.version>
<druid.api.version>0.3.0</druid.api.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class TableDataSource implements DataSource
@JsonCreator
public TableDataSource(@JsonProperty("name") String name)
{
this.name = (name == null ? null : name.toLowerCase());
this.name = (name == null ? null : name);
}

@JsonProperty
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public HyperUniquesAggregatorFactory(
)
{
this.name = name;
this.fieldName = fieldName.toLowerCase();
this.fieldName = fieldName;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private Ordering<Row> dimensionOrdering(final String dimension)
public String apply(Row input)
{
// Multi-value dimensions have all been flattened at this point;
final List<String> dimList = input.getDimension(dimension.toLowerCase());
final List<String> dimList = input.getDimension(dimension);
return dimList.isEmpty() ? null : dimList.get(0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Sequence<Result<SearchResultValue>> run(
}

for (String dimension : dimsToSearch) {
final Column column = index.getColumn(dimension.toLowerCase());
final Column column = index.getColumn(dimension);
if (column == null) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.collect.Lists;

import java.nio.ByteBuffer;
import java.util.List;
Expand All @@ -41,17 +39,7 @@ public FragmentSearchQuerySpec(
@JsonProperty("values") List<String> values
)
{
this.values = Lists.transform(
values,
new Function<String, String>()
{
@Override
public String apply(String s)
{
return s.toLowerCase();
}
}
);
this.values = values;
}

@JsonProperty
Expand All @@ -64,7 +52,7 @@ public List<String> getValues()
public boolean accept(String dimVal)
{
for (String value : values) {
if (dimVal == null || !dimVal.toLowerCase().contains(value)) {
if (dimVal == null || !dimVal.toLowerCase().contains(value.toLowerCase())) {
return false;
}
}
Expand Down Expand Up @@ -97,19 +85,25 @@ public byte[] getCacheKey()
public String toString()
{
return "FragmentSearchQuerySpec{" +
"values=" + values +
"values=" + values +
"}";
}

@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

FragmentSearchQuerySpec that = (FragmentSearchQuerySpec) o;

if (values != null ? !values.equals(that.values) : that.values != null) return false;
if (values != null ? !values.equals(that.values) : that.values != null) {
return false;
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public InsensitiveContainsSearchQuerySpec(
@JsonProperty("value") String value
)
{
this.value = value.toLowerCase();
this.value = value;
}

@JsonProperty
Expand All @@ -53,7 +53,7 @@ public boolean accept(String dimVal)
if (dimVal == null) {
return false;
}
return dimVal.toLowerCase().contains(value);
return dimVal.toLowerCase().contains(value.toLowerCase());
}

@Override
Expand All @@ -78,12 +78,18 @@ public String toString()
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

InsensitiveContainsSearchQuerySpec that = (InsensitiveContainsSearchQuerySpec) o;

if (value != null ? !value.equals(that.value) : that.value != null) return false;
if (value != null ? !value.equals(that.value) : that.value != null) {
return false;
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ColumnSelectorBitmapIndexSelector(
@Override
public Indexed<String> getDimensionValues(String dimension)
{
final Column columnDesc = index.getColumn(dimension.toLowerCase());
final Column columnDesc = index.getColumn(dimension);
if (columnDesc == null || !columnDesc.getCapabilities().isDictionaryEncoded()) {
return null;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public BitmapFactory getBitmapFactory()
@Override
public ImmutableBitmap getBitmapIndex(String dimension, String value)
{
final Column column = index.getColumn(dimension.toLowerCase());
final Column column = index.getColumn(dimension);
if (column == null) {
return bitmapFactory.makeEmptyImmutableBitmap();
}
Expand All @@ -126,7 +126,7 @@ public ImmutableBitmap getBitmapIndex(String dimension, String value)
@Override
public ImmutableBitmap getBitmapIndex(String dimension, int idx)
{
final Column column = index.getColumn(dimension.toLowerCase());
final Column column = index.getColumn(dimension);
if (column == null || column.getCapabilities() == null) {
bitmapFactory.makeEmptyImmutableBitmap();
}
Expand All @@ -143,7 +143,7 @@ public ImmutableBitmap getBitmapIndex(String dimension, int idx)
@Override
public ImmutableRTree getSpatialIndex(String dimension)
{
final Column column = index.getColumn(dimension.toLowerCase());
final Column column = index.getColumn(dimension);
if (column == null || !column.getCapabilities().hasSpatialIndexes()) {
return new ImmutableRTree();
}
Expand Down
Loading

0 comments on commit fdeab0c

Please sign in to comment.