You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by vl...@apache.org on 2020/07/17 18:58:38 UTC

[calcite] 01/02: Add a shortcut equalSansNullability in case the input types are the same

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

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

commit 5462be928849d6d2f24bfe7bb84edaa4397441c2
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Fri Jul 17 21:55:22 2020 +0300

    Add a shortcut equalSansNullability in case the input types are the same
---
 core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
index bbad1ca..009ef8f 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
@@ -1202,6 +1202,9 @@ public abstract class SqlTypeUtil {
    * @return true if the types are equal or the only difference is nullability
    */
   public static boolean equalSansNullability(RelDataType type1, RelDataType type2) {
+    if (type1 == type2) {
+      return true;
+    }
     String x = type1.getFullTypeString();
     String y = type2.getFullTypeString();
     if (x.length() < y.length()) {