mirror of https://github.com/apache/druid.git
Make StringComparator deserialization case-insensitive (#3356)
This commit is contained in:
parent
18af480017
commit
454587857c
|
@ -29,7 +29,7 @@ public abstract class StringComparator implements Comparator<String>
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public static StringComparator fromString(String type)
|
public static StringComparator fromString(String type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type.toLowerCase()) {
|
||||||
case StringComparators.LEXICOGRAPHIC_NAME:
|
case StringComparators.LEXICOGRAPHIC_NAME:
|
||||||
return StringComparators.LEXICOGRAPHIC;
|
return StringComparators.LEXICOGRAPHIC;
|
||||||
case StringComparators.ALPHANUMERIC_NAME:
|
case StringComparators.ALPHANUMERIC_NAME:
|
||||||
|
|
|
@ -207,5 +207,9 @@ public class StringComparatorsTest
|
||||||
String makeFromJsonSpec = "\"numeric\"";
|
String makeFromJsonSpec = "\"numeric\"";
|
||||||
Assert.assertEquals(StringComparators.NUMERIC
|
Assert.assertEquals(StringComparators.NUMERIC
|
||||||
, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class));
|
, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class));
|
||||||
|
|
||||||
|
makeFromJsonSpec = "\"NuMeRiC\"";
|
||||||
|
Assert.assertEquals(StringComparators.NUMERIC
|
||||||
|
, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue