mirror of https://github.com/apache/druid.git
Merge pull request #1079 from druid-io/cleanup-deps
Remove non friendly dependencies from Druid
This commit is contained in:
commit
4eff269536
|
@ -16,7 +16,8 @@
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.druid</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>druid-common</artifactId>
|
<artifactId>druid-common</artifactId>
|
||||||
|
@ -60,6 +61,10 @@
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-validator</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.el</groupId>
|
||||||
|
<artifactId>javax.el-api</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
|
|
24
pom.xml
24
pom.xml
|
@ -16,7 +16,8 @@
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.druid</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid</artifactId>
|
||||||
|
@ -101,12 +102,6 @@
|
||||||
<artifactId>server-metrics</artifactId>
|
<artifactId>server-metrics</artifactId>
|
||||||
<version>0.0.9</version>
|
<version>0.0.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.davekoelle</groupId>
|
|
||||||
<artifactId>alphanum</artifactId>
|
|
||||||
<version>1.0.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
|
@ -264,7 +259,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-validator</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
<version>5.0.1.Final</version>
|
<version>5.1.3.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
|
@ -276,6 +271,11 @@
|
||||||
<artifactId>javax.inject</artifactId>
|
<artifactId>javax.inject</artifactId>
|
||||||
<version>1</version>
|
<version>1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.el</groupId>
|
||||||
|
<artifactId>javax.el-api</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish</groupId>
|
<groupId>org.glassfish</groupId>
|
||||||
<artifactId>javax.el</artifactId>
|
<artifactId>javax.el</artifactId>
|
||||||
|
@ -481,10 +481,10 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.carrotsearch</groupId>
|
<groupId>com.carrotsearch</groupId>
|
||||||
<artifactId>junit-benchmarks</artifactId>
|
<artifactId>junit-benchmarks</artifactId>
|
||||||
<version>0.7.2</version>
|
<version>0.7.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.caliper</groupId>
|
<groupId>com.google.caliper</groupId>
|
||||||
|
|
|
@ -16,126 +16,123 @@
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<groupId>io.druid</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>druid-processing</artifactId>
|
|
||||||
<name>druid-processing</name>
|
|
||||||
<description>A module that is everything required to understands Druid Segments</description>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>io.druid</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid-processing</artifactId>
|
||||||
<version>0.7.0-SNAPSHOT</version>
|
<name>druid-processing</name>
|
||||||
</parent>
|
<description>A module that is everything required to understands Druid Segments</description>
|
||||||
|
|
||||||
<dependencies>
|
<parent>
|
||||||
<dependency>
|
<groupId>io.druid</groupId>
|
||||||
<groupId>io.druid</groupId>
|
<artifactId>druid</artifactId>
|
||||||
<artifactId>druid-common</artifactId>
|
<version>0.7.0-SNAPSHOT</version>
|
||||||
<version>${project.parent.version}</version>
|
</parent>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.metamx</groupId>
|
|
||||||
<artifactId>bytebuffer-collections</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.metamx</groupId>
|
|
||||||
<artifactId>emitter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ning</groupId>
|
|
||||||
<artifactId>compress-lzf</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.skife.config</groupId>
|
|
||||||
<artifactId>config-magic</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.protobuf</groupId>
|
|
||||||
<artifactId>protobuf-java</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ibm.icu</groupId>
|
|
||||||
<artifactId>icu4j</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mozilla</groupId>
|
|
||||||
<artifactId>rhino</artifactId>
|
|
||||||
<version>1.7R4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.davekoelle</groupId>
|
|
||||||
<artifactId>alphanum</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.jpountz.lz4</groupId>
|
|
||||||
<artifactId>lz4</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mapdb</groupId>
|
|
||||||
<artifactId>mapdb</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Tests -->
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>druid-common</artifactId>
|
||||||
<scope>test</scope>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.carrotsearch</groupId>
|
<groupId>com.metamx</groupId>
|
||||||
<artifactId>junit-benchmarks</artifactId>
|
<artifactId>bytebuffer-collections</artifactId>
|
||||||
<scope>test</scope>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
<dependency>
|
<groupId>com.metamx</groupId>
|
||||||
<groupId>org.easymock</groupId>
|
<artifactId>emitter</artifactId>
|
||||||
<artifactId>easymock</artifactId>
|
</dependency>
|
||||||
<scope>test</scope>
|
<dependency>
|
||||||
</dependency>
|
<groupId>com.ning</groupId>
|
||||||
<dependency>
|
<artifactId>compress-lzf</artifactId>
|
||||||
<groupId>com.google.caliper</groupId>
|
</dependency>
|
||||||
<artifactId>caliper</artifactId>
|
<dependency>
|
||||||
<scope>test</scope>
|
<groupId>org.skife.config</groupId>
|
||||||
</dependency>
|
<artifactId>config-magic</artifactId>
|
||||||
</dependencies>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.protobuf</groupId>
|
||||||
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ibm.icu</groupId>
|
||||||
|
<artifactId>icu4j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mozilla</groupId>
|
||||||
|
<artifactId>rhino</artifactId>
|
||||||
|
<version>1.7R4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.jpountz.lz4</groupId>
|
||||||
|
<artifactId>lz4</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapdb</groupId>
|
||||||
|
<artifactId>mapdb</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<build>
|
<!-- Tests -->
|
||||||
<plugins>
|
<dependency>
|
||||||
<plugin>
|
<groupId>junit</groupId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<artifactId>junit</artifactId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<scope>test</scope>
|
||||||
<executions>
|
</dependency>
|
||||||
<execution>
|
<dependency>
|
||||||
<id>attach-sources</id>
|
<groupId>com.carrotsearch</groupId>
|
||||||
<goals>
|
<artifactId>junit-benchmarks</artifactId>
|
||||||
<goal>jar</goal>
|
<scope>test</scope>
|
||||||
</goals>
|
</dependency>
|
||||||
</execution>
|
<dependency>
|
||||||
</executions>
|
<groupId>org.easymock</groupId>
|
||||||
</plugin>
|
<artifactId>easymock</artifactId>
|
||||||
<plugin>
|
<scope>test</scope>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
</dependency>
|
||||||
<executions>
|
<dependency>
|
||||||
<execution>
|
<groupId>com.google.caliper</groupId>
|
||||||
<goals>
|
<artifactId>caliper</artifactId>
|
||||||
<goal>test-jar</goal>
|
<scope>test</scope>
|
||||||
</goals>
|
</dependency>
|
||||||
</execution>
|
</dependencies>
|
||||||
</executions>
|
|
||||||
<configuration>
|
<build>
|
||||||
<archive>
|
<plugins>
|
||||||
<manifest>
|
<plugin>
|
||||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
</manifest>
|
<executions>
|
||||||
</archive>
|
<execution>
|
||||||
</configuration>
|
<id>attach-sources</id>
|
||||||
</plugin>
|
<goals>
|
||||||
</plugins>
|
<goal>jar</goal>
|
||||||
</build>
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||||
|
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package io.druid.query.topn;
|
package io.druid.query.topn;
|
||||||
|
|
||||||
import com.davekoelle.alphanum.AlphanumComparator;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.metamx.common.StringUtils;
|
import com.metamx.common.StringUtils;
|
||||||
|
@ -32,6 +31,154 @@ public class AlphaNumericTopNMetricSpec extends LexicographicTopNMetricSpec
|
||||||
{
|
{
|
||||||
private static final byte CACHE_TYPE_ID = 0x2;
|
private static final byte CACHE_TYPE_ID = 0x2;
|
||||||
|
|
||||||
|
protected static Comparator<String> comparator = new Comparator<String>()
|
||||||
|
{
|
||||||
|
// This code is based on the Apache 2.0 licensed java-alphanum library (https://github.com/amjjd/java-alphanum)
|
||||||
|
public int compare(String str1, String str2)
|
||||||
|
{
|
||||||
|
int[] pos = {0, 0};
|
||||||
|
|
||||||
|
if (str1.length() == 0) {
|
||||||
|
return str2.length() == 0 ? 0 : -1;
|
||||||
|
} else if (str2.length() == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (pos[0] < str1.length() && pos[1] < str2.length()) {
|
||||||
|
int ch1 = str1.codePointAt(pos[0]);
|
||||||
|
int ch2 = str2.codePointAt(pos[1]);
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
if (isDigit(ch1)) {
|
||||||
|
result = isDigit(ch2) ? compareNumbers(str1, str2, pos) : -1;
|
||||||
|
} else {
|
||||||
|
result = isDigit(ch2) ? 1 : compareNonNumeric(str1, str2, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str1.length() - str2.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int compareNumbers(String str0, String str1, int[] pos)
|
||||||
|
{
|
||||||
|
int delta = 0;
|
||||||
|
int zeroes0 = 0, zeroes1 = 0;
|
||||||
|
int ch0 = -1, ch1 = -1;
|
||||||
|
|
||||||
|
// Skip leading zeroes, but keep a count of them.
|
||||||
|
while (pos[0] < str0.length() && isZero(ch0 = str0.codePointAt(pos[0]))) {
|
||||||
|
zeroes0++;
|
||||||
|
pos[0] += Character.charCount(ch0);
|
||||||
|
}
|
||||||
|
while (pos[1] < str1.length() && isZero(ch1 = str1.codePointAt(pos[1]))) {
|
||||||
|
zeroes1++;
|
||||||
|
pos[1] += Character.charCount(ch1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If one sequence contains more significant digits than the
|
||||||
|
// other, it's a larger number. In case they turn out to have
|
||||||
|
// equal lengths, we compare digits at each position; the first
|
||||||
|
// unequal pair determines which is the bigger number.
|
||||||
|
while (true) {
|
||||||
|
boolean noMoreDigits0 = (ch0 < 0) || !isDigit(ch0);
|
||||||
|
boolean noMoreDigits1 = (ch1 < 0) || !isDigit(ch1);
|
||||||
|
|
||||||
|
if (noMoreDigits0 && noMoreDigits1) {
|
||||||
|
return delta != 0 ? delta : zeroes0 - zeroes1;
|
||||||
|
} else if (noMoreDigits0) {
|
||||||
|
return -1;
|
||||||
|
} else if (noMoreDigits1) {
|
||||||
|
return 1;
|
||||||
|
} else if (delta == 0 && ch0 != ch1) {
|
||||||
|
delta = valueOf(ch0) - valueOf(ch1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos[0] < str0.length()) {
|
||||||
|
ch0 = str0.codePointAt(pos[0]);
|
||||||
|
if (isDigit(ch0)) {
|
||||||
|
pos[0] += Character.charCount(ch0);
|
||||||
|
} else {
|
||||||
|
ch0 = -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ch0 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos[1] < str1.length()) {
|
||||||
|
ch1 = str1.codePointAt(pos[1]);
|
||||||
|
if (isDigit(ch1)) {
|
||||||
|
pos[1] += Character.charCount(ch1);
|
||||||
|
} else {
|
||||||
|
ch1 = -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ch1 = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDigit(int ch)
|
||||||
|
{
|
||||||
|
return (ch >= '0' && ch <= '9') ||
|
||||||
|
(ch >= '\u0660' && ch <= '\u0669') ||
|
||||||
|
(ch >= '\u06F0' && ch <= '\u06F9') ||
|
||||||
|
(ch >= '\u0966' && ch <= '\u096F') ||
|
||||||
|
(ch >= '\uFF10' && ch <= '\uFF19');
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isZero(int ch)
|
||||||
|
{
|
||||||
|
return ch == '0' || ch == '\u0660' || ch == '\u06F0' || ch == '\u0966' || ch == '\uFF10';
|
||||||
|
}
|
||||||
|
|
||||||
|
private int valueOf(int digit)
|
||||||
|
{
|
||||||
|
if (digit <= '9') {
|
||||||
|
return digit - '0';
|
||||||
|
}
|
||||||
|
if (digit <= '\u0669') {
|
||||||
|
return digit - '\u0660';
|
||||||
|
}
|
||||||
|
if (digit <= '\u06F9') {
|
||||||
|
return digit - '\u06F0';
|
||||||
|
}
|
||||||
|
if (digit <= '\u096F') {
|
||||||
|
return digit - '\u0966';
|
||||||
|
}
|
||||||
|
if (digit <= '\uFF19') {
|
||||||
|
return digit - '\uFF10';
|
||||||
|
}
|
||||||
|
|
||||||
|
return digit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int compareNonNumeric(String str0, String str1, int[] pos)
|
||||||
|
{
|
||||||
|
// find the end of both non-numeric substrings
|
||||||
|
int start0 = pos[0];
|
||||||
|
int ch0 = str0.codePointAt(pos[0]);
|
||||||
|
pos[0] += Character.charCount(ch0);
|
||||||
|
while (pos[0] < str0.length() && !isDigit(ch0 = str0.codePointAt(pos[0]))) {
|
||||||
|
pos[0] += Character.charCount(ch0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int start1 = pos[1];
|
||||||
|
int ch1 = str1.codePointAt(pos[1]);
|
||||||
|
pos[1] += Character.charCount(ch1);
|
||||||
|
while (pos[1] < str1.length() && !isDigit(ch1 = str1.codePointAt(pos[1]))) {
|
||||||
|
pos[1] += Character.charCount(ch1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// compare the substrings
|
||||||
|
return String.CASE_INSENSITIVE_ORDER.compare(str0.substring(start0, pos[0]), str1.substring(start1, pos[1]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private final String previousStop;
|
private final String previousStop;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
|
@ -46,7 +193,7 @@ public class AlphaNumericTopNMetricSpec extends LexicographicTopNMetricSpec
|
||||||
@Override
|
@Override
|
||||||
public Comparator getComparator(List<AggregatorFactory> aggregatorSpecs, List<PostAggregator> postAggregatorSpecs)
|
public Comparator getComparator(List<AggregatorFactory> aggregatorSpecs, List<PostAggregator> postAggregatorSpecs)
|
||||||
{
|
{
|
||||||
return new AlphanumComparator();
|
return comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Druid - a distributed column store.
|
||||||
|
* Copyright 2012 - 2015 Metamarkets Group Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.druid.query.topn;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class AlphaNumericTopNMetricSpecTest
|
||||||
|
{
|
||||||
|
// Test derived from sample code listed on Apache 2.0 licensed https://github.com/amjjd/java-alphanum
|
||||||
|
@Test
|
||||||
|
public void testComparator() throws Exception
|
||||||
|
{
|
||||||
|
final Comparator<String> comparator = AlphaNumericTopNMetricSpec.comparator;
|
||||||
|
|
||||||
|
// equality
|
||||||
|
assertEquals(0, comparator.compare("", ""));
|
||||||
|
assertEquals(0, comparator.compare("abc", "abc"));
|
||||||
|
assertEquals(0, comparator.compare("123", "123"));
|
||||||
|
assertEquals(0, comparator.compare("abc123", "abc123"));
|
||||||
|
|
||||||
|
// empty strings < non-empty
|
||||||
|
assertTrue(comparator.compare("", "abc") < 0);
|
||||||
|
assertTrue(comparator.compare("abc", "") > 0);
|
||||||
|
|
||||||
|
// numbers < non numeric
|
||||||
|
assertTrue(comparator.compare("123", "abc") < 0);
|
||||||
|
assertTrue(comparator.compare("abc", "123") > 0);
|
||||||
|
|
||||||
|
// numbers ordered numerically
|
||||||
|
assertTrue(comparator.compare("2", "11") < 0);
|
||||||
|
assertTrue(comparator.compare("a2", "a11") < 0);
|
||||||
|
|
||||||
|
// leading zeroes
|
||||||
|
assertTrue(comparator.compare("02", "11") < 0);
|
||||||
|
assertTrue(comparator.compare("02", "002") < 0);
|
||||||
|
|
||||||
|
// decimal points ...
|
||||||
|
assertTrue(comparator.compare("1.3", "1.5") < 0);
|
||||||
|
|
||||||
|
// ... don't work too well
|
||||||
|
assertTrue(comparator.compare("1.3", "1.15") < 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,8 @@
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.druid</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>druid-server</artifactId>
|
<artifactId>druid-server</artifactId>
|
||||||
|
|
243
services/pom.xml
243
services/pom.xml
|
@ -15,121 +15,136 @@
|
||||||
~ See the License for the specific language governing permissions and
|
~ See the License for the specific language governing permissions and
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<groupId>io.druid</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>druid-services</artifactId>
|
|
||||||
<name>druid-services</name>
|
|
||||||
<description>druid-services</description>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>io.druid</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid-services</artifactId>
|
||||||
<version>0.7.0-SNAPSHOT</version>
|
<name>druid-services</name>
|
||||||
</parent>
|
<description>druid-services</description>
|
||||||
|
|
||||||
<dependencies>
|
<parent>
|
||||||
<!-- include druid-common to prevent older versions of dependencies
|
<groupId>io.druid</groupId>
|
||||||
from being pulled in by airline and dependencies of druid-server -->
|
<artifactId>druid</artifactId>
|
||||||
<dependency>
|
<version>0.7.0-SNAPSHOT</version>
|
||||||
<groupId>io.druid</groupId>
|
</parent>
|
||||||
<artifactId>druid-common</artifactId>
|
|
||||||
<version>${project.parent.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.druid</groupId>
|
|
||||||
<artifactId>druid-server</artifactId>
|
|
||||||
<version>${project.parent.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.druid</groupId>
|
|
||||||
<artifactId>druid-indexing-hadoop</artifactId>
|
|
||||||
<version>${project.parent.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.druid</groupId>
|
|
||||||
<artifactId>druid-indexing-service</artifactId>
|
|
||||||
<version>${project.parent.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.airlift</groupId>
|
|
||||||
<artifactId>airline</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<dependencies>
|
||||||
<plugins>
|
<!-- include druid-common to prevent older versions of dependencies
|
||||||
<plugin>
|
from being pulled in by airline and dependencies of druid-server -->
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<dependency>
|
||||||
<configuration>
|
<groupId>io.druid</groupId>
|
||||||
<archive>
|
<artifactId>druid-common</artifactId>
|
||||||
<manifest>
|
<version>${project.parent.version}</version>
|
||||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
</dependency>
|
||||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
<dependency>
|
||||||
</manifest>
|
<groupId>io.druid</groupId>
|
||||||
</archive>
|
<artifactId>druid-server</artifactId>
|
||||||
</configuration>
|
<version>${project.parent.version}</version>
|
||||||
</plugin>
|
</dependency>
|
||||||
<plugin>
|
<dependency>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>io.druid</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>druid-indexing-hadoop</artifactId>
|
||||||
<version>2.2</version>
|
<version>${project.parent.version}</version>
|
||||||
<executions>
|
</dependency>
|
||||||
<execution>
|
<dependency>
|
||||||
<phase>package</phase>
|
<groupId>io.druid</groupId>
|
||||||
<goals>
|
<artifactId>druid-indexing-service</artifactId>
|
||||||
<goal>shade</goal>
|
<version>${project.parent.version}</version>
|
||||||
</goals>
|
</dependency>
|
||||||
<configuration>
|
<dependency>
|
||||||
<outputFile>
|
<groupId>io.airlift</groupId>
|
||||||
${project.build.directory}/${project.artifactId}-${project.version}-selfcontained.jar
|
<artifactId>airline</artifactId>
|
||||||
</outputFile>
|
</dependency>
|
||||||
<filters>
|
</dependencies>
|
||||||
<filter>
|
|
||||||
<artifact>*:*</artifact>
|
<build>
|
||||||
<excludes>
|
<plugins>
|
||||||
<exclude>META-INF/*.SF</exclude>
|
<plugin>
|
||||||
<exclude>META-INF/*.DSA</exclude>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<exclude>META-INF/*.RSA</exclude>
|
<configuration>
|
||||||
</excludes>
|
<archive>
|
||||||
</filter>
|
<manifest>
|
||||||
</filters>
|
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||||
<transformers>
|
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
|
</manifest>
|
||||||
</transformers>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</plugin>
|
||||||
</executions>
|
<plugin>
|
||||||
</plugin>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<plugin>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<version>2.2</version>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<executions>
|
||||||
<executions>
|
<execution>
|
||||||
<execution>
|
<phase>package</phase>
|
||||||
<id>attach-sources</id>
|
<goals>
|
||||||
<goals>
|
<goal>shade</goal>
|
||||||
<goal>jar</goal>
|
</goals>
|
||||||
</goals>
|
<configuration>
|
||||||
</execution>
|
<outputFile>
|
||||||
</executions>
|
${project.build.directory}/${project.artifactId}-${project.version}-selfcontained.jar
|
||||||
</plugin>
|
</outputFile>
|
||||||
<plugin>
|
<filters>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<filter>
|
||||||
<executions>
|
<artifact>*:*</artifact>
|
||||||
<execution>
|
<excludes>
|
||||||
<id>distro-assembly</id>
|
<exclude>META-INF/*.SF</exclude>
|
||||||
<phase>package</phase>
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
<goals>
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
<goal>assembly</goal>
|
</excludes>
|
||||||
</goals>
|
</filter>
|
||||||
<configuration>
|
</filters>
|
||||||
<descriptors>
|
<transformers>
|
||||||
<descriptor>src/assembly/assembly.xml</descriptor>
|
<transformer
|
||||||
</descriptors>
|
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||||
</configuration>
|
</transformers>
|
||||||
</execution>
|
</configuration>
|
||||||
</executions>
|
</execution>
|
||||||
</plugin>
|
</executions>
|
||||||
</plugins>
|
</plugin>
|
||||||
</build>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>distro-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>assembly</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>download-licenses</id>
|
||||||
|
<goals>
|
||||||
|
<goal>download-licenses</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue