diff options
author | Arina Ielchiieva <arina.yelchiyeva@gmail.com> | 2018-07-25 20:28:45 +0300 |
---|---|---|
committer | Timothy Farkas <timothyfarkas@apache.org> | 2018-07-31 16:24:28 -0700 |
commit | 0903a1edb5531d3d28104191b35b57db3a99d5da (patch) | |
tree | 37cd5903e50b0be363e07045ec7ef66e05817cd3 | |
parent | b77441333010b60683c78dbc4cc349b2ee6c0c53 (diff) |
DRILL-6634: Add udf module under contrib directory and move some udfs into it
1. Created new contrib/udf module.
2. Moved distance, phonetic, networking, crypto functions from java-exec to contrib/udf module.
3. Moved functions from gis module to contrib/udf module. Removed gis module.
4. Removed unnecessary dependencies from java-exec module.
5. Minor refactoring of moved functions code.
closes #1403
-rw-r--r-- | contrib/gis/pom.xml | 134 | ||||
-rw-r--r-- | contrib/gis/src/main/resources/drill-module.conf | 0 | ||||
-rw-r--r-- | contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/GISTestSuite.java | 30 | ||||
-rw-r--r-- | contrib/pom.xml | 2 | ||||
-rw-r--r-- | contrib/udfs/pom.xml | 136 | ||||
-rw-r--r-- | contrib/udfs/sample-data/CA-cities-with-nulls.csv (renamed from contrib/gis/sample-data/CA-cities-with-nulls.csv) | 0 | ||||
-rw-r--r-- | contrib/udfs/sample-data/CA-cities.csv (renamed from contrib/gis/sample-data/CA-cities.csv) | 0 | ||||
-rw-r--r-- | contrib/udfs/sample-data/polygons.tsv (renamed from contrib/gis/sample-data/polygons.tsv) | 0 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java (renamed from contrib/gis/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java) | 0 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/CryptoFunctions.java (renamed from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CryptoFunctions.java) | 16 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/NetworkFunctions.java (renamed from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/NetworkFunctions.java) | 55 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/PhoneticFunctions.java (renamed from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/PhoneticFunctions.java) | 16 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/StringDistanceFunctions.java (renamed from exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringDistanceFunctions.java) | 36 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsGeoJSON.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsGeoJSON.java) | 7 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsJson.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsJson.java) | 7 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STAsText.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STAsText.java) | 7 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STBuffer.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STBuffer.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STContains.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STContains.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STCrosses.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STCrosses.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDWithin.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDWithin.java) | 11 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDifference.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDifference.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDisjoint.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDisjoint.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STDistance.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STDistance.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEnvelope.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEnvelope.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STEquals.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STEquals.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromText.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromText.java) | 7 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STGeomFromTextSrid.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STGeomFromTextSrid.java) | 7 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STIntersects.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STIntersects.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STOverlaps.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STOverlaps.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STPointFunc.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STPointFunc.java) | 7 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STRelate.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STRelate.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTouches.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTouches.java) | 13 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STTransform.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STTransform.java) | 18 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnion.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnion.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STUnionAggregate.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STUnionAggregate.java) | 44 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STWithin.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STWithin.java) | 11 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXFunc.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXFunc.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMax.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMax.java) | 10 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STXMin.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STXMin.java) | 10 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYFunc.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYFunc.java) | 9 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMax.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMax.java) | 10 | ||||
-rw-r--r-- | contrib/udfs/src/main/java/org/apache/drill/exec/udfs/gis/STYMin.java (renamed from contrib/gis/src/main/java/org/apache/drill/exec/expr/fn/impl/gis/STYMin.java) | 10 | ||||
-rw-r--r-- | contrib/udfs/src/main/resources/drill-module.conf | 20 | ||||
-rw-r--r-- | contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestCryptoFunctions.java (renamed from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCryptoFunctions.java) | 2 | ||||
-rw-r--r-- | contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestNetworkFunctions.java (renamed from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNetworkFunctions.java) | 6 | ||||
-rw-r--r-- | contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestPhoneticFunctions.java (renamed from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestPhoneticFunctions.java) | 5 | ||||
-rw-r--r-- | contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestStringDistanceFunctions.java (renamed from exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestStringDistanceFunctions.java) | 2 | ||||
-rw-r--r-- | contrib/udfs/src/test/java/org/apache/drill/exec/udfs/gis/TestGeometryFunctions.java (renamed from contrib/gis/src/test/java/org/apache/drill/exec/expr/fn/impl/gis/TestGeometryFunctions.java) | 14 | ||||
-rw-r--r-- | distribution/pom.xml | 8 | ||||
-rw-r--r-- | distribution/src/assemble/bin.xml | 2 | ||||
-rw-r--r-- | exec/java-exec/pom.xml | 21 | ||||
-rw-r--r-- | exec/jdbc-all/pom.xml | 8 |
52 files changed, 331 insertions, 515 deletions
diff --git a/contrib/gis/pom.xml b/contrib/gis/pom.xml deleted file mode 100644 index 8a37b6c0f..000000000 --- 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 e69de29bb..000000000 --- a/contrib/gis/src/main/resources/drill-module.conf +++ /dev/null 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 07521c352..000000000 --- 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 8b576646d..a96aa4207 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 000000000..44987fc26 --- /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 index dcd67ecca..dcd67ecca 100644 --- a/contrib/gis/sample-data/CA-cities-with-nulls.csv +++ b/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 index b351d234e..b351d234e 100644 --- a/contrib/gis/sample-data/CA-cities.csv +++ b/contrib/udfs/sample-data/CA-cities.csv diff --git a/contrib/gis/sample-data/polygons.tsv b/contrib/udfs/sample-data/polygons.tsv index f70c922b1..f70c922b1 100644 --- a/contrib/gis/sample-data/polygons.tsv +++ b/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 index c95b79875..c95b79875 100644 --- a/contrib/gis/src/main/java/com/esri/core/geometry/VertexGeomAccessor.java +++ b/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 index 68c47532a..bc6f23c9b 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.crypto.Cipher; 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 class CryptoFunctions { * 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 class CryptoFunctions { * * > 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 class CryptoFunctions { * 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 class CryptoFunctions { * 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 class CryptoFunctions { * 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 class CryptoFunctions { * 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 class CryptoFunctions { * 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 index 448e8b6ae..cf20527b8 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 org.apache.drill.exec.expr.holders.VarCharHolder; 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 @@ public class NetworkFunctions { @Output BitHolder out; - @Inject - DrillBuf buffer; - public void setup() { } @@ -85,9 +78,6 @@ public class NetworkFunctions { @Output BigIntHolder out; - @Inject - DrillBuf buffer; - public void setup() { } @@ -96,8 +86,7 @@ public class NetworkFunctions { 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 class NetworkFunctions { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -139,7 +127,6 @@ public class NetworkFunctions { /** * 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 class NetworkFunctions { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -200,7 +186,6 @@ public class NetworkFunctions { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -234,7 +219,6 @@ public class NetworkFunctions { out.start = 0; out.end = outputValue.getBytes().length; buffer.setBytes(0, outputValue.getBytes()); - } } @@ -264,13 +248,12 @@ public class NetworkFunctions { 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 class NetworkFunctions { 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 class NetworkFunctions { /** * 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 class NetworkFunctions { 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 class NetworkFunctions { @Output BitHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } @@ -385,22 +359,19 @@ public class NetworkFunctions { 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 class NetworkFunctions { @Output BigIntHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } @@ -462,10 +429,6 @@ public class NetworkFunctions { @Output BitHolder out; - @Inject - DrillBuf buffer; - - public void setup() { } @@ -484,7 +447,6 @@ public class NetworkFunctions { out.value = 0; } } - } } @@ -500,9 +462,6 @@ public class NetworkFunctions { @Output BitHolder out; - @Inject - DrillBuf buffer; - public void setup() { } @@ -536,10 +495,6 @@ public class NetworkFunctions { @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 index ee26bd3ec..55e465a51 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 org.apache.drill.exec.expr.holders.VarCharHolder; 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 @@ public class 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 class PhoneticFunctions { * <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 class PhoneticFunctions { * <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 class PhoneticFunctions { * <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 class PhoneticFunctions { * 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 class PhoneticFunctions { * <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 class PhoneticFunctions { * <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 class PhoneticFunctions { * <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 class PhoneticFunctions { * <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 class PhoneticFunctions { * <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 index 0b0276944..bf0275855 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.Float8Holder; 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 class StringDistanceFunctions { 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 class StringDistanceFunctions { * <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 class StringDistanceFunctions { 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 class StringDistanceFunctions { * <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 class StringDistanceFunctions { 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 class StringDistanceFunctions { * <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 class StringDistanceFunctions { 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 class StringDistanceFunctions { * <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 class StringDistanceFunctions { 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 class StringDistanceFunctions { * <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 class StringDistanceFunctions { 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 class StringDistanceFunctions { * <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 class StringDistanceFunctions { 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 index 3f4150441..4d014853f 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.annotations.Param; 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 index e17083390..090c78b67 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.annotations.Param; 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 index 17b78581c..f770872a8 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.annotations.Param; 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 index a1d3af45f..5ae0b4d3b 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.annotations.Param; 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 index 5204ce605..94f04648f 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.annotations.Param; 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 class STContains implements DrillSimpleFunc { 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 index 95d7aca80..9bf678a6b 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.annotations.Param; 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 class STCrosses implements DrillSimpleFunc { 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 index 70f094700..b2ed091b0 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.BitHolder; 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 class STDWithin implements DrillSimpleFunc { 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 index 4906880e9..bb51f0eee 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 index 8a3424148..5976e17de 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.annotations.Param; 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 class STDisjoint implements DrillSimpleFunc { 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 index 9415f3984..6235cd015 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.annotations.Param; 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 index 82862242f..8e73bcd90 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 index b5e22d623..81895a855 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.annotations.Param; 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 class STEquals implements DrillSimpleFunc { 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 index 042046eb5..41044b50b 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.annotations.Param; 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 index 9a7432e73..2ff25733f 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.NullableIntHolder; 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 index 9e152c5c6..621581d0a 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.annotations.Param; 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 class STIntersects implements DrillSimpleFunc { 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 index 7ae770d67..5f9a162ad 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.annotations.Param; 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 class STOverlaps implements DrillSimpleFunc { 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 index 2024e3b23..1b34f32b0 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.annotations.Param; 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 index 9a1c64b22..fa81ee7d5 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.BitHolder; 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 class STRelate implements DrillSimpleFunc { 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 index 79ad0c73a..0562aebbe 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.annotations.Param; 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 class STTouches implements DrillSimpleFunc { 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 index c2788c18a..1b5c8242c 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.Param; 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, @@ -50,9 +48,6 @@ public class STTransform implements DrillSimpleFunc { CoordinateTransform transform; @Workspace - CRSFactory crsFactory; - - @Workspace int sridTgt; @Output @@ -78,12 +73,11 @@ public class STTransform implements DrillSimpleFunc { 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 index 907c6dadc..24e934a11 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 index bcb761511..32b90bafc 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.NullableVarBinaryHolder; 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 class STUnionAggregate implements DrillAggFunc { @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 class STUnionAggregate implements DrillAggFunc { 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 index f229c6348..ab82f0fd2 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.annotations.Param; 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 class STWithin implements DrillSimpleFunc { 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 index 8986bbcc7..72b04bc20 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.annotations.Param; 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 index ee8afa0bc..79cb6793a 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.annotations.Param; 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 class STXMax implements DrillSimpleFunc { 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 index d527e6e49..3119c8755 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.annotations.Param; 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 class STXMin implements DrillSimpleFunc { 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 index ce1771add..879975939 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.annotations.Param; 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 index 4101e79f2..933536cad 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.annotations.Param; 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 class STYMax implements DrillSimpleFunc { 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 index 85fc7e45c..2c8eab96a 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.annotations.Param; 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 class STYMin implements DrillSimpleFunc { 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 000000000..741aac0be --- /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 index d7d6047ec..2606c461c 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 index 8733c9afa..1e056b0fd 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 index 85bb135e2..d41435daa 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.BaseDirTestWatcher; 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 @@ import static org.junit.Assert.assertEquals; @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 index 915c06231..e90c0b60c 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 index 379de5c47..93617d95e 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 class TestGeometryFunctions extends BaseTestQuery { } @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 19f41f2f4..35a274a75 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 712f3ec59..1db6804ef 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 6c4e29628..7aab7240e 100644 --- a/exec/java-exec/pom.xml +++ b/exec/java-exec/pom.xml @@ -99,11 +99,6 @@ </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> <version>2.2</version> </dependency> @@ -355,22 +350,6 @@ <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> <exclusions> diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml index 453703a7a..91ad39a5e 100644 --- a/exec/jdbc-all/pom.xml +++ b/exec/jdbc-all/pom.xml @@ -165,14 +165,6 @@ <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> </exclusion> |