From 5462be928849d6d2f24bfe7bb84edaa4397441c2 Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Fri, 17 Jul 2020 21:55:22 +0300 Subject: [PATCH] Add a shortcut equalSansNullability in case the input types are the same --- .../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 bbad1ca7bcbc..009ef8ff3dff 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 static boolean equalSansNullability( * @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()) {