You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2020/06/13 22:11:17 UTC

[incubator-datasketches-hive] branch master updated: Changed POM and added log4j2.xml config to eliminate compiler warnings.

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-hive.git


The following commit(s) were added to refs/heads/master by this push:
     new a1850e6  Changed POM and added log4j2.xml config to eliminate compiler warnings.
a1850e6 is described below

commit a1850e6902730034badf6e29e86a071a01f1fd7d
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Sat Jun 13 15:11:01 2020 -0700

    Changed POM and added log4j2.xml config to eliminate compiler warnings.
    
    Removed unused "resource" warning in EstimateSketchUDFTest.
    
    Added SuppressWarnings("deprecation") to two methods. Turns out that the
    actual problem is within Hive itself.
---
 pom.xml                                             | 21 +++++++++++++++++++++
 .../GetFrequentItemsFromStringsSketchUDTF.java      |  5 +++--
 .../tuple/ArrayOfDoublesSketchToValuesUDTF.java     |  3 ++-
 .../hive/theta/EstimateSketchUDFTest.java           |  2 +-
 src/test/resources/log4j2.xml                       | 13 +++++++++++++
 5 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 83b7584..19f91fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -172,12 +172,33 @@ under the License.
       <artifactId>hive-exec</artifactId>
       <version>${hive-exec.version}</version>
       <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-slf4j-impl</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-log4j12</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
       <version>${hadoop-common.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-log4j12</artifactId>
+        </exclusion>
+      </exclusions>
       <scope>provided</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.27</version>
     </dependency>
     <!-- END: UNIQUE FOR THIS JAVA COMPONENT -->
     
diff --git a/src/main/java/org/apache/datasketches/hive/frequencies/GetFrequentItemsFromStringsSketchUDTF.java b/src/main/java/org/apache/datasketches/hive/frequencies/GetFrequentItemsFromStringsSketchUDTF.java
index 1247112..25a4021 100644
--- a/src/main/java/org/apache/datasketches/hive/frequencies/GetFrequentItemsFromStringsSketchUDTF.java
+++ b/src/main/java/org/apache/datasketches/hive/frequencies/GetFrequentItemsFromStringsSketchUDTF.java
@@ -47,9 +47,10 @@ public class GetFrequentItemsFromStringsSketchUDTF extends GenericUDTF {
   PrimitiveObjectInspector inputObjectInspector;
   PrimitiveObjectInspector errorTypeObjectInspector;
 
+  @SuppressWarnings("deprecation")
   @Override
   public StructObjectInspector initialize(final ObjectInspector[] inspectors) throws UDFArgumentException {
-    if ((inspectors.length != 1) && (inspectors.length != 2)) {
+    if (inspectors.length != 1 && inspectors.length != 2) {
       throw new UDFArgumentException("One or two arguments expected");
     }
 
@@ -89,7 +90,7 @@ public class GetFrequentItemsFromStringsSketchUDTF extends GenericUDTF {
 
   @Override
   public void process(final Object[] data) throws HiveException {
-    if ((data == null) || (data[0] == null)) { return; }
+    if (data == null || data[0] == null) { return; }
     final BytesWritable serializedSketch =
         (BytesWritable) inputObjectInspector.getPrimitiveWritableObject(data[0]);
     final ItemsSketch<String> sketch = ItemsSketch.getInstance(
diff --git a/src/main/java/org/apache/datasketches/hive/tuple/ArrayOfDoublesSketchToValuesUDTF.java b/src/main/java/org/apache/datasketches/hive/tuple/ArrayOfDoublesSketchToValuesUDTF.java
index dabd1fc..ee9bda3 100644
--- a/src/main/java/org/apache/datasketches/hive/tuple/ArrayOfDoublesSketchToValuesUDTF.java
+++ b/src/main/java/org/apache/datasketches/hive/tuple/ArrayOfDoublesSketchToValuesUDTF.java
@@ -43,6 +43,7 @@ public class ArrayOfDoublesSketchToValuesUDTF extends GenericUDTF {
 
   PrimitiveObjectInspector inputObjectInspector;
 
+  @SuppressWarnings("deprecation")
   @Override
   public StructObjectInspector initialize(final ObjectInspector[] inspectors) throws UDFArgumentException {
     if (inspectors.length != 1) {
@@ -70,7 +71,7 @@ public class ArrayOfDoublesSketchToValuesUDTF extends GenericUDTF {
 
   @Override
   public void process(final Object[] data) throws HiveException {
-    if ((data == null) || (data[0] == null)) { return; }
+    if (data == null || data[0] == null) { return; }
     final BytesWritable serializedSketch =
       (BytesWritable) inputObjectInspector.getPrimitiveWritableObject(data[0]);
     final ArrayOfDoublesSketch sketch = ArrayOfDoublesSketches.wrapSketch(
diff --git a/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java b/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java
index 895e18a..f337a60 100644
--- a/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java
+++ b/src/test/java/org/apache/datasketches/hive/theta/EstimateSketchUDFTest.java
@@ -27,7 +27,7 @@ import org.apache.datasketches.theta.UpdateSketch;
 import org.apache.hadoop.io.BytesWritable;
 import org.testng.annotations.Test;
 
-@SuppressWarnings({"javadoc","resource"})
+@SuppressWarnings({"javadoc"})
 public class EstimateSketchUDFTest {
 
   @Test
diff --git a/src/test/resources/log4j2.xml b/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..e446eec
--- /dev/null
+++ b/src/test/resources/log4j2.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="WARN">
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="DEBUG">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org