Fixed UT for PHOENIX-3346 Hive PhoenixStorageHandler doesn't work well with column
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bf5495e4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bf5495e4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bf5495e4 Branch: refs/heads/4.x-Hbase-0.98 Commit: bf5495e498606d44969b49ef0ccd12c5a76dc075 Parents: 32cbbd0 Author: Sergey Soldatov <s...@apache.org> Authored: Wed Mar 1 15:41:49 2017 -0800 Committer: Sergey Soldatov <s...@apache.org> Committed: Wed Mar 1 16:03:32 2017 -0800 ---------------------------------------------------------------------- .../hive/query/PhoenixQueryBuilderTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bf5495e4/phoenix-hive/src/test/java/org/apache/phoenix/hive/query/PhoenixQueryBuilderTest.java ---------------------------------------------------------------------- diff --git a/phoenix-hive/src/test/java/org/apache/phoenix/hive/query/PhoenixQueryBuilderTest.java b/phoenix-hive/src/test/java/org/apache/phoenix/hive/query/PhoenixQueryBuilderTest.java index e4f872e..bc2cbe3 100644 --- a/phoenix-hive/src/test/java/org/apache/phoenix/hive/query/PhoenixQueryBuilderTest.java +++ b/phoenix-hive/src/test/java/org/apache/phoenix/hive/query/PhoenixQueryBuilderTest.java @@ -102,7 +102,7 @@ public class PhoenixQueryBuilderTest { new Object[]{"CHAR1", "CHAR2", "CHAR3"}, COLUMN_CHAR, "char(10)", true) ); - assertEquals(expectedQueryPrefix + "Column_Char not in ('CHAR1', 'CHAR2', 'CHAR3')", + assertEquals(expectedQueryPrefix + "\"Column_Char\" not in ('CHAR1', 'CHAR2', 'CHAR3')", BUILDER.buildQuery(jobConf, TABLE_NAME, readColumnList, searchConditions)); searchConditions = Lists.newArrayList( @@ -118,7 +118,7 @@ public class PhoenixQueryBuilderTest { new Object[]{"CHAR1", "CHAR2"}, COLUMN_CHAR, "char(10)", true) ); - assertEquals(expectedQueryPrefix + "Column_Char not between 'CHAR1' and 'CHAR2'", + assertEquals(expectedQueryPrefix + "\"Column_Char\" not between 'CHAR1' and 'CHAR2'", BUILDER.buildQuery(jobConf, TABLE_NAME, readColumnList, searchConditions)); } @@ -126,8 +126,8 @@ public class PhoenixQueryBuilderTest { public void testBuildBetweenQueryWithDateColumns() throws IOException { final String COLUMN_DATE = "Column_Date"; final String tableName = "TEST_TABLE"; - final String expectedQueryPrefix = "select /*+ NO_CACHE */ " + COLUMN_DATE + - " from " + tableName + " where "; + final String expectedQueryPrefix = "select /*+ NO_CACHE */ \"" + COLUMN_DATE + + "\" from " + tableName + " where "; JobConf jobConf = new JobConf(); List<String> readColumnList = Lists.newArrayList(COLUMN_DATE); @@ -138,7 +138,7 @@ public class PhoenixQueryBuilderTest { ); assertEquals(expectedQueryPrefix + - COLUMN_DATE + " between to_date('1992-01-02') and to_date('1992-02-02')", + "\"" + COLUMN_DATE + "\" between to_date('1992-01-02') and to_date('1992-02-02')", BUILDER.buildQuery(jobConf, TABLE_NAME, readColumnList, searchConditions)); searchConditions = Lists.newArrayList( @@ -147,7 +147,7 @@ public class PhoenixQueryBuilderTest { ); assertEquals(expectedQueryPrefix + - COLUMN_DATE + " not between to_date('1992-01-02') and to_date('1992-02-02')", + "\"" + COLUMN_DATE + "\" not between to_date('1992-01-02') and to_date('1992-02-02')", BUILDER.buildQuery(jobConf, TABLE_NAME, readColumnList, searchConditions)); } @@ -155,8 +155,8 @@ public class PhoenixQueryBuilderTest { public void testBuildQueryWithNotNull() throws IOException { final String COLUMN_DATE = "Column_Date"; final String tableName = "TEST_TABLE"; - final String expectedQueryPrefix = "select /*+ NO_CACHE */ " + COLUMN_DATE + - " from " + tableName + " where "; + final String expectedQueryPrefix = "select /*+ NO_CACHE */ \"" + COLUMN_DATE + + "\" from " + tableName + " where "; JobConf jobConf = new JobConf(); List<String> readColumnList = Lists.newArrayList(COLUMN_DATE); @@ -167,7 +167,7 @@ public class PhoenixQueryBuilderTest { ); assertEquals(expectedQueryPrefix + - COLUMN_DATE + " is not null ", + "\"" + COLUMN_DATE + "\" is not null ", BUILDER.buildQuery(jobConf, TABLE_NAME, readColumnList, searchConditions)); } }