PHOENIX-4358 Case Sensitive String match on SqlType in PDataType (Dave Angulo)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fb1e8f74 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fb1e8f74 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fb1e8f74 Branch: refs/heads/4.x-cdh5.15 Commit: fb1e8f74fd142b38709b8b08ed7af14d186c1e5f Parents: e8fafd3 Author: Thomas D'Silva <tdsi...@apache.org> Authored: Fri Oct 12 21:46:15 2018 +0100 Committer: Pedro Boado <pbo...@apache.org> Committed: Wed Oct 17 22:50:43 2018 +0100 ---------------------------------------------------------------------- .../main/java/org/apache/phoenix/schema/types/PDataType.java | 2 +- .../java/org/apache/phoenix/schema/types/PDataTypeTest.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fb1e8f74/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java index 1e29d6f..eba6079 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDataType.java @@ -1041,7 +1041,7 @@ public abstract class PDataType<T> implements DataType<T>, Comparable<PDataType< public static PDataType fromSqlTypeName(String sqlTypeName) { for (PDataType t : PDataTypeFactory.getInstance().getTypes()) { - if (t.getSqlTypeName().equals(sqlTypeName)) return t; + if (t.getSqlTypeName().equalsIgnoreCase(sqlTypeName)) return t; } throw newIllegalDataException("Unsupported sql type: " + sqlTypeName); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/fb1e8f74/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java b/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java index 4b02cea..e868f4e 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java @@ -1949,4 +1949,10 @@ public class PDataTypeTest { } } } + + @Test + public void testFromSqlTypeName() { + assertEquals(PVarchar.INSTANCE, PDataType.fromSqlTypeName("varchar")); + } + }