You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by jo...@apache.org on 2019/12/17 02:15:30 UTC

[incubator-druid] branch 0.17.0-incubating updated: Fix equalsAndHashCode in ClientCompactQueryTuningConfig (#9035) (#9051)

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

jonwei pushed a commit to branch 0.17.0-incubating
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/0.17.0-incubating by this push:
     new f956a52  Fix equalsAndHashCode in ClientCompactQueryTuningConfig (#9035) (#9051)
f956a52 is described below

commit f956a5295c26521f56ff28d4537f9b6d75858347
Author: Suneet Saldanha <44...@users.noreply.github.com>
AuthorDate: Mon Dec 16 18:15:16 2019 -0800

    Fix equalsAndHashCode in ClientCompactQueryTuningConfig (#9035) (#9051)
    
    * Fix equalsAndHashCode in ClientCompactQueryTuningConfig
    
    This change introduces a dependency to EqualsVerifier for the test scope.
    The dependency is licensed under Apache 2. The library makes it trivial
    to add equals and hashCode checks to prevent bugs like this from happening
    in the future
    
    * fix checkstyle
    
    * fix test name
---
 pom.xml                                            |  6 ++++
 server/pom.xml                                     |  5 ++++
 .../indexing/ClientCompactQueryTuningConfig.java   |  3 ++
 .../ClientCompactQueryTuningConfigTest.java        | 34 ++++++++++++++++++++++
 4 files changed, 48 insertions(+)

diff --git a/pom.xml b/pom.xml
index ff56a8e..7330385 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1199,6 +1199,12 @@
                 <scope>test</scope>
             </dependency>
             <dependency>
+                <groupId>nl.jqno.equalsverifier</groupId>
+                <artifactId>equalsverifier</artifactId>
+                <version>3.1.10</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
                 <groupId>com.github.stefanbirkner</groupId>
                 <artifactId>system-rules</artifactId>
                 <version>1.19.0</version>
diff --git a/server/pom.xml b/server/pom.xml
index 4be28f7..2810c40 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -421,6 +421,11 @@
             <artifactId>assertj-core</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>nl.jqno.equalsverifier</groupId>
+            <artifactId>equalsverifier</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/server/src/main/java/org/apache/druid/client/indexing/ClientCompactQueryTuningConfig.java b/server/src/main/java/org/apache/druid/client/indexing/ClientCompactQueryTuningConfig.java
index c99a7cb..026c6a7 100644
--- a/server/src/main/java/org/apache/druid/client/indexing/ClientCompactQueryTuningConfig.java
+++ b/server/src/main/java/org/apache/druid/client/indexing/ClientCompactQueryTuningConfig.java
@@ -193,6 +193,7 @@ public class ClientCompactQueryTuningConfig
            Objects.equals(maxBytesInMemory, that.maxBytesInMemory) &&
            Objects.equals(maxRowsInMemory, that.maxRowsInMemory) &&
            Objects.equals(maxTotalRows, that.maxTotalRows) &&
+           Objects.equals(splitHintSpec, that.splitHintSpec) &&
            Objects.equals(indexSpec, that.indexSpec) &&
            Objects.equals(maxPendingPersists, that.maxPendingPersists) &&
            Objects.equals(pushTimeout, that.pushTimeout) &&
@@ -207,6 +208,7 @@ public class ClientCompactQueryTuningConfig
         maxBytesInMemory,
         maxRowsInMemory,
         maxTotalRows,
+        splitHintSpec,
         indexSpec,
         maxPendingPersists,
         pushTimeout,
@@ -222,6 +224,7 @@ public class ClientCompactQueryTuningConfig
            ", maxBytesInMemory=" + maxBytesInMemory +
            ", maxRowsInMemory=" + maxRowsInMemory +
            ", maxTotalRows=" + maxTotalRows +
+           ", splitHintSpec=" + splitHintSpec +
            ", indexSpec=" + indexSpec +
            ", maxPendingPersists=" + maxPendingPersists +
            ", pushTimeout=" + pushTimeout +
diff --git a/server/src/test/java/org/apache/druid/indexing/ClientCompactQueryTuningConfigTest.java b/server/src/test/java/org/apache/druid/indexing/ClientCompactQueryTuningConfigTest.java
new file mode 100644
index 0000000..eb7f42c
--- /dev/null
+++ b/server/src/test/java/org/apache/druid/indexing/ClientCompactQueryTuningConfigTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.druid.indexing;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+import org.apache.druid.client.indexing.ClientCompactQueryTuningConfig;
+import org.junit.Test;
+
+public class ClientCompactQueryTuningConfigTest
+{
+  @Test
+  public void testEqualsContract()
+  {
+    // If this test failed, make sure to validate that toString was also updated correctly!
+    EqualsVerifier.forClass(ClientCompactQueryTuningConfig.class).usingGetClass().verify();
+  }
+}


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