You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by vo...@apache.org on 2019/06/18 18:22:50 UTC

[drill] 01/03: DRILL-7294: Prevent generating java beans using protostuff to avoid overriding classes with the same simple name declared as nested in the proto files

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

volodymyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 4eb726367adad2ae0981b6be311f9c4ec2f30c73
Author: Volodymyr Vysotskyi <vv...@gmail.com>
AuthorDate: Thu Jun 13 17:02:43 2019 +0300

    DRILL-7294: Prevent generating java beans using protostuff to avoid overriding classes with the same simple name declared as nested in the proto files
    
    closes #1808
---
 .../apache/drill/exec/store/jdbc/JdbcSubScan.java  |  4 +--
 .../exec/coord/store/TransientStoreConfig.java     |  2 +-
 .../impl/statistics/AvgWidthMergedStatistic.java   |  7 ++---
 .../impl/statistics/NDVMergedStatistic.java        |  7 ++---
 .../drill/exec/serialization/ProtoSerializer.java  |  4 +--
 .../exec/store/sys/PersistentStoreConfig.java      |  2 +-
 exec/jdbc-all/pom.xml                              |  4 +--
 protocol/pom.xml                                   | 35 +++++-----------------
 8 files changed, 21 insertions(+), 44 deletions(-)

diff --git a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcSubScan.java b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcSubScan.java
index c9d5f0d..43bf909 100755
--- a/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcSubScan.java
+++ b/contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcSubScan.java
@@ -21,7 +21,7 @@ import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.logical.StoragePluginConfig;
 import org.apache.drill.exec.physical.base.AbstractSubScan;
-import org.apache.drill.exec.proto.beans.CoreOperatorType;
+import org.apache.drill.exec.proto.UserBitShared;
 import org.apache.drill.exec.store.StoragePluginRegistry;
 
 import com.fasterxml.jackson.annotation.JacksonInject;
