ilooner closed pull request #1403: DRILL-6634: Add udf module under contrib directory and move some udfs into it URL: https://github.com/apache/drill/pull/1403
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/contrib/gis/pom.xml b/contrib/gis/pom.xml deleted file mode 100644 index 8a37b6c0f8d..00000000000 --- a/contrib/gis/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ -<?xml version="1.0"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you 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. - ---> -<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"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>drill-contrib-parent</artifactId> - <groupId>org.apache.drill.contrib</groupId> - <version>1.15.0-SNAPSHOT</version> - </parent> - - <artifactId>drill-gis</artifactId> - - <name>contrib/drill-gis-plugin</name> - - <properties> - <gis.TestSuite>**/GISTestSuite.class</gis.TestSuite> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.drill.exec</groupId> - <artifactId>drill-java-exec</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.esri.geometry</groupId> - <artifactId>esri-geometry-api</artifactId> - <version>2.0.0</version> - </dependency> - <dependency> - <groupId>org.osgeo</groupId> - <artifactId>proj4j</artifactId> - <version>0.1.0</version> - </dependency> - <!-- Test dependencies --> - <dependency> - <groupId>org.apache.drill.exec</groupId> - <artifactId>drill-java-exec</artifactId> - <classifier>tests</classifier> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.drill</groupId> - <artifactId>drill-common</artifactId> - <classifier>tests</classifier> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <includes> - <include>${gis.TestSuite}</include> - </includes> - <systemProperties> - <property> - <name>logback.log.dir</name> - <value>${project.build.directory}/surefire-reports</value> - </property> - </systemProperties> - </configuration> - </plugin> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <executions> - <execution> - <id>copy-java-sources</id> - <phase>process-sources</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/target/classes/org/apache/drill/exec/expr/fn/impl</outputDirectory> - <resources> - <resource> - <directory>src/main/java/org/apache/drill/exec/expr/fn/impl</directory> - <filtering>true</filtering> - </resource> - <resource> - <directory>src/test/java</directory> - <filtering>true</filtering> - </resource> - <resource> - <directory>target/generated-sources</directory> - <!-- <include>*/org</include> --> - <filtering>true</filtering> - </resource> - </resources> - </configuration> - </execution> - <execution> - <id>copy-gis-sample-data</id> - <phase>process-sources</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/classes/sample-data</outputDirectory> - <resources> - <resource> - <directory>sample-data</directory> - <filtering>false</filtering> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/contrib/gis/src/main/resources/drill-module.conf b/contrib/gis/src/main/resources/drill-module.conf deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/GISTestSuite.java b/contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/GISTestSuite.java deleted file mode 100644 index 07521c3520b..00000000000 --- a/contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/GISTestSuite.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.drill.exec.expr.fn.impl.gis; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@RunWith(Suite.class) -@SuiteClasses({ TestGeometryFunctions.class }) -public class GISTestSuite { - private static final Logger logger = LoggerFactory.getLogger(GISTestSuite.class); -} diff --git a/contrib/pom.xml b/contrib/pom.xml index 8b576646d06..a96aa4207b1 100644 --- a/contrib/pom.xml +++ b/contrib/pom.xml @@ -45,7 +45,7 @@ <module>storage-opentsdb</module> <module>sqlline</module> <module>data</module> - <module>gis</module> + <module>udfs</module> </modules> <profiles> diff --git a/contrib/udfs/pom.xml b/contrib/udfs/pom.xml new file mode 100644 index 00000000000..44987fc26d1 --- /dev/null +++ b/contrib/udfs/pom.xml @@ -0,0 +1,136 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. + +--> +<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"> + <modelVersion>4.0.0</modelVersion> + +<parent> + <artifactId>drill-contrib-parent</artifactId> + <groupId>org.apache.drill.contrib</groupId> + <version>1.15.0-SNAPSHOT</version> + </parent> + + <artifactId>drill-udfs</artifactId> + <name>contrib/drill-udfs</name> + + <dependencies> + <dependency> + <groupId>org.apache.drill.exec</groupId> + <artifactId>drill-java-exec</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>commons-net</groupId> + <artifactId>commons-net</artifactId> + <version>3.6</version> + </dependency> + + <dependency> + <groupId>commons-validator</groupId> + <artifactId>commons-validator</artifactId> + <version>1.6</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-text</artifactId> + <version>1.4</version> + </dependency> + + <dependency> + <groupId>com.esri.geometry</groupId> + <artifactId>esri-geometry-api</artifactId> + <version>2.2.0</version> + </dependency> + + <dependency> + <groupId>org.osgeo</groupId> + <artifactId>proj4j</artifactId> + <version>0.1.0</version> + </dependency> + + <!-- Test dependencies --> + <dependency> + <groupId>org.apache.drill.exec</groupId> + <artifactId>drill-java-exec</artifactId> + <classifier>tests</classifier> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.drill</groupId> + <artifactId>drill-common</artifactId> + <classifier>tests</classifier> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-java-sources</id> + <phase>process-sources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/target/classes/org/apache/drill/exec/udfs</outputDirectory> + <resources> + <resource> + <directory>src/main/java/org/apache/drill/exec/udfs</directory> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + <execution> + <id>copy-udf-sample-data</id> + <phase>process-sources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/classes/sample-data</outputDirectory> + <resources> + <resource> + <directory>sample-data</directory> + <filtering>false</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/contrib/gis/sample-data/CA-cities-with-nulls.csv b/contrib/udfs/sample-data/CA-cities-with-nulls.csv similarity index 100% rename from contrib/gis/sample-data/CA-cities-with-nulls.csv rename to contrib/udfs/sample-data/CA-cities-with-nulls.csv diff --git a/contrib/gis/sample-data/CA-cities.csv b/contrib/udfs/sample-data/CA-cities.csv similarity index 100% rename from contrib/gis/sample-data/CA-cities.csv rename to contrib/udfs/sample-data/CA-cities.csv diff --git a/contrib/gis/sample-data/polygons.tsv b/contrib/udfs/sample-data/polygons.tsv similarity index 100% rename from contrib/gis/sample-data/polygons.tsv rename to contrib/udfs/sample-data/polygons.tsv diff --git a/contrib/gis/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java b/contrib/udfs/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java similarity index 100% rename from contrib/gis/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java rename to contrib/udfs/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CryptoFunctions.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/CryptoFunctions.java similarity index 98% rename from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CryptoFunctions.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/CryptoFunctions.java index 68c47532a1e..bc6f23c9bf4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CryptoFunctions.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/CryptoFunctions.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl; +package org.apache.drill.exec.udfs; import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; @@ -29,16 +29,11 @@ import javax.inject.Inject; public class CryptoFunctions { - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CryptoFunctions.class); - - private CryptoFunctions() { - } /** * This class returns the md2 digest of a given input string. * Usage is SELECT md2( <input string> ) FROM ... */ - @FunctionTemplate(name = "md2", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class MD2Function implements DrillSimpleFunc { @@ -74,7 +69,6 @@ public void eval() { * Usage is shown below: * select md5( 'testing' ) from (VALUES(1)); */ - @FunctionTemplate(name = "md5", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class MD5Function implements DrillSimpleFunc { @@ -112,7 +106,6 @@ public void eval() { * * > select sha1( 'testing' ) from (VALUES(1)); */ - @FunctionTemplate(names = {"sha", "sha1"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class SHA1Function implements DrillSimpleFunc { @@ -150,7 +143,6 @@ public void eval() { * or NULL if the argument was NULL. Note that sha2() and sha256() are aliases for the same function. * > select sha2( 'testing' ) from (VALUES(1)); */ - @FunctionTemplate(names = {"sha256", "sha2"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class SHA256Function implements DrillSimpleFunc { @@ -189,7 +181,6 @@ public void eval() { * Usage is shown below: * select sha384( 'testing' ) from (VALUES(1)); */ - @FunctionTemplate(name = "sha384", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class SHA384Function implements DrillSimpleFunc { @@ -227,8 +218,6 @@ public void eval() { * Usage is shown below: * select sha512( 'testing' ) from (VALUES(1)); */ - - @FunctionTemplate(name = "sha512", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class SHA512Function implements DrillSimpleFunc { @@ -267,8 +256,6 @@ public void eval() { * binary string containing the encrypted output. * Usage: SELECT aes_encrypt( 'encrypted_text', 'my_secret_key' ) AS aes FROM (VALUES(1)); */ - - @FunctionTemplate(name = "aes_encrypt", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class AESEncryptFunction implements DrillSimpleFunc { @@ -329,7 +316,6 @@ public void eval() { * If either function argument is NULL, the function returns NULL. * Usage: SELECT aes_decrypt( <encrypted_text>, <key> ) FROM ... */ - @FunctionTemplate(name = "aes_decrypt", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class AESDecryptFunction implements DrillSimpleFunc { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/NetworkFunctions.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/NetworkFunctions.java similarity index 96% rename from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/NetworkFunctions.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/NetworkFunctions.java index 448e8b6ae5d..cf20527b876 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/NetworkFunctions.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/NetworkFunctions.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl; +package org.apache.drill.exec.udfs; import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; @@ -29,10 +29,6 @@ import javax.inject.Inject; public class NetworkFunctions { - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NetworkFunctions.class); - - private NetworkFunctions() { - } /** * This function takes two arguments, an input IPv4 and a CIDR, and returns true if the IP is in the given CIDR block @@ -49,9 +45,6 @@ private NetworkFunctions() { @Output BitHolder out; - @Inject - DrillBuf buffer; - public void setup() { } @@ -85,9 +78,6 @@ public void eval() { @Output BigIntHolder out; - @Inject - DrillBuf buffer; - public void setup() { } @@ -96,8 +86,7 @@ public void eval() { String cidrString = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(inputCIDR.start, inputCIDR.end, inputCIDR.buffer); org.apache.commons.net.util.SubnetUtils utils = new org.apache.commons.net.util.SubnetUtils(cidrString); - out.value = utils.getInfo().getAddressCount(); - + out.value = utils.getInfo().getAddressCountLong(); } } @@ -131,7 +120,6 @@ public void eval() { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -139,7 +127,6 @@ public void eval() { /** * This function gets the netmask of the input CIDR block. */ - @FunctionTemplate(name = "netmask", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class NetmaskFunction implements DrillSimpleFunc { @@ -166,7 +153,6 @@ public void eval() { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -200,7 +186,6 @@ public void eval() { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -234,7 +219,6 @@ public void eval() { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -264,13 +248,12 @@ public void eval() { try { outputValue = java.net.URLEncoder.encode(url, "UTF-8"); } catch (Exception e) { - + // do nothing } outputString.buffer = buffer; outputString.start = 0; outputString.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -300,13 +283,12 @@ public void eval() { try { outputValue = java.net.URLDecoder.decode(url, "UTF-8"); } catch (Exception e) { - + // do nothing } outputString.buffer = buffer; outputString.start = 0; outputString.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -314,7 +296,6 @@ public void eval() { /** * This function converts a BigInt IPv4 into dotted decimal notation. The opposite of inet_aton. */ - @FunctionTemplate(name = "inet_ntoa", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class InetNtoaFunction implements DrillSimpleFunc { @@ -355,14 +336,11 @@ public void eval() { out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); } - - } /** * This function returns true if a given IPv4 address is private, false if not. */ - @FunctionTemplate(name = "is_private_ip", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class IsPrivateIP implements DrillSimpleFunc { @@ -372,10 +350,6 @@ public void eval() { @Output BitHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } @@ -385,22 +359,19 @@ public void eval() { String[] ipAddressInArray = ipString.split("\\."); - int result = 0; - int[] octets = new int[3]; for (int i = 0; i < 3; i++) { octets[i] = Integer.parseInt(ipAddressInArray[i]); } + int result = 0; if (octets[0] == 192 && octets[1] == 168) { result = 1; } else if (octets[0] == 172 && octets[1] >= 16 && octets[1] <= 31) { result = 1; } else if (octets[0] == 10) { result = 1; - } else { - result = 0; } out.value = result; @@ -423,10 +394,6 @@ public void eval() { @Output BigIntHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } @@ -462,10 +429,6 @@ public void eval() { @Output BitHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } @@ -484,7 +447,6 @@ public void eval() { out.value = 0; } } - } } @@ -500,9 +462,6 @@ public void eval() { @Output BitHolder out; - @Inject - DrillBuf buffer; - public void setup() { } @@ -536,10 +495,6 @@ public void eval() { @Output BitHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/PhoneticFunctions.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/PhoneticFunctions.java similarity index 98% rename from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/PhoneticFunctions.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/PhoneticFunctions.java index ee26bd3ec88..55e465a51bb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/PhoneticFunctions.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/PhoneticFunctions.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl; +package org.apache.drill.exec.udfs; import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; @@ -27,10 +27,6 @@ import javax.inject.Inject; public class PhoneticFunctions { - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PhoneticFunctions.class); - - private PhoneticFunctions() { - } /** * The Caverphone function is a phonetic matching function. This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 1.0 algorithm. @@ -38,7 +34,6 @@ private PhoneticFunctions() { * <p> * Usage: SELECT caverphone1( string ) FROM... */ - @FunctionTemplate(name = "caverphone1", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class Caverphone1Function implements DrillSimpleFunc { @@ -74,7 +69,6 @@ public void eval() { * <p> * Usage: SELECT caverphone2( string ) FROM... */ - @FunctionTemplate(name = "caverphone2", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class Caverphone2Function implements DrillSimpleFunc { @@ -114,7 +108,6 @@ public void eval() { * <p> * Usage: SELECT cologne_phonetic( string ) FROM... */ - @FunctionTemplate(name = "cologne_phonetic", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class ColognePhoneticFunction implements DrillSimpleFunc { @@ -159,7 +152,6 @@ public void eval() { * <p> * Usage: SELECT dm_soundex( string ) FROM... */ - @FunctionTemplate(name = "dm_soundex", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class DaitchMokotoffFunction implements DrillSimpleFunc { @@ -194,7 +186,6 @@ public void eval() { * Match Rating Approach Phonetic Algorithm Developed by Western Airlines in 1977. * Usage: SELECT match_rating_encoder( string ) FROM... */ - @FunctionTemplate(name = "match_rating_encoder", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class MatchRatingFunction implements DrillSimpleFunc { @@ -231,7 +222,6 @@ public void eval() { * <p> * Usage: SELECT nysiis(string) FROM... */ - @FunctionTemplate(name = "nysiis", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class NYSIISFunction implements DrillSimpleFunc { @@ -266,7 +256,6 @@ public void eval() { * <p> * Usage: SELECT refined_soundex( string ) FROM... */ - @FunctionTemplate(name = "refined_soundex", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class RefinedSoundexFunction implements DrillSimpleFunc { @@ -302,7 +291,6 @@ public void eval() { * <p> * Usage: SELECT soundex( string ) FROM... */ - @FunctionTemplate(name = "soundex", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class SoundexFunction implements DrillSimpleFunc { @@ -338,7 +326,6 @@ public void eval() { * <p> * Usage: SELECT metaphone( string ) FROM... */ - @FunctionTemplate(name = "metaphone", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class MetaphoneFunction implements DrillSimpleFunc { @@ -375,7 +362,6 @@ public void eval() { * <p> * Usage: SELECT double_metaphone( string ) FROM... */ - @FunctionTemplate(name = "double_metaphone", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class DoubleMetaphoneFunction implements DrillSimpleFunc { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringDistanceFunctions.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/StringDistanceFunctions.java similarity index 93% rename from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringDistanceFunctions.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/StringDistanceFunctions.java index 0b027694450..bf02758556c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringDistanceFunctions.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/StringDistanceFunctions.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl; +package org.apache.drill.exec.udfs; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; @@ -27,16 +27,11 @@ import org.apache.drill.exec.expr.holders.VarCharHolder; public class StringDistanceFunctions { - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StringDistanceFunctions.class); - - private StringDistanceFunctions() { - } /** * This function calculates the cosine distance between two strings. * Usage: SELECT cosine_distance( string1, string2 ) AS cosine_distance FROM... */ - @FunctionTemplate(name = "cosine_distance", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class CosineDistanceFunction implements DrillSimpleFunc { @@ -64,8 +59,7 @@ public void eval() { String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.apply(input1, input2); - out.value = result; + out.value = d.apply(input1, input2); } } @@ -80,7 +74,6 @@ public void eval() { * <p> * Usage: SELECT fuzzy_score( string1, string2 ) AS fuzzy_score FROM... */ - @FunctionTemplate(name = "fuzzy_score", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class FuzzyScoreFunction implements DrillSimpleFunc { @@ -107,8 +100,7 @@ public void eval() { String input1 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput1.start, rawInput1.end, rawInput1.buffer); String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.fuzzyScore(input1, input2); - out.value = result; + out.value = d.fuzzyScore(input1, input2); } } @@ -121,8 +113,6 @@ public void eval() { * <p> * Usage: SELECT hamming_distance( string1, string2 ) FROM... */ - - @FunctionTemplate(name = "hamming_distance", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class HammingDistanceFunction implements DrillSimpleFunc { @@ -149,8 +139,7 @@ public void eval() { String input1 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput1.start, rawInput1.end, rawInput1.buffer); String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.apply(input1, input2); - out.value = result; + out.value = d.apply(input1, input2); } } @@ -165,8 +154,6 @@ public void eval() { * <p> * Usage: SELECT jaccard_distance( string1, string2 ) FROM ... */ - - @FunctionTemplate(name = "jaccard_distance", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class JaccardDistanceFunction implements DrillSimpleFunc { @@ -193,8 +180,7 @@ public void eval() { String input1 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput1.start, rawInput1.end, rawInput1.buffer); String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.apply(input1, input2); - out.value = result; + out.value = d.apply(input1, input2); } } @@ -210,7 +196,6 @@ public void eval() { * <p> * Usage: SELECT jaro_distance( string1, string2 ) FROM... */ - @FunctionTemplate(name = "jaro_distance", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class JaroDistanceFunction implements DrillSimpleFunc { @@ -237,8 +222,7 @@ public void eval() { String input1 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput1.start, rawInput1.end, rawInput1.buffer); String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.apply(input1, input2); - out.value = result; + out.value = d.apply(input1, input2); } } @@ -251,7 +235,6 @@ public void eval() { * <p> * Usage: SELECT levenshtein_distance( string1, string2 ) FROM... */ - @FunctionTemplate(name = "levenshtein_distance", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class LevenstheinDistanceFunction implements DrillSimpleFunc { @@ -278,8 +261,7 @@ public void eval() { String input1 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput1.start, rawInput1.end, rawInput1.buffer); String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.apply(input1, input2); - out.value = result; + out.value = d.apply(input1, input2); } } @@ -294,7 +276,6 @@ public void eval() { * <p> * Usage: SELECT longest_common_substring_distance( string1, string2 ) FROM... */ - @FunctionTemplate(name = "longest_common_substring_distance", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) public static class LongestCommonSubstringDistanceFunction implements DrillSimpleFunc { @@ -321,8 +302,7 @@ public void eval() { String input1 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput1.start, rawInput1.end, rawInput1.buffer); String input2 = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput2.start, rawInput2.end, rawInput2.buffer); - double result = d.apply(input1, input2); - out.value = result; + out.value = d.apply(input1, input2); } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsGeoJSON.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsGeoJSON.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsGeoJSON.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsGeoJSON.java index 3f41504417b..4d014853f7e 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsGeoJSON.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsGeoJSON.java @@ -18,10 +18,9 @@ /* * Wrapper for ESRI ST_AsGeoJson function to convert geometry to valid geojson */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -29,7 +28,7 @@ import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_asgeojson", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsJson.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsJson.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsJson.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsJson.java index e1708339066..090c78b672f 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsJson.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsJson.java @@ -19,10 +19,9 @@ * Wrapper for ESRI ST_AsJson to convert geometry into REST Json. * Emulates functionality from spatial-framework-for-hadoop. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -30,7 +29,7 @@ import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_asjson", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsText.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsText.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsText.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsText.java index 17b78581c84..f770872a87b 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsText.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsText.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,7 +25,7 @@ import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_astext", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STBuffer.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STBuffer.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STBuffer.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STBuffer.java index a1d3af45f85..5ae0b4d3b88 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STBuffer.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STBuffer.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns a geometry that represents all points whose distance from this Geometry * is less than or equal to radius */ diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STContains.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STContains.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STContains.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STContains.java index 5204ce605cd..94f04648fd4 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STContains.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STContains.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** Returns true if and only if no points of B lie in the exterior of A, and at least one point of the interior of B lies in the interior of A. */ @@ -59,8 +58,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int contains = geom1.contains(geom2) ? 1 : 0; - - out.value = contains; + out.value = geom1.contains(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STCrosses.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STCrosses.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STCrosses.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STCrosses.java index 95d7aca8036..9bf678a6b15 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STCrosses.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STCrosses.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns TRUE if the supplied geometries have some, but not all, interior points in common */ @FunctionTemplate(name = "st_crosses", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -58,8 +57,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int crosses = geom1.crosses(geom2) ? 1 : 0; - - out.value = crosses; + out.value = geom1.crosses(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDWithin.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDWithin.java similarity index 93% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDWithin.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDWithin.java index 70f09470032..b2ed091b0a8 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDWithin.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDWithin.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -27,7 +26,7 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_dwithin", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) @@ -61,8 +60,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int isWithin = geom1.distance(geom2) <= distance ? 1 : 0; - - out.value = isWithin; + out.value = geom1.distance(geom2) <= distance ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDifference.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDifference.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDifference.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDifference.java index 4906880e95d..bb51f0eee69 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDifference.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDifference.java @@ -15,19 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Given geometries A and B, this function returns a geometry that represents * the part of geometry A that does not intersect with geometry B */ diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDisjoint.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDisjoint.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDisjoint.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDisjoint.java index 8a342414818..5976e17de2a 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDisjoint.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDisjoint.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns TRUE if two Geometries do not "spatially intersect" - if they do not share any space */ @FunctionTemplate(name = "st_disjoint", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -58,8 +57,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int isDisjoint = geom1.disjoint(geom2) ? 1 : 0; - - out.value = isDisjoint; + out.value = geom1.disjoint(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDistance.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDistance.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDistance.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDistance.java index 9415f3984ee..6235cd01592 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDistance.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDistance.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * For geometry type Returns the 2D Cartesian distance between two geometries in projected units (based on spatial ref). * For geography type defaults to return minimum geodesic distance between two geographies in meters */ diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEnvelope.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEnvelope.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEnvelope.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEnvelope.java index 82862242fdf..8e73bcd9038 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEnvelope.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEnvelope.java @@ -15,19 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns a geometry representing the double precision (float8) bounding box of the supplied geometry. * The polygon is defined by the corner points of the bounding box ((MINX, MINY), (MINX, MAXY), (MAXX, MAXY), (MAXX, MINY), (MINX, MINY)) */ diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEquals.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEquals.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEquals.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEquals.java index b5e22d623e6..81895a85577 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEquals.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEquals.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns true if the given geometries represent the same geometry. Directionality is ignored */ @FunctionTemplate(name = "st_equals", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -58,8 +57,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int equals = geom1.equals(geom2) ? 1 : 0; - - out.value = equals; + out.value = geom1.Equals(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromText.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromText.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromText.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromText.java index 042046eb53d..41044b50b54 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromText.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromText.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,7 +25,7 @@ import org.apache.drill.exec.expr.holders.NullableVarCharHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_geomfromtext", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromTextSrid.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromTextSrid.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromTextSrid.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromTextSrid.java index 9a7432e737b..2ff25733f6d 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromTextSrid.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromTextSrid.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -27,7 +26,7 @@ import org.apache.drill.exec.expr.holders.NullableVarCharHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_geomfromtext", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STIntersects.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STIntersects.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STIntersects.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STIntersects.java index 9e152c5c6ff..621581d0ac5 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STIntersects.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STIntersects.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns TRUE if the Geometries/Geography "spatially intersect in 2D" - (share any portion of space) and FALSE if they don't (they are Disjoint) */ @FunctionTemplate(name = "st_intersects", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -57,8 +56,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int intersects = geom1.intersects(geom2) ? 1 : 0; - - out.value = intersects; + out.value = geom1.intersects(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STOverlaps.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STOverlaps.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STOverlaps.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STOverlaps.java index 7ae770d67ee..5f9a162ad0b 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STOverlaps.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STOverlaps.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns TRUE if the Geometries share space, are of the same dimension, but are not completely contained by each other */ @FunctionTemplate(name = "st_overlaps", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -58,8 +57,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int overlaps = geom1.overlaps(geom2) ? 1 : 0; - - out.value = overlaps; + out.value = geom1.overlaps(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STPointFunc.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STPointFunc.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STPointFunc.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STPointFunc.java index 2024e3b2362..1b34f32b091 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STPointFunc.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STPointFunc.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,7 +25,7 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_point", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STRelate.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STRelate.java similarity index 95% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STRelate.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STRelate.java index 9a1c64b2271..fa81ee7d504 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STRelate.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STRelate.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -27,9 +26,9 @@ import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns true if this Geometry is spatially related to anotherGeometry, by testing for intersections between * the Interior, Boundary and Exterior of the two geometries as specified by the values in the intersectionMatrixPattern. * If no intersectionMatrixPattern is passed in, then returns the maximum intersectionMatrixPattern that relates the 2 geometries @@ -66,8 +65,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int relates = geom1.relate(geom2, matrix) ? 1 : 0; - - out.value = relates; + out.value = geom1.relate(geom2, matrix) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTouches.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTouches.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTouches.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTouches.java index 79ad0c73a29..0562aebbe26 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTouches.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTouches.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns TRUE if the geometries have at least one point in common, but their interiors do not intersect */ @FunctionTemplate(name = "st_touches", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -58,8 +57,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int touches = geom1.touches(geom2) ? 1 : 0; - - out.value = touches; + out.value = geom1.touches(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTransform.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTransform.java similarity index 92% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTransform.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTransform.java index c2788c18a52..1b5c8242c71 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTransform.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTransform.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,12 +25,11 @@ import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.NullableIntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import org.osgeo.proj4j.CRSFactory; import org.osgeo.proj4j.CoordinateTransform; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Return a new geometry with its coordinates transformed to a different spatial reference */ @FunctionTemplate(name = "st_transform", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -49,9 +47,6 @@ @Workspace CoordinateTransform transform; - @Workspace - CRSFactory crsFactory; - @Workspace int sridTgt; @@ -78,12 +73,11 @@ public void eval() { com.esri.core.geometry.ogc.OGCGeometry geomSrc = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); - //int code = Integer.parseInt(transform.getTargetCRS().getName().substring(5, 9));//now sridTgt org.osgeo.proj4j.ProjCoordinate result = new org.osgeo.proj4j.ProjCoordinate(); com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.create(sridTgt); - java.nio.ByteBuffer geomBytes = null; + java.nio.ByteBuffer geomBytes; - if (geomSrc != null && geomSrc.geometryType().equals("Point")) { + if (geomSrc.geometryType().equals("Point")) { com.esri.core.geometry.ogc.OGCPoint pointGeom = (com.esri.core.geometry.ogc.OGCPoint) geomSrc; result = transform.transform(new org.osgeo.proj4j.ProjCoordinate(pointGeom.X(), pointGeom.Y()), result); diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnion.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnion.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnion.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnion.java index 907c6dadc2e..24e934a1158 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnion.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnion.java @@ -15,19 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns a geometry that represents the point set union of the Geometries */ @FunctionTemplate(name = "st_union", scope = FunctionTemplate.FunctionScope.SIMPLE, diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnionAggregate.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnionAggregate.java similarity index 77% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnionAggregate.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnionAggregate.java index bcb761511d7..32b90bafc7d 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnionAggregate.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnionAggregate.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillAggFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -30,13 +29,14 @@ import org.apache.drill.exec.expr.holders.ObjectHolder; import org.apache.drill.exec.expr.holders.UInt1Holder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns a geometry that represents the point set union of the Geometries */ @FunctionTemplate(name = "st_unionaggregate", scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE) public class STUnionAggregate implements DrillAggFunc { + @Param NullableVarBinaryHolder in; @Workspace ObjectHolder value; @Workspace UInt1Holder init; @@ -56,25 +56,23 @@ public void setup() { @Override public void add() { - sout: { - if (in.isSet == 0) { - // processing nullable input and the value is null, so don't do anything... - break sout; - } - nonNullCount.value = 1; - java.util.ArrayList<com.esri.core.geometry.Geometry> tmp = (java.util.ArrayList<com.esri.core.geometry.Geometry>) value.obj; - com.esri.core.geometry.ogc.OGCGeometry geom; - geom = com.esri.core.geometry.ogc.OGCGeometry - .fromBinary(in.buffer.nioBuffer(in.start, in.end - in.start)); + if (in.isSet == 0) { + // processing nullable input and the value is null, so don't do anything... + return; + } + nonNullCount.value = 1; + java.util.List<com.esri.core.geometry.Geometry> tmp = (java.util.ArrayList<com.esri.core.geometry.Geometry>) value.obj; + + com.esri.core.geometry.ogc.OGCGeometry geom; + geom = com.esri.core.geometry.ogc.OGCGeometry.fromBinary(in.buffer.nioBuffer(in.start, in.end - in.start)); - tmp.add(geom.getEsriGeometry()); + tmp.add(geom.getEsriGeometry()); - if(init.value == 0) { - init.value = 1; - srid.value = geom.SRID(); - } - } // end of sout block + if (init.value == 0) { + init.value = 1; + srid.value = geom.SRID(); + } } @Override @@ -82,14 +80,14 @@ public void output() { if (nonNullCount.value > 0) { out.isSet = 1; - java.util.ArrayList<com.esri.core.geometry.Geometry> tmp = (java.util.ArrayList<com.esri.core.geometry.Geometry>) value.obj; + java.util.List<com.esri.core.geometry.Geometry> tmp = (java.util.ArrayList<com.esri.core.geometry.Geometry>) value.obj; com.esri.core.geometry.SpatialReference spatialRef = null; if (srid.value != 0){ spatialRef = com.esri.core.geometry.SpatialReference.create(4326); } com.esri.core.geometry.Geometry[] geomArr = - (com.esri.core.geometry.Geometry[]) tmp.toArray( new com.esri.core.geometry.Geometry[0] ); + (com.esri.core.geometry.Geometry[]) tmp.toArray(new com.esri.core.geometry.Geometry[0]); com.esri.core.geometry.Geometry geom = com.esri.core.geometry.GeometryEngine.union(geomArr, spatialRef); com.esri.core.geometry.ogc.OGCGeometry unionGeom = com.esri.core.geometry.ogc.OGCGeometry.createFromEsriGeometry(geom, spatialRef); diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STWithin.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STWithin.java similarity index 94% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STWithin.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STWithin.java index f229c63482a..ab82f0fd242 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STWithin.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STWithin.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,7 +25,7 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; @FunctionTemplate(name = "st_within", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL) @@ -55,8 +54,6 @@ public void eval() { geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); - int isWithin = geom1.within(geom2) ? 1 : 0; - - out.value = isWithin; + out.value = geom1.within(geom2) ? 1 : 0; } } diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXFunc.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXFunc.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXFunc.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXFunc.java index 8986bbcc727..72b04bc2005 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXFunc.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXFunc.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Return the X coordinate of the point, or NaN if not available */ @FunctionTemplate(name = "st_x", scope = FunctionTemplate.FunctionScope.SIMPLE, diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMax.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMax.java similarity index 95% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMax.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMax.java index ee8afa0bc9e..79cb6793a2d 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMax.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMax.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns X maxima of a bounding box 2d or 3d or a geometry */ @FunctionTemplate(name = "st_xmax", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -51,7 +50,6 @@ public void eval() { geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); - com.esri.core.geometry.ogc.OGCGeometry envelopeGeom; if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).X(); } else { diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMin.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMin.java similarity index 95% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMin.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMin.java index d527e6e49f2..3119c87559d 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMin.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMin.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns X minima of a bounding box 2d or 3d or a geometry */ @FunctionTemplate(name = "st_xmin", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -51,7 +50,6 @@ public void eval() { geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); - com.esri.core.geometry.ogc.OGCGeometry envelopeGeom; if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).X(); } else { diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYFunc.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYFunc.java similarity index 97% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYFunc.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYFunc.java index ce1771addd5..8799759398e 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYFunc.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYFunc.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Return the Y coordinate of the point, or NaN if not available */ @FunctionTemplate(name = "st_y", scope = FunctionTemplate.FunctionScope.SIMPLE, diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMax.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMax.java similarity index 95% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMax.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMax.java index 4101e79f2d7..933536cad6d 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMax.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMax.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns Y maxima of a bounding box 2d or 3d or a geometry */ @FunctionTemplate(name = "st_ymax", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -51,7 +50,6 @@ public void eval() { geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); - com.esri.core.geometry.ogc.OGCGeometry envelopeGeom; if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).Y(); } else { diff --git a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMin.java b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMin.java similarity index 95% rename from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMin.java rename to contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMin.java index 85fc7e45c1d..2c8eab96a0b 100644 --- a/contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMin.java +++ b/contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMin.java @@ -15,10 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; - -import javax.inject.Inject; +package org.apache.drill.exec.udfs.gis; +import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.Output; @@ -26,9 +25,9 @@ import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import io.netty.buffer.DrillBuf; +import javax.inject.Inject; -/* +/** * Returns Y minima of a bounding box 2d or 3d or a geometry */ @FunctionTemplate(name = "st_ymin", scope = FunctionTemplate.FunctionScope.SIMPLE, @@ -51,7 +50,6 @@ public void eval() { geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); - com.esri.core.geometry.ogc.OGCGeometry envelopeGeom; if (geom1.geometryType().equals("Point")) { out.value = ((com.esri.core.geometry.ogc.OGCPoint) geom1).Y(); } else { diff --git a/contrib/udfs/src/main/resources/drill-module.conf b/contrib/udfs/src/main/resources/drill-module.conf new file mode 100644 index 00000000000..741aac0beb8 --- /dev/null +++ b/contrib/udfs/src/main/resources/drill-module.conf @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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. +// +// This file tells Drill to consider this module when class path scanning. +// This file can also include any supplementary configuration information. +// This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information. + +drill.classpath.scanning.packages += "org.apache.drill.exec.udfs" diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCryptoFunctions.java b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestCryptoFunctions.java similarity index 98% rename from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCryptoFunctions.java rename to contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestCryptoFunctions.java index d7d6047ec64..2606c461c27 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCryptoFunctions.java +++ b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestCryptoFunctions.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.fn.impl; +package org.apache.drill.exec.udfs; import org.apache.drill.test.BaseTestQuery; import org.apache.drill.categories.SqlFunctionTest; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNetworkFunctions.java b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestNetworkFunctions.java similarity index 96% rename from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNetworkFunctions.java rename to contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestNetworkFunctions.java index 8733c9afa15..1e056b0fd31 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNetworkFunctions.java +++ b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestNetworkFunctions.java @@ -15,11 +15,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.fn.impl; +package org.apache.drill.exec.udfs; +import org.apache.drill.categories.SqlFunctionTest; +import org.apache.drill.categories.UnlikelyTest; import org.apache.drill.test.BaseTestQuery; import org.junit.Test; +import org.junit.experimental.categories.Category; +@Category({UnlikelyTest.class, SqlFunctionTest.class}) public class TestNetworkFunctions extends BaseTestQuery { @Test diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestPhoneticFunctions.java b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestPhoneticFunctions.java similarity index 96% rename from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestPhoneticFunctions.java rename to contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestPhoneticFunctions.java index 85bb135e22f..d41435daa8e 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestPhoneticFunctions.java +++ b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestPhoneticFunctions.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.fn.impl; +package org.apache.drill.exec.udfs; import org.apache.drill.categories.SqlFunctionTest; import org.apache.drill.categories.UnlikelyTest; @@ -23,7 +23,6 @@ import org.apache.drill.test.ClusterFixture; import org.apache.drill.test.ClusterFixtureBuilder; import org.apache.drill.test.ClusterTest; -import org.apache.drill.test.QueryResultSet; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; @@ -34,8 +33,6 @@ @Category({UnlikelyTest.class, SqlFunctionTest.class}) public class TestPhoneticFunctions extends ClusterTest { - private QueryResultSet result; - @Rule public final BaseDirTestWatcher baseDirTestWatcher = new BaseDirTestWatcher(); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestStringDistanceFunctions.java b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestStringDistanceFunctions.java similarity index 98% rename from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestStringDistanceFunctions.java rename to contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestStringDistanceFunctions.java index 915c0623168..e90c0b60c12 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestStringDistanceFunctions.java +++ b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestStringDistanceFunctions.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.drill.exec.fn.impl; +package org.apache.drill.exec.udfs; import org.apache.drill.categories.SqlFunctionTest; import org.apache.drill.categories.UnlikelyTest; diff --git a/contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/TestGeometryFunctions.java b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/gis/TestGeometryFunctions.java similarity index 95% rename from contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/TestGeometryFunctions.java rename to contrib/udfs/src/test/java/org/apache/drill/exec/udfs/gis/TestGeometryFunctions.java index 379de5c47e2..93617d95e64 100644 --- a/contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/TestGeometryFunctions.java +++ b/contrib/udfs/src/test/java/org/apache/drill/exec/udfs/gis/TestGeometryFunctions.java @@ -15,16 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.drill.exec.expr.fn.impl.gis; +package org.apache.drill.exec.udfs.gis; +import org.apache.drill.categories.SqlFunctionTest; +import org.apache.drill.categories.UnlikelyTest; import org.apache.drill.test.BaseTestQuery; import org.junit.Test; +import org.junit.experimental.categories.Category; +@Category({UnlikelyTest.class, SqlFunctionTest.class}) public class TestGeometryFunctions extends BaseTestQuery { - String wktPoint = "POINT (-121.895 37.339)"; - String json = "{\"x\":-121.895,\"y\":37.339,\"spatialReference\":{\"wkid\":4326}}"; - String geoJson = "{\"type\":\"Point\",\"coordinates\":[-121.895,37.339]," + private final String wktPoint = "POINT (-121.895 37.339)"; + private final String json = "{\"x\":-121.895,\"y\":37.339,\"spatialReference\":{\"wkid\":4326}}"; + private final String geoJson = "{\"type\":\"Point\",\"coordinates\":[-121.895,37.339]," + "\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}}}"; @Test @@ -292,7 +296,7 @@ public void testDisjointQuery() throws Exception { } @Test - public void testTransfromQuery() throws Exception { + public void testTransformQuery() throws Exception { double targetX = -71.1776848522251; double targetY = 42.3902896512902; diff --git a/distribution/pom.xml b/distribution/pom.xml index 19f41f2f441..35a274a7559 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -266,14 +266,14 @@ <artifactId>drill-storage-hive-core</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.drill.contrib</groupId> - <artifactId>drill-gis</artifactId> + <artifactId>drill-storage-kafka</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.drill.contrib</groupId> - <artifactId>drill-storage-kafka</artifactId> + <artifactId>drill-udfs</artifactId> <version>${project.version}</version> </dependency> </dependencies> diff --git a/distribution/src/assemble/bin.xml b/distribution/src/assemble/bin.xml index 712f3ec596f..1db6804ef35 100644 --- a/distribution/src/assemble/bin.xml +++ b/distribution/src/assemble/bin.xml @@ -102,9 +102,9 @@ <include>org.apache.drill.contrib:drill-format-mapr</include> <include>org.apache.drill.contrib:drill-jdbc-storage</include> <include>org.apache.drill.contrib:drill-kudu-storage</include> - <include>org.apache.drill.contrib:drill-gis</include> <include>org.apache.drill.contrib:drill-storage-kafka</include> <include>org.apache.drill.contrib:drill-opentsdb-storage</include> + <include>org.apache.drill.contrib:drill-udfs</include> </includes> <excludes> <exclude>org.apache.drill.contrib.storage-hive:drill-storage-hive-core:jar:tests</exclude> diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml index 6c4e29628bd..7aab7240e4e 100644 --- a/exec/java-exec/pom.xml +++ b/exec/java-exec/pom.xml @@ -97,11 +97,6 @@ <artifactId>univocity-parsers</artifactId> <version>1.3.0</version> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-text</artifactId> - <version>1.4</version> - </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math</artifactId> @@ -354,22 +349,6 @@ <artifactId>joda-time</artifactId> <version>2.9</version> </dependency> - <dependency> - <groupId>commons-net</groupId> - <artifactId>commons-net</artifactId> - <version>3.6</version> - </dependency> - <dependency> - <groupId>commons-validator</groupId> - <artifactId>commons-validator</artifactId> - <version>1.4.1</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml index 453703a7afa..91ad39a5e82 100644 --- a/exec/jdbc-all/pom.xml +++ b/exec/jdbc-all/pom.xml @@ -164,14 +164,6 @@ <groupId>org.kohsuke</groupId> <artifactId>libpam4j</artifactId> </exclusion> - <exclusion> - <groupId>commons-net</groupId> - <artifactId>commons-net</artifactId> - </exclusion> - <exclusion> - <groupId>commons-validator</groupId> - <artifactId>commons-validator</artifactId> - </exclusion> <exclusion> <artifactId>metadata-extractor</artifactId> <groupId>com.drewnoakes</groupId> ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
