You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ch...@apache.org on 2019/12/03 06:55:04 UTC

[phoenix] branch 4.x-HBase-1.3 updated: PHOENIX-5593 : Remove redundant null check in JoinCompiler

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

chinmayskulkarni pushed a commit to branch 4.x-HBase-1.3
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.3 by this push:
     new bf4b007  PHOENIX-5593 : Remove redundant null check in JoinCompiler
bf4b007 is described below

commit bf4b007466aaf70abc1b4e265b0e4d121820795f
Author: Viraj Jasani <vi...@gmail.com>
AuthorDate: Wed Nov 27 01:07:22 2019 +0530

    PHOENIX-5593 : Remove redundant null check in JoinCompiler
    
    Signed-off-by: Chinmay Kulkarni <ch...@apache.org>
---
 .../org/apache/phoenix/compile/JoinCompiler.java   | 70 ++++++++++------------
 1 file changed, 30 insertions(+), 40 deletions(-)

diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
index f0a2f36..17c99a8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
@@ -719,56 +719,46 @@ public class JoinCompiler {
                     .setMessage("On-clause LHS expression and RHS expression must be comparable. LHS type: " + lType + ", RHS type: " + rType)
                     .build().buildException();
 
-            if ((lType == null || lType.isCoercibleTo(PTinyint.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PTinyint.INSTANCE))) {
-                return lType == null ? rType : lType; // to preserve UNSIGNED type
+            if (lType.isCoercibleTo(PTinyint.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PTinyint.INSTANCE))) {
+              return lType; // to preserve UNSIGNED type
             }
-
-            if ((lType == null || lType.isCoercibleTo(PSmallint.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PSmallint.INSTANCE))) {
-                return lType == null ? rType : lType; // to preserve UNSIGNED type
+            if (lType.isCoercibleTo(PSmallint.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PSmallint.INSTANCE))) {
+              return lType; // to preserve UNSIGNED type
             }
-
-            if ((lType == null || lType.isCoercibleTo(PInteger.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PInteger.INSTANCE))) {
-                return lType == null ? rType : lType; // to preserve UNSIGNED type
+            if (lType.isCoercibleTo(PInteger.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PInteger.INSTANCE))) {
+              return lType; // to preserve UNSIGNED type
             }
-
-            if ((lType == null || lType.isCoercibleTo(PLong.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PLong.INSTANCE))) {
-                return lType == null ? rType : lType; // to preserve UNSIGNED type
+            if (lType.isCoercibleTo(PLong.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PLong.INSTANCE))) {
+              return lType; // to preserve UNSIGNED type
             }
-
-            if ((lType == null || lType.isCoercibleTo(PDouble.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PDouble.INSTANCE))) {
-                return lType == null ? rType : lType; // to preserve UNSIGNED type
+            if (lType.isCoercibleTo(PDouble.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PDouble.INSTANCE))) {
+              return lType; // to preserve UNSIGNED type
             }
-
-            if ((lType == null || lType.isCoercibleTo(PDecimal.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PDecimal.INSTANCE))) {
-                return PDecimal.INSTANCE;
+            if (lType.isCoercibleTo(PDecimal.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PDecimal.INSTANCE))) {
+              return PDecimal.INSTANCE;
             }
-
-            if ((lType == null || lType.isCoercibleTo(PDate.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PDate.INSTANCE))) {
-                return lType == null ? rType : lType;
+            if (lType.isCoercibleTo(PDate.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PDate.INSTANCE))) {
+              return lType;
             }
-
-            if ((lType == null || lType.isCoercibleTo(PTimestamp.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PTimestamp.INSTANCE))) {
-                return lType == null ? rType : lType;
+            if (lType.isCoercibleTo(PTimestamp.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PTimestamp.INSTANCE))) {
+              return lType;
             }
-
-            if ((lType == null || lType.isCoercibleTo(PVarchar.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PVarchar.INSTANCE))) {
-                return PVarchar.INSTANCE;
+            if (lType.isCoercibleTo(PVarchar.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PVarchar.INSTANCE))) {
+              return PVarchar.INSTANCE;
             }
-
-            if ((lType == null || lType.isCoercibleTo(PBoolean.INSTANCE))
-                    && (rType == null || rType.isCoercibleTo(PBoolean.INSTANCE))) {
-                return PBoolean.INSTANCE;
+            if (lType.isCoercibleTo(PBoolean.INSTANCE)
+                && (rType == null || rType.isCoercibleTo(PBoolean.INSTANCE))) {
+              return PBoolean.INSTANCE;
             }
-
             return PVarbinary.INSTANCE;
         }
     }