phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [18/41] PHOENIX-130 Separate execution of slow (integration) tests from fast unit tests (Gabriel Reid)
Date Wed, 12 Mar 2014 21:31:45 GMT
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/CSVCommonsLoaderTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CSVCommonsLoaderTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/CSVCommonsLoaderTest.java
deleted file mode 100644
index 7d4cbff..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CSVCommonsLoaderTest.java
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.StringReader;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.apache.commons.csv.CSVParser;
-import org.apache.commons.csv.CSVRecord;
-import org.apache.phoenix.jdbc.PhoenixConnection;
-import org.apache.phoenix.schema.PArrayDataType;
-import org.apache.phoenix.schema.PDataType;
-import org.apache.phoenix.util.CSVCommonsLoader;
-import org.apache.phoenix.util.DateUtil;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.junit.Test;
-
-public class CSVCommonsLoaderTest extends BaseHBaseManagedTimeTest {
-
-    private static final String DATATYPE_TABLE = "DATATYPE";
-    private static final String DATATYPES_CSV_VALUES = "CKEY, CVARCHAR, CINTEGER, CDECIMAL, CUNSIGNED_INT, CBOOLEAN, CBIGINT, CUNSIGNED_LONG, CTIME, CDATE\n"
-            + "KEY1,A,2147483647,1.1,0,TRUE,9223372036854775807,0,1990-12-31 10:59:59,1999-12-31 23:59:59\n"
-            + "KEY2,B,-2147483648,-1.1,2147483647,FALSE,-9223372036854775808,9223372036854775807,2000-01-01 00:00:01,2012-02-29 23:59:59\n";
-    private static final String STOCK_TABLE = "STOCK_SYMBOL";
-    private static final String STOCK_CSV_VALUES = "AAPL,APPLE Inc.\n"
-            + "CRM,SALESFORCE\n" + "GOOG,Google\n"
-            + "HOG,Harlet-Davidson Inc.\n" + "HPQ,Hewlett Packard\n"
-            + "INTC,Intel\n" + "MSFT,Microsoft\n" + "WAG,Walgreens\n"
-            + "WMT,Walmart\n";
-    private static final String[] STOCK_COLUMNS_WITH_BOGUS = new String[] {
-            "SYMBOL", "BOGUS" };
-    private static final String[] STOCK_COLUMNS = new String[] { "SYMBOL",
-            "COMPANY" };
-    private static final String STOCK_CSV_VALUES_WITH_HEADER = STOCK_COLUMNS[0]
-            + "," + STOCK_COLUMNS[1] + "\n" + STOCK_CSV_VALUES;
-    private static final String STOCK_CSV_VALUES_WITH_DELIMITER = "APPL"
-            + '\u0001' + '\u0002' + "APPLE\n" + " Inc" + '\u0002' + "\n"
-            + "MSFT" + '\u0001' + "Microsoft\n";
-
-    private static final String STOCK_TDV_VALUES = "AAPL\tAPPLE Inc\n"
-            + "CRM\tSALESFORCE\n" + "GOOG\tGoogle\n"
-            + "HOG\tHarlet-Davidson Inc.\n" + "HPQ\tHewlett Packard\n"
-            + "INTC\tIntel\n" + "MSFT\tMicrosoft\n" + "WAG\tWalgreens\n"
-            + "WMT\tWalmart\n";
-    private static final String STOCK_TDV_VALUES_WITH_HEADER = STOCK_COLUMNS[0]
-            + "\t" + STOCK_COLUMNS[1] + "\n" + STOCK_TDV_VALUES;
-
-
-    private static final String ENCAPSULATED_CHARS_TABLE = "ENCAPSULATEDCHAR";
-    private static final String[] ENCAPSULATED_CHARS_COLUMNS = new String[] {
-            "MYKEY", "MYVALUE" };
-    private static final String CSV_VALUES_ENCAPSULATED_CONTROL_CHARS = "ALL THREEF,\"This has a all three , , \"\" \r\n in it. \"\n"
-            + "COMMA,\"This has a comma , in it. \"\n"
-            + "CRLF,\"This has a crlf \r\n in it. \"\n"
-            + "QUOTE,\"This has a quote \"\" in it. \"\n";
-    private static final String CSV_VALUES_ENCAPSULATED_CONTROL_CHARS_WITH_HEADER = ENCAPSULATED_CHARS_COLUMNS[0]
-            + ","
-            + ENCAPSULATED_CHARS_COLUMNS[1]
-            + "\n"
-            + CSV_VALUES_ENCAPSULATED_CONTROL_CHARS;
-    private static final String CSV_VALUES_BAD_ENCAPSULATED_CONTROL_CHARS = "ALL THREEF,\"This has a all three , , \"\" \r\n in it. \"\n"
-            + "COMMA,\"This has a comma , in it. \"\n"
-            + "CRLF,\"This has a crlf \r\n in it. \"\n"
-            + "BADENCAPSULATEDQUOTE,\"\"This has a bad quote in it. \"\n";
-    private static final String CSV_VALUES_BAD_ENCAPSULATED_CONTROL_CHARS_WITH_HEADER = ENCAPSULATED_CHARS_COLUMNS[0]
-            + ","
-            + ENCAPSULATED_CHARS_COLUMNS[1]
-            + "\n"
-            + CSV_VALUES_BAD_ENCAPSULATED_CONTROL_CHARS;
-
-    @Test
-    public void testCSVCommonsUpsert() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl()).unwrap(
-                    PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    Collections.<String> emptyList(), true);
-            csvUtil.upsert(new StringReader(STOCK_CSV_VALUES_WITH_HEADER));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT SYMBOL, COMPANY FROM "
-                            + STOCK_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(
-                    STOCK_CSV_VALUES_WITH_HEADER), csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getString(i + 1));
-                    i++;
-                }
-            }
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testTDVCommonsUpsert() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl()).unwrap(
-                    PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert TDV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,Collections.<String> emptyList()
-                    , true,Arrays.asList("\t", "0", "0"), CSVCommonsLoader.DEFAULT_ARRAY_ELEMENT_SEPARATOR);
-            csvUtil.upsert(new StringReader(STOCK_TDV_VALUES_WITH_HEADER));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT SYMBOL, COMPANY FROM "
-                            + STOCK_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(
-                    STOCK_TDV_VALUES_WITH_HEADER), csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getString(i + 1));
-                    i++;
-                }
-            }
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVUpsertWithCustomDelimiters() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl()).unwrap(
-                    PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    Arrays.<String> asList(STOCK_COLUMNS), true, Arrays.asList(
-                    "1", "2", "3"), CSVCommonsLoader.DEFAULT_ARRAY_ELEMENT_SEPARATOR);
-            csvUtil.upsert(new StringReader(STOCK_CSV_VALUES_WITH_DELIMITER));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT SYMBOL, COMPANY FROM "
-                            + STOCK_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(
-                    STOCK_CSV_VALUES_WITH_DELIMITER), csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getString(i + 1));
-                    i++;
-                }
-            }
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVUpsertWithColumns() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    Arrays.<String> asList(STOCK_COLUMNS), true);
-            // no header
-            csvUtil.upsert(new StringReader(STOCK_CSV_VALUES));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT SYMBOL, COMPANY FROM "
-                            + STOCK_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(
-                    STOCK_CSV_VALUES), csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getString(i + 1));
-                    i++;
-                }
-            }
-
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVUpsertWithNoColumns() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    null, true);
-            csvUtil.upsert(new StringReader(STOCK_CSV_VALUES));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT SYMBOL, COMPANY FROM "
-                            + STOCK_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(
-                    STOCK_CSV_VALUES), csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getString(i + 1));
-                    i++;
-                }
-            }
-
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVUpsertWithBogusColumn() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file, not strict
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    Arrays.asList(STOCK_COLUMNS_WITH_BOGUS), false);
-            csvUtil.upsert(new StringReader(STOCK_CSV_VALUES));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT SYMBOL, COMPANY FROM "
-                            + STOCK_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(STOCK_CSV_VALUES),
-                    csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                assertEquals(record.get(0), phoenixResultSet.getString(1));
-                assertNull(phoenixResultSet.getString(2));
-            }
-
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVUpsertWithAllColumn() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    Arrays.asList("FOO", "BAR"), false);
-
-            try {
-                csvUtil.upsert(new StringReader(STOCK_CSV_VALUES));
-                fail();
-            } catch (SQLException e) {
-                assertTrue(
-                        e.getMessage(),
-                        e.getMessage()
-                                .contains(
-                                        "ERROR 504 (42703): Undefined column. columnName=STOCK_SYMBOL.[FOO, BAR]"));
-            }
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVUpsertWithBogusColumnStrict() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS " + STOCK_TABLE
-                    + "(SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, STOCK_TABLE,
-                    Arrays.asList(STOCK_COLUMNS_WITH_BOGUS), true);
-            try {
-                csvUtil.upsert(new StringReader(STOCK_CSV_VALUES));
-                fail();
-            } catch (SQLException e) {
-                assertTrue(
-                        e.getMessage(),
-                        e.getMessage()
-                                .contains(
-                                        "ERROR 504 (42703): Undefined column. columnName=STOCK_SYMBOL.BOGUS"));
-            }
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testAllDatatypes() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS "
-                    + DATATYPE_TABLE
-                    + " (CKEY VARCHAR NOT NULL PRIMARY KEY,"
-                    + "  CVARCHAR VARCHAR, CINTEGER INTEGER, CDECIMAL DECIMAL(31,10), CUNSIGNED_INT UNSIGNED_INT, CBOOLEAN BOOLEAN, CBIGINT BIGINT, CUNSIGNED_LONG UNSIGNED_LONG, CTIME TIME, CDATE DATE);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn,
-                    DATATYPE_TABLE, Collections.<String> emptyList(), true);
-            csvUtil.upsert(new StringReader(DATATYPES_CSV_VALUES));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT CKEY, CVARCHAR, CINTEGER, CDECIMAL, CUNSIGNED_INT, CBOOLEAN, CBIGINT, CUNSIGNED_LONG, CTIME, CDATE FROM "
-                            + DATATYPE_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(DATATYPES_CSV_VALUES),
-                    csvUtil.getFormat());
-
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                int size = record.size();
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getObject(i + 1)
-                            .toString().toUpperCase());
-                    if (i < size - 2)
-                        break;
-                    i++;
-                }
-                // special case for matching date, time values
-                assertEquals(DateUtil.parseTime(record.get(8)),
-                        phoenixResultSet.getTime("CTIME"));
-                assertEquals(DateUtil.parseDate(record.get(9)),
-                        phoenixResultSet.getDate("CDATE"));
-            }
-
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVCommonsUpsertEncapsulatedControlChars() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS "
-                    + ENCAPSULATED_CHARS_TABLE
-                    + "(MYKEY VARCHAR NOT NULL PRIMARY KEY, MYVALUE VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn,
-                    ENCAPSULATED_CHARS_TABLE, Collections.<String> emptyList(),
-                    true);
-            csvUtil.upsert(new StringReader(
-                    CSV_VALUES_ENCAPSULATED_CONTROL_CHARS_WITH_HEADER));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT MYKEY, MYVALUE FROM "
-                            + ENCAPSULATED_CHARS_TABLE);
-            ResultSet phoenixResultSet = statement.executeQuery();
-            parser = new CSVParser(new StringReader(
-                    CSV_VALUES_ENCAPSULATED_CONTROL_CHARS_WITH_HEADER),
-                    csvUtil.getFormat());
-            for (CSVRecord record : parser) {
-                assertTrue(phoenixResultSet.next());
-                int i = 0;
-                for (String value : record) {
-                    assertEquals(value, phoenixResultSet.getString(i + 1));
-                    i++;
-                }
-            }
-
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVCommonsUpsertBadEncapsulatedControlChars()
-            throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS "
-                    + ENCAPSULATED_CHARS_TABLE
-                    + "(MYKEY VARCHAR NOT NULL PRIMARY KEY, MYVALUE VARCHAR);";
-            conn = DriverManager.getConnection(getUrl())
-                    .unwrap(PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn,
-                    ENCAPSULATED_CHARS_TABLE, Collections.<String> emptyList(),
-                    true);
-            try {
-                csvUtil.upsert(new StringReader(
-                        CSV_VALUES_BAD_ENCAPSULATED_CONTROL_CHARS_WITH_HEADER));
-                fail();
-            } catch (RuntimeException e) {
-                assertTrue(
-                        e.getMessage(),
-                        e.getMessage()
-                                .contains(
-                                        "invalid char between encapsulated token and delimiter"));
-            }
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-    @Test
-    public void testCSVCommonsUpsert_WithArray() throws Exception {
-        CSVParser parser = null;
-        PhoenixConnection conn = null;
-        try {
-
-            // Create table
-            String statements = "CREATE TABLE IF NOT EXISTS ARRAY_TABLE "
-                    + "(ID BIGINT NOT NULL PRIMARY KEY, VALARRAY INTEGER ARRAY);";
-            conn = DriverManager.getConnection(getUrl()).unwrap(
-                    PhoenixConnection.class);
-            PhoenixRuntime.executeStatements(conn,
-                    new StringReader(statements), null);
-
-            // Upsert CSV file
-            CSVCommonsLoader csvUtil = new CSVCommonsLoader(conn, "ARRAY_TABLE",
-                    Collections.<String> emptyList(), true, null, "!");
-            csvUtil.upsert(
-                    new StringReader("ID,VALARRAY\n"
-                            + "1,2!3!4\n"));
-
-            // Compare Phoenix ResultSet with CSV file content
-            PreparedStatement statement = conn
-                    .prepareStatement("SELECT ID, VALARRAY FROM ARRAY_TABLE");
-            ResultSet phoenixResultSet = statement.executeQuery();
-            assertTrue(phoenixResultSet.next());
-            assertEquals(1L, phoenixResultSet.getLong(1));
-            assertEquals(
-                    PArrayDataType.instantiatePhoenixArray(PDataType.INTEGER, new Integer[]{2, 3, 4}),
-                    phoenixResultSet.getArray(2));
-            assertFalse(phoenixResultSet.next());
-        } finally {
-            if (parser != null)
-                parser.close();
-            if (conn != null)
-                conn.close();
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/CoalesceFunctionTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CoalesceFunctionTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/CoalesceFunctionTest.java
deleted file mode 100644
index 6bb5d69..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CoalesceFunctionTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.TestUtil.*;
-import static org.junit.Assert.*;
-
-import java.sql.*;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import org.apache.phoenix.util.PhoenixRuntime;
-
-
-public class CoalesceFunctionTest extends BaseClientManagedTimeTest {
-    @Test
-    public void testCoalesce() throws Exception {
-        long ts = nextTimestamp();
-        String tenantId = getOrganizationId();
-        initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 1)); // Execute at timestamp 1
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        String query = "SELECT entity_id, a_integer + COALESCE(x_integer,1) FROM ATABLE WHERE organization_id = ? AND a_integer >= 6 AND a_integer <= 7";
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.setString(1, tenantId);
-        ResultSet rs = statement.executeQuery();
-        
-        assertTrue (rs.next());
-        assertEquals(ROW6, rs.getString(1));
-        assertEquals(7, rs.getInt(2));
-        
-        assertTrue (rs.next());
-        assertEquals(ROW7, rs.getString(1));
-        assertEquals(12, rs.getInt(2));
-        
-        assertFalse(rs.next());
-        conn.close();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationTest.java
deleted file mode 100644
index e6aa02f..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/ColumnProjectionOptimizationTest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.TestUtil.*;
-import static org.junit.Assert.*;
-
-import java.sql.*;
-import java.util.Properties;
-
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.client.*;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.jdbc.PhoenixConnection;
-import org.apache.phoenix.schema.PDataType;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.apache.phoenix.util.SchemaUtil;
-import org.junit.Test;
-
-public class ColumnProjectionOptimizationTest extends BaseClientManagedTimeTest {
-
-    @Test
-    public void testSelect() throws Exception {
-        long ts = nextTimestamp();
-        String tenantId = getOrganizationId();
-        initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
-
-        Properties props = new Properties(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2));
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-
-        // Table wildcard query
-        String query = "SELECT * FROM aTable";
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(ROW1, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW2, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW3, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW4, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW5, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW6, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW7, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW8, rs.getString(2));
-            assertTrue(rs.next());
-            assertEquals(ROW9, rs.getString(2));
-            assertFalse(rs.next());
-
-            // Select only specific columns
-            query = "SELECT A_STRING, A_INTEGER FROM aTable";
-            statement = conn.prepareStatement(query);
-            rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(A_VALUE, rs.getString(1));
-            assertEquals(1, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(A_VALUE, rs.getString(1));
-            assertEquals(2, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(A_VALUE, rs.getString(1));
-            assertEquals(3, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(A_VALUE, rs.getString(1));
-            assertEquals(4, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(B_VALUE, rs.getString(1));
-            assertEquals(5, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(B_VALUE, rs.getString(1));
-            assertEquals(6, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(B_VALUE, rs.getString(1));
-            assertEquals(7, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(B_VALUE, rs.getString(1));
-            assertEquals(8, rs.getInt(2));
-            assertTrue(rs.next());
-            assertEquals(C_VALUE, rs.getString(1));
-            assertEquals(9, rs.getInt(2));
-            assertFalse(rs.next());
-
-            // Select only specific columns with condition on another column (Not in select)
-            query = "SELECT B_STRING, A_SHORT FROM aTable WHERE X_INTEGER = ?";
-            statement = conn.prepareStatement(query);
-            statement.setInt(1, 4);
-            rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(C_VALUE, rs.getString(1));
-            assertEquals(135, rs.getShort(2));
-            assertFalse(rs.next());
-
-            // Select only specific columns with condition on another column (Not in select) and one row elements are
-            // nulls
-            query = "SELECT X_LONG, X_INTEGER, Y_INTEGER FROM aTable WHERE B_STRING = ?";
-            statement = conn.prepareStatement(query);
-            statement.setString(1, E_VALUE);
-            rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(0, rs.getLong(1));
-            assertTrue(rs.wasNull());
-            assertEquals(0, rs.getInt(2));
-            assertTrue(rs.wasNull());
-            assertEquals(0, rs.getInt(3));
-            assertTrue(rs.wasNull());
-            assertTrue(rs.next());
-            assertEquals(0, rs.getLong(1));
-            assertTrue(rs.wasNull());
-            assertEquals(0, rs.getInt(2));
-            assertTrue(rs.wasNull());
-            assertEquals(0, rs.getInt(3));
-            assertTrue(rs.wasNull());
-            assertTrue(rs.next());
-            assertEquals(Integer.MAX_VALUE + 1L, rs.getLong(1));
-            assertEquals(3, rs.getInt(2));
-            assertEquals(300, rs.getInt(3));
-            assertFalse(rs.next());
-
-            // Select only specific columns with condition on one of the selected column
-            query = "SELECT A_STRING, A_INTEGER FROM aTable WHERE A_INTEGER = ?";
-            statement = conn.prepareStatement(query);
-            statement.setInt(1, 9);
-            rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(C_VALUE, rs.getString(1));
-            assertEquals(9, rs.getInt(2));
-        } finally {
-            conn.close();
-        }
-    }
-
-    @Test
-    public void testSelectFromViewOnExistingTable() throws Exception {
-        PhoenixConnection pconn = DriverManager.getConnection(PHOENIX_JDBC_URL, TEST_PROPERTIES).unwrap(
-                PhoenixConnection.class);
-        byte[] cfB = Bytes.toBytes(SchemaUtil.normalizeIdentifier("b"));
-        byte[] cfC = Bytes.toBytes(SchemaUtil.normalizeIdentifier("c"));
-        byte[][] familyNames = new byte[][] { cfB, cfC };
-        byte[] htableName = SchemaUtil.getTableNameAsBytes(MDTEST_SCHEMA_NAME, MDTEST_NAME);
-        HBaseAdmin admin = pconn.getQueryServices().getAdmin();
-
-        HTableDescriptor descriptor = new HTableDescriptor(htableName);
-        for (byte[] familyName : familyNames) {
-            HColumnDescriptor columnDescriptor = new HColumnDescriptor(familyName);
-            descriptor.addFamily(columnDescriptor);
-        }
-        admin.createTable(descriptor);
-
-        long ts = nextTimestamp();
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5));
-        Connection conn1 = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-
-        String createStmt = "create view " + MDTEST_NAME + " (id integer not null primary key,"
-                + " b.col1 integer, c.col2 bigint, c.col3 varchar(20))";
-        conn1.createStatement().execute(createStmt);
-        conn1.close();
-
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 6));
-        PhoenixConnection conn2 = DriverManager.getConnection(PHOENIX_JDBC_URL, props).unwrap(PhoenixConnection.class);
-        byte[] c1 = Bytes.toBytes("COL1");
-        byte[] c2 = Bytes.toBytes("COL2");
-        byte[] c3 = Bytes.toBytes("COL3");
-        HTableInterface htable = null;
-        try {
-            htable = conn2.getQueryServices().getTable(htableName);
-            Put put = new Put(PDataType.INTEGER.toBytes(1));
-            put.add(cfB, c1, ts + 6, PDataType.INTEGER.toBytes(1));
-            put.add(cfC, c2, ts + 6, PDataType.LONG.toBytes(2));
-            htable.put(put);
-
-            put = new Put(PDataType.INTEGER.toBytes(2));
-            put.add(cfC, c2, ts + 6, PDataType.LONG.toBytes(10));
-            put.add(cfC, c3, ts + 6, PDataType.VARCHAR.toBytes("abcd"));
-            htable.put(put);
-
-            put = new Put(PDataType.INTEGER.toBytes(3));
-            put.add(cfB, c1, ts + 6, PDataType.INTEGER.toBytes(3));
-            put.add(cfC, c2, ts + 6, PDataType.LONG.toBytes(10));
-            put.add(cfC, c3, ts + 6, PDataType.VARCHAR.toBytes("abcd"));
-            htable.put(put);
-
-            conn2.close();
-
-            props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10));
-            Connection conn7 = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-            String select = "SELECT id, b.col1 FROM " + MDTEST_NAME + " WHERE c.col2=?";
-            PreparedStatement ps = conn7.prepareStatement(select);
-            ps.setInt(1, 10);
-            ResultSet rs = ps.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(2, rs.getInt(1));
-            assertEquals(0, rs.getInt(2));
-            assertTrue(rs.wasNull());
-            assertTrue(rs.next());
-            assertEquals(3, rs.getInt(1));
-            assertEquals(3, rs.getInt(2));
-            assertFalse(rs.next());
-
-            // Select contains only CF wildcards
-            select = "SELECT b.* FROM " + MDTEST_NAME + " WHERE c.col2=?";
-            ps = conn7.prepareStatement(select);
-            ps.setInt(1, 10);
-            rs = ps.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(0, rs.getInt(1));
-            assertTrue(rs.wasNull());
-            assertTrue(rs.next());
-            assertEquals(3, rs.getInt(1));
-            assertFalse(rs.next());
-
-            select = "SELECT b.* FROM " + MDTEST_NAME;
-            ps = conn7.prepareStatement(select);
-            rs = ps.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(1, rs.getInt(1));
-            assertTrue(rs.next());
-            assertEquals(0, rs.getInt(1));
-            assertTrue(rs.wasNull());
-            assertTrue(rs.next());
-            assertEquals(3, rs.getInt(1));
-            assertFalse(rs.next());
-        } finally {
-            if (htable != null) htable.close();
-            admin.disableTable(htableName);
-            admin.deleteTable(htableName);
-            admin.close();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/CompareDecimalToLongTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CompareDecimalToLongTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/CompareDecimalToLongTest.java
deleted file mode 100644
index 50d30a7..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CompareDecimalToLongTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.TestUtil.PHOENIX_JDBC_URL;
-import static org.junit.Assert.*;
-
-import java.sql.*;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import org.apache.phoenix.util.PhoenixRuntime;
-
-
-public class CompareDecimalToLongTest extends BaseClientManagedTimeTest {
-    protected static void initTableValues(byte[][] splits, long ts) throws Exception {
-        ensureTableCreated(getUrl(),"LongInKeyTest",splits, ts-2);
-        
-        // Insert all rows at ts
-        String url = PHOENIX_JDBC_URL + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts;
-        Connection conn = DriverManager.getConnection(url);
-        conn.setAutoCommit(true);
-        PreparedStatement stmt = conn.prepareStatement(
-                "upsert into " +
-                "LongInKeyTest VALUES(?)");
-        stmt.setLong(1, 2);
-        stmt.execute();
-        conn.close();
-    }
-
-    @Test
-    public void testCompareLongGTDecimal() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l > 1.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            assertTrue (rs.next());
-            assertEquals(2, rs.getLong(1));
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    
-    @Test
-    public void testCompareLongGTEDecimal() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l >= 1.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertTrue (rs.next());
-            assertEquals(2, rs.getLong(1));
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    
-    @Test
-    public void testCompareLongLTDecimal() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l < 1.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-
-    @Test
-    public void testCompareLongLTEDecimal() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l <= 1.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    @Test
-    public void testCompareLongGTDecimal2() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l > 2.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    
-    @Test
-    public void testCompareLongGTEDecimal2() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l >= 2.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    
-    @Test
-    public void testCompareLongLTDecimal2() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l < 2.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertTrue (rs.next());
-            assertEquals(2, rs.getLong(1));
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-
-    @Test
-    public void testCompareLongLTEDecimal2() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(null, ts);
-        String query = "SELECT l FROM LongInKeyTest where l <= 2.5";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs = statement.executeQuery();
-            /*
-             *  Failing because we're not converting the constant to the type of the RHS
-             *  when forming the start/stop key.
-             *  For this case, 1.5 -> 1L
-             *  if where l < 1.5 then 1.5 -> 1L and then to 2L because it's not inclusive
-             *  
-             */
-            assertTrue (rs.next());
-            assertEquals(2, rs.getLong(1));
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
deleted file mode 100644
index 32619f7..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import java.sql.SQLException;
-import java.util.Properties;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.IntegrationTestingUtility;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
-import org.apache.phoenix.query.ConnectionQueryServicesImpl;
-import org.apache.phoenix.query.QueryServices;
-
-
-/**
- * 
- * Implementation of ConnectionQueryServices for tests running against
- * the mini cluster
- *
- * 
- * @since 0.1
- */
-public class ConnectionQueryServicesTestImpl extends ConnectionQueryServicesImpl {
-    protected int NUM_SLAVES_BASE = 1; // number of slaves for the cluster
-    
-    private HBaseTestingUtility util;
-
-    public ConnectionQueryServicesTestImpl(QueryServices services, ConnectionInfo info) throws SQLException {
-        super(services, info);
-    }
-
-    private Configuration setupServer(Configuration config) throws Exception {
-        // The HBaseTestingUtility has some kind of memory leak in HBase 0.94.15+ on the Mac
-        // so the pom will use 0.94.14 until this gets fixed.
-        if(isDistributedCluster(config)){
-            IntegrationTestingUtility util =  new IntegrationTestingUtility(config);
-            util.initializeCluster(this.NUM_SLAVES_BASE);
-            this.util = util;
-        } else {
-            util = new HBaseTestingUtility(config);
-            util.startMiniCluster();
-        }
-        return util.getConfiguration();
-    }
-    
-    public boolean isDistributedCluster(Configuration conf) {
-        boolean isDistributedCluster = false;
-        isDistributedCluster = Boolean.parseBoolean(System.getProperty(IntegrationTestingUtility.IS_DISTRIBUTED_CLUSTER, "false"));
-        if (!isDistributedCluster) {
-          isDistributedCluster = conf.getBoolean(IntegrationTestingUtility.IS_DISTRIBUTED_CLUSTER, false);
-        }
-        return isDistributedCluster;
-    }
-    
-    private void teardownServer() throws Exception {
-        if(isDistributedCluster(util.getConfiguration())){
-            // remove all hbase tables
-            HBaseAdmin admin = util.getHBaseAdmin();
-            HTableDescriptor[] tables = admin.listTables();
-            for(HTableDescriptor table : tables){
-                util.deleteTable(table.getName());
-            }
-        } else {
-            util.shutdownMiniCluster();
-        }
-    }
-    
-    @Override
-    public void init(String url, Properties props) throws SQLException {
-        try {
-            setupServer(config);
-            super.init(url, props);
-            /**
-             * Clear the server-side meta data cache on initialization. Otherwise, if we
-             * query for meta data tables, we'll get nothing (since the server just came
-             * up). However, our server-side cache (which is a singleton) will claim
-             * that we do have tables and our create table calls will return the cached
-             * meta data instead of creating new metadata.
-             */
-            clearCache();
-        } catch (SQLException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new SQLException(e);
-        }
-    }
-
-        @Override
-    public void close() throws SQLException {
-        SQLException sqlE = null;
-        try {
-            try {
-                // Attempt to fix apparent memory leak...
-                clearCache();
-            } finally {
-                super.close();
-            }
-        } catch (SQLException e)  {
-            sqlE = e;
-        } finally {
-            try {
-                teardownServer();
-            } catch (Exception e) {
-                if (sqlE == null) {
-                    sqlE = new SQLException(e);
-                } else {
-                    sqlE.setNextException(new SQLException(e));
-                }
-            } finally {
-                if (sqlE != null) {
-                    throw sqlE;
-                }
-            }
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/CreateTableTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CreateTableTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/CreateTableTest.java
deleted file mode 100644
index 50e3b76..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CreateTableTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import org.apache.phoenix.jdbc.PhoenixStatement;
-import org.apache.phoenix.query.KeyRange;
-import org.apache.phoenix.schema.TableAlreadyExistsException;
-import org.apache.phoenix.util.PhoenixRuntime;
-
-public class CreateTableTest  extends BaseClientManagedTimeTest {
-    
-    @Test
-    public void testStartKeyStopKey() throws SQLException {
-        long ts = nextTimestamp();
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        conn.createStatement().execute("CREATE TABLE start_stop_test (pk char(2) not null primary key) SPLIT ON ('EA','EZ')");
-        conn.close();
-        
-        String query = "select count(*) from start_stop_test where pk >= 'EA' and pk < 'EZ'";
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2));
-        conn = DriverManager.getConnection(getUrl(), props);
-        Statement statement = conn.createStatement();
-        statement.execute(query);
-        PhoenixStatement pstatement = statement.unwrap(PhoenixStatement.class);
-        List<KeyRange>splits = pstatement.getQueryPlan().getSplits();
-        assertTrue(splits.size() > 0);
-    }
-    
-    @Test
-    public void testCreateTable() throws Exception {
-        long ts = nextTimestamp();
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts));
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        String ddl = "CREATE TABLE m_interface_job(                data.addtime VARCHAR ,\n" + 
-                "                data.dir VARCHAR ,\n" + 
-                "                data.end_time VARCHAR ,\n" + 
-                "                data.file VARCHAR ,\n" + 
-                "                data.fk_log VARCHAR ,\n" + 
-                "                data.host VARCHAR ,\n" + 
-                "                data.row VARCHAR ,\n" + 
-                "                data.size VARCHAR ,\n" + 
-                "                data.start_time VARCHAR ,\n" + 
-                "                data.stat_date DATE ,\n" + 
-                "                data.stat_hour VARCHAR ,\n" + 
-                "                data.stat_minute VARCHAR ,\n" + 
-                "                data.state VARCHAR ,\n" + 
-                "                data.title VARCHAR ,\n" + 
-                "                data.user VARCHAR ,\n" + 
-                "                data.inrow VARCHAR ,\n" + 
-                "                data.jobid VARCHAR ,\n" + 
-                "                data.jobtype VARCHAR ,\n" + 
-                "                data.level VARCHAR ,\n" + 
-                "                data.msg VARCHAR ,\n" + 
-                "                data.outrow VARCHAR ,\n" + 
-                "                data.pass_time VARCHAR ,\n" + 
-                "                data.type VARCHAR ,\n" + 
-                "                id INTEGER not null primary key desc\n" + 
-                "                ) ";
-        conn.createStatement().execute(ddl);
-        conn = DriverManager.getConnection(getUrl(), props);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10));
-        try {
-            conn.createStatement().execute(ddl);
-            fail();
-        } catch (TableAlreadyExistsException e) {
-            // expected
-        }
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20));
-        conn = DriverManager.getConnection(getUrl(), props);
-        conn.createStatement().execute("DROP TABLE m_interface_job");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/CustomEntityDataTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CustomEntityDataTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/CustomEntityDataTest.java
deleted file mode 100644
index 4aadb9e..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/CustomEntityDataTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.TestUtil.*;
-import static org.junit.Assert.*;
-
-import java.math.BigDecimal;
-import java.sql.*;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import org.apache.phoenix.util.PhoenixRuntime;
-
-
-
-public class CustomEntityDataTest extends BaseClientManagedTimeTest {
-    
-    protected static void initTableValues(String tenantId, byte[][] splits, long ts) throws Exception {
-        ensureTableCreated(getUrl(),CUSTOM_ENTITY_DATA_FULL_NAME,null, ts-2);
-            
-        String url = PHOENIX_JDBC_URL + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts;
-        Properties props = new Properties(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
-        // Insert all rows at ts
-        PreparedStatement stmt = conn.prepareStatement(
-                "upsert into " +
-                "CORE.CUSTOM_ENTITY_DATA(" +
-                "    ORGANIZATION_ID, " +
-                "    KEY_PREFIX, " +
-                "    CUSTOM_ENTITY_DATA_ID, " +
-                "    CREATED_BY, " +
-                "    CREATED_DATE, " +
-                "    CURRENCY_ISO_CODE, " +
-                "    DELETED, " +
-                "    DIVISION, " +
-                "    LAST_UPDATE, " +
-                "    LAST_UPDATE_BY," +
-                "    NAME," +
-                "    OWNER," +
-                "    SYSTEM_MODSTAMP," +
-                "    VAL0," +
-                "    VAL1," +
-                "    VAL2," +
-                "    VAL3," +
-                "    VAL4," +
-                "    VAL5," +
-                "    VAL6," +
-                "    VAL7," +
-                "    VAL8," +
-                "    VAL9)" +
-                "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
-            
-        // Insert all rows at ts
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW2.substring(0,3));
-        stmt.setString(3, ROW2.substring(3));
-        stmt.setString(4, "Curly");
-        stmt.setDate(5, new Date(1));
-        stmt.setString(6, "ISO");
-        stmt.setString(7, "0");
-        stmt.setBigDecimal(8, new BigDecimal(1));
-        stmt.setDate(9, new Date(2));
-        stmt.setString(10, "Curly");
-        stmt.setString(11, "Curly");
-        stmt.setString(12, "Curly");
-        stmt.setDate(13, new Date(2));
-        stmt.setString(14, "2");
-        stmt.setString(15, "2");
-        stmt.setString(16, "2");
-        stmt.setString(17, "2");
-        stmt.setString(18, "2");
-        stmt.setString(19, "2");
-        stmt.setString(20, "2");
-        stmt.setString(21, "2");
-        stmt.setString(22, "2");
-        stmt.setString(23, "2");
-        stmt.execute();
-
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW5.substring(0,3));
-        stmt.setString(3, ROW5.substring(3));
-        stmt.setString(4, "Moe");
-        stmt.setDate(5, new Date(1));
-        stmt.setString(6, "ISO");
-        stmt.setString(7, "0");
-        stmt.setBigDecimal(8, new BigDecimal(1));
-        stmt.setDate(9, new Date(2));
-        stmt.setString(10, "Moe");
-        stmt.setString(11, "Moe");
-        stmt.setString(12, "Moe");
-        stmt.setDate(13, new Date(2));
-        stmt.setString(14, "5");
-        stmt.setString(15, "5");
-        stmt.setString(16, "5");
-        stmt.setString(17, "5");
-        stmt.setString(18, "5");
-        stmt.setString(19, "5");
-        stmt.setString(20, "5");
-        stmt.setString(21, "5");
-        stmt.setString(22, "5");
-        stmt.setString(23, "5");
-        stmt.execute();
-
-        stmt.setString(1, tenantId);
-        stmt.setString(2, ROW9.substring(0,3));
-        stmt.setString(3, ROW9.substring(3));
-        stmt.setString(4, "Larry");
-        stmt.setDate(5, new Date(1));
-        stmt.setString(6, "ISO");
-        stmt.setString(7, "0");
-        stmt.setBigDecimal(8, new BigDecimal(1));
-        stmt.setDate(9, new Date(2));
-        stmt.setString(10, "Larry");
-        stmt.setString(11, "Larry");
-        stmt.setString(12, "Larry");
-        stmt.setDate(13, new Date(2));
-        stmt.setString(14, "v9");
-        stmt.setString(15, "v9");
-        stmt.setString(16, "v9");
-        stmt.setString(17, "v9");
-        stmt.setString(18, "v9");
-        stmt.setString(19, "v9");
-        stmt.setString(20, "v9");
-        stmt.setString(21, "v9");
-        stmt.setString(22, "v9");
-        stmt.setString(23, "v9");
-        stmt.execute();
-        
-        conn.commit();
-        conn.close();
-    }    
-
-    @Test
-    public void testUngroupedAggregation() throws Exception {
-        long ts = nextTimestamp();
-        String tenantId = getOrganizationId();
-        String query = "SELECT count(1) FROM CORE.CUSTOM_ENTITY_DATA WHERE organization_id=?";
-        String url = PHOENIX_JDBC_URL + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5
-        Connection conn = DriverManager.getConnection(url, TEST_PROPERTIES);
-        try {
-            initTableValues(tenantId, getDefaultSplits(getOrganizationId()), ts);
-            PreparedStatement statement = conn.prepareStatement(query);
-            statement.setString(1, tenantId);
-            ResultSet rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals(3, rs.getLong(1));
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    
-    @Test
-    public void testScan() throws Exception {
-        long ts = nextTimestamp();
-        String tenantId = getOrganizationId();
-        String query = "SELECT CREATED_BY,CREATED_DATE,CURRENCY_ISO_CODE,DELETED,DIVISION,LAST_UPDATE,LAST_UPDATE_BY,NAME,OWNER,SYSTEM_MODSTAMP,VAL0,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9 FROM CORE.CUSTOM_ENTITY_DATA WHERE organization_id=?";
-        String url = PHOENIX_JDBC_URL + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5
-        Connection conn = DriverManager.getConnection(url, TEST_PROPERTIES);
-        try {
-            initTableValues(tenantId, getDefaultSplits(getOrganizationId()), ts);
-            PreparedStatement statement = conn.prepareStatement(query);
-            statement.setString(1, tenantId);
-            ResultSet rs = statement.executeQuery();
-            assertTrue(rs.next());
-            assertEquals("Curly", rs.getString(1));
-            assertTrue(rs.next());
-            assertEquals("Moe", rs.getString(1));
-            assertTrue(rs.next());
-            assertEquals("Larry", rs.getString(1));
-            assertFalse(rs.next());
-        } finally {
-            conn.close();
-        }
-    }
-    
-    @Test
-    public void testWhereStringConcatExpression() throws Exception {
-        long ts = nextTimestamp();
-        String tenantId = getOrganizationId();
-        initTableValues(tenantId, getDefaultSplits(getOrganizationId()), ts);
-        String query = "SELECT KEY_PREFIX||CUSTOM_ENTITY_DATA_ID FROM CORE.CUSTOM_ENTITY_DATA where '00A'||val0 LIKE '00A2%'";
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
-        try {
-            PreparedStatement statement = conn.prepareStatement(query);
-            ResultSet rs=statement.executeQuery();
-            assertTrue (rs.next());
-            assertEquals(ROW2, rs.getString(1));
-            assertFalse(rs.next());
-        }
-        finally {
-            conn.close();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/8d6e2a58/phoenix-core/src/test/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterTest.java b/phoenix-core/src/test/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterTest.java
deleted file mode 100644
index 870fef3..0000000
--- a/phoenix-core/src/test/java/org/apache/phoenix/end2end/DefaultParallelIteratorsRegionSplitterTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.junit.Assert.assertEquals;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionLocation;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.compile.StatementContext;
-import org.apache.phoenix.iterate.DefaultParallelIteratorRegionSplitter;
-import org.apache.phoenix.jdbc.PhoenixConnection;
-import org.apache.phoenix.jdbc.PhoenixStatement;
-import org.apache.phoenix.parse.HintNode;
-import org.apache.phoenix.query.ConnectionQueryServices;
-import org.apache.phoenix.query.KeyRange;
-import org.apache.phoenix.schema.PDataType;
-import org.apache.phoenix.schema.TableRef;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.junit.Test;
-
-
-/**
- * Tests for {@link DefaultParallelIteratorRegionSplitter}.
- * 
- * 
- * @since 0.1
- */
-public class DefaultParallelIteratorsRegionSplitterTest extends BaseParallelIteratorsRegionSplitterTest {
-    
-    private static List<KeyRange> getSplits(Connection conn, long ts, final Scan scan)
-            throws SQLException {
-        TableRef tableRef = getTableRef(conn, ts);
-        PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
-        final List<HRegionLocation> regions =  pconn.getQueryServices().getAllTableRegions(tableRef.getTable().getPhysicalName().getBytes());
-        StatementContext context = new StatementContext(new PhoenixStatement(pconn), null, scan);
-        DefaultParallelIteratorRegionSplitter splitter = new DefaultParallelIteratorRegionSplitter(context, tableRef, HintNode.EMPTY_HINT_NODE) {
-            @Override
-            protected List<HRegionLocation> getAllRegions() throws SQLException {
-                return DefaultParallelIteratorRegionSplitter.filterRegions(regions, scan.getStartRow(), scan.getStopRow());
-            }
-        };
-        List<KeyRange> keyRanges = splitter.getSplits();
-        Collections.sort(keyRanges, new Comparator<KeyRange>() {
-            @Override
-            public int compare(KeyRange o1, KeyRange o2) {
-                return Bytes.compareTo(o1.getLowerRange(),o2.getLowerRange());
-            }
-        });
-        return keyRanges;
-    }
-
-    @Test
-    public void testGetSplits() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(ts);
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts;
-        Properties props = new Properties(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
-
-        Scan scan = new Scan();
-        
-        // number of regions > target query concurrency
-        scan.setStartRow(K1);
-        scan.setStopRow(K12);
-        List<KeyRange> keyRanges = getSplits(conn, ts, scan);
-        assertEquals("Unexpected number of splits: " + keyRanges, 5, keyRanges.size());
-        assertEquals(newKeyRange(KeyRange.UNBOUND, K3), keyRanges.get(0));
-        assertEquals(newKeyRange(K3, K4), keyRanges.get(1));
-        assertEquals(newKeyRange(K4, K9), keyRanges.get(2));
-        assertEquals(newKeyRange(K9, K11), keyRanges.get(3));
-        assertEquals(newKeyRange(K11, KeyRange.UNBOUND), keyRanges.get(4));
-        
-        // (number of regions / 2) > target query concurrency
-        scan.setStartRow(K3);
-        scan.setStopRow(K6);
-        keyRanges = getSplits(conn, ts, scan);
-        assertEquals("Unexpected number of splits: " + keyRanges, 3, keyRanges.size());
-        // note that we get a single split from R2 due to small key space
-        assertEquals(newKeyRange(K3, K4), keyRanges.get(0));
-        assertEquals(newKeyRange(K4, K6), keyRanges.get(1));
-        assertEquals(newKeyRange(K6, K9), keyRanges.get(2));
-        
-        // (number of regions / 2) <= target query concurrency
-        scan.setStartRow(K5);
-        scan.setStopRow(K6);
-        keyRanges = getSplits(conn, ts, scan);
-        assertEquals("Unexpected number of splits: " + keyRanges, 3, keyRanges.size());
-        assertEquals(newKeyRange(K4, K5), keyRanges.get(0));
-        assertEquals(newKeyRange(K5, K6), keyRanges.get(1));
-        assertEquals(newKeyRange(K6, K9), keyRanges.get(2));
-        conn.close();
-    }
-
-    @Test
-    public void testGetLowerUnboundSplits() throws Exception {
-        long ts = nextTimestamp();
-        initTableValues(ts);
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts;
-        Properties props = new Properties(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
-
-        Scan scan = new Scan();
-        
-        ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES);
-        TableRef table = getTableRef(conn,ts);
-        services.getStatsManager().updateStats(table);
-        scan.setStartRow(HConstants.EMPTY_START_ROW);
-        scan.setStopRow(K1);
-        List<KeyRange> keyRanges = getSplits(conn, ts, scan);
-        assertEquals("Unexpected number of splits: " + keyRanges, 3, keyRanges.size());
-        assertEquals(newKeyRange(KeyRange.UNBOUND, new byte[] {'7'}), keyRanges.get(0));
-        assertEquals(newKeyRange(new byte[] {'7'}, new byte[] {'M'}), keyRanges.get(1));
-        assertEquals(newKeyRange(new byte[] {'M'}, K3), keyRanges.get(2));
-    }
-
-    private static KeyRange newKeyRange(byte[] lowerRange, byte[] upperRange) {
-        return PDataType.CHAR.getKeyRange(lowerRange, true, upperRange, false);
-    }
-}


Mime
View raw message