@@ -60,7 +60,7 @@ public class JdbcSubScan extends AbstractSubScan {
 
   @Override
   public int getOperatorType() {
-    return CoreOperatorType.JDBC_SCAN.getNumber();
+    return UserBitShared.CoreOperatorType.JDBC_SCAN.getNumber();
   }
 
   public String getSql() {
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/store/TransientStoreConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/store/TransientStoreConfig.java
index 3c95639..9622a77 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/store/TransientStoreConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/store/TransientStoreConfig.java
@@ -17,8 +17,8 @@
  */
 package org.apache.drill.exec.coord.store;
 
-import com.dyuproject.protostuff.Schema;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import io.protostuff.Schema;
 import org.apache.drill.shaded.guava.com.google.common.base.Objects;
 import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
 import org.apache.drill.shaded.guava.com.google.common.base.Strings;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java
index 6a9660d..0a01e74 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.drill.common.types.MinorType;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.exec.record.MajorTypeSerDe;
 import org.apache.drill.exec.vector.NullableFloat8Vector;
@@ -139,9 +138,9 @@ public class AvgWidthMergedStatistic extends AbstractMergedStatistic {
     }
     // If variable length type - then use the nonNullCount. Otherwise, use the Count,
     // since even NULL values take up the same space.
-    if (type == MinorType.VAR16CHAR.getNumber()
-        || type == MinorType.VARCHAR.getNumber()
-        || type == MinorType.VARBINARY.getNumber()) {
+    if (type == TypeProtos.MinorType.VAR16CHAR.getNumber()
+        || type == TypeProtos.MinorType.VARCHAR.getNumber()
+        || type == TypeProtos.MinorType.VARBINARY.getNumber()) {
       return nonNullStatCounts.getStat(colName);
     } else {
       return statCounts.getStat(colName);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java
index fc87fbd..88e93d4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java
@@ -29,7 +29,6 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.drill.common.types.MinorType;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.exec.record.MajorTypeSerDe;
 import org.apache.drill.exec.server.options.OptionManager;
@@ -187,9 +186,9 @@ public class NDVMergedStatistic extends AbstractMergedStatistic {
     }
     // If variable length type - then use the nonNullCount. Otherwise, use the Count,
     // since even NULL values take up the same space.
-    if (type == MinorType.VAR16CHAR.getNumber()
-            || type == MinorType.VARCHAR.getNumber()
-            || type == MinorType.VARBINARY.getNumber()) {
+    if (type == TypeProtos.MinorType.VAR16CHAR.getNumber()
+            || type == TypeProtos.MinorType.VARCHAR.getNumber()
+            || type == TypeProtos.MinorType.VARBINARY.getNumber()) {
       return nonNullStatCounts.getStat(colName);
     } else {
       return statCounts.getStat(colName);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/ProtoSerializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/ProtoSerializer.java
index 51878d0..0124292 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/ProtoSerializer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/ProtoSerializer.java
@@ -20,8 +20,8 @@ package org.apache.drill.exec.serialization;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import com.dyuproject.protostuff.JsonIOUtil;
-import com.dyuproject.protostuff.Schema;
+import io.protostuff.JsonIOUtil;
+import io.protostuff.Schema;
 import org.apache.drill.shaded.guava.com.google.common.base.Objects;
 import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
 import com.google.protobuf.Message;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
index 532033a..668306e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
@@ -17,12 +17,12 @@
  */
 package org.apache.drill.exec.store.sys;
 
-import com.dyuproject.protostuff.Schema;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.drill.shaded.guava.com.google.common.base.Objects;
 import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
 import com.google.protobuf.Message;
 import com.google.protobuf.Message.Builder;
+import io.protostuff.Schema;
 import org.apache.drill.exec.serialization.InstanceSerializer;
 import org.apache.drill.exec.serialization.JacksonSerializer;
 import org.apache.drill.exec.serialization.ProtoSerializer;
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index be79b41..a7effe3 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -299,7 +299,7 @@
               <include>*:*</include>
             </includes>
             <excludes>
-              <exclude>com.dyuproject.protostuff:*</exclude>
+              <exclude>io.protostuff:*</exclude>
               <exclude>org.apache.calcite:calcite-core</exclude>
               <exclude>org.apache.calcite:calcite-linq4j</exclude>
               <exclude>org.pentaho:*</exclude>
@@ -614,7 +614,7 @@
                   </includes>
                   <excludes>
                     <exclude>org.slf4j:jcl-over-slf4j</exclude>
-                    <exclude>com.dyuproject.protostuff:*</exclude>
+                    <exclude>io.protostuff:*</exclude>
                     <exclude>org.apache.calcite:calcite-core</exclude>
                     <exclude>org.apache.calcite:calcite-linq4j</exclude>
                     <exclude>org.pentaho:*</exclude>
diff --git a/protocol/pom.xml b/protocol/pom.xml
index 04629ac..73226a3 100644
--- a/protocol/pom.xml
+++ b/protocol/pom.xml
@@ -37,14 +37,14 @@
       <artifactId>protobuf-java</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.dyuproject.protostuff</groupId>
+      <groupId>io.protostuff</groupId>
       <artifactId>protostuff-core</artifactId>
-      <version>1.0.8</version>
+      <version>1.6.0</version>
     </dependency>
     <dependency>
-      <groupId>com.dyuproject.protostuff</groupId>
+      <groupId>io.protostuff</groupId>
       <artifactId>protostuff-json</artifactId>
-      <version>1.0.8</version>
+      <version>1.6.0</version>
     </dependency>
   </dependencies>
 
@@ -82,9 +82,9 @@
             </executions>
           </plugin>
           <plugin>
-            <groupId>com.dyuproject.protostuff</groupId>
+            <groupId>io.protostuff</groupId>
             <artifactId>protostuff-maven-plugin</artifactId>
-            <version>1.0.8</version>
+            <version>1.6.0</version>
             <configuration>
               <protoModules>
                 <protoModule>
@@ -98,27 +98,6 @@
                     </property>
                   </options>
                 </protoModule>
-                <protoModule>
-                  <source>src/main/protobuf/</source>
-                  <outputDir>src/main/java</outputDir>
-                  <output>java_bean</output>
-                  <encoding>UTF-8</encoding>
-                  <options>
-                    <property>
-                      <name>generate_field_map</name>
-                    </property>
-                    <property>
-                      <name>org.apache.drill.exec.proto</name>
-                      <value>org.apache.drill.exec.proto.beans</value>
-                    </property>
-                    <property>
-                      <name>primitive_numbers_if_optional</name>
-                    </property>
-                    <property>
-                      <name>builder_pattern</name>
-                    </property>
-                  </options>
-                </protoModule>
               </protoModules>
             </configuration>
             <executions>
@@ -134,7 +113,7 @@
           <plugin>
             <groupId>com.github.igor-petruk.protobuf</groupId>
             <artifactId>protobuf-maven-plugin</artifactId>
-            <version>0.6.3</version>
+            <version>0.6.5</version>
             <executions>
               <execution>
                 <goals>