You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2018/09/24 15:28:31 UTC

[26/50] [abbrv] phoenix git commit: Revert "PHOENIX-4830 fix order by primary key desc"

Revert "PHOENIX-4830 fix order by primary key desc"

This reverts commit 59f8d0fd1a110786251dbf79c7bc743d1569b54c.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fe4c053c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fe4c053c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fe4c053c

Branch: refs/heads/omid2
Commit: fe4c053c156fe350238a3bb42a41c701859c70e6
Parents: a2a3044
Author: Thomas D'Silva <td...@apache.org>
Authored: Mon Aug 13 10:43:20 2018 -0700
Committer: Thomas D'Silva <td...@apache.org>
Committed: Mon Aug 13 10:43:20 2018 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/OrderByIT.java   | 46 --------------------
 .../phoenix/iterate/TableResultIterator.java    | 10 +----
 .../java/org/apache/phoenix/util/ScanUtil.java  | 19 --------
 3 files changed, 2 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe4c053c/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
index d7bbc05..578a3af 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/OrderByIT.java
@@ -656,52 +656,6 @@ public class OrderByIT extends ParallelStatsDisabledIT {
     }
 
     @Test
-    public void testOrderByDescOnPkWithSubQuery() throws Exception {
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        String tableName = generateUniqueName();
-        String ddl = "create table " + tableName + " (id bigint not null primary key, a bigint)";
-        conn.createStatement().execute(ddl);
-
-        conn.createStatement().execute("upsert into " + tableName + " values (1, 11)");
-        conn.createStatement().execute("upsert into " + tableName + " values (2, 22)");
-        conn.createStatement().execute("upsert into " + tableName + " values (3, 33)");
-        conn.createStatement().execute("upsert into " + tableName + " values (4,44)");
-
-        conn.commit();
-
-        ResultSet rs;
-        PhoenixStatement stmt = conn.createStatement().unwrap(PhoenixStatement.class);
-        rs = stmt.executeQuery("select id from " + tableName + " where id in (select id from "
-            + tableName + ") order by id desc");
-        assertTrue(rs.next());
-        assertEquals("4", rs.getString(1));
-    }
-
-    @Test
-    public void testOrderByAscOnPkWithSubQuery() throws Exception {
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        String tableName = generateUniqueName();
-        String ddl = "create table " + tableName + " (id bigint not null primary key, a bigint)";
-        conn.createStatement().execute(ddl);
-
-        conn.createStatement().execute("upsert into " + tableName + " values (1, 11)");
-        conn.createStatement().execute("upsert into " + tableName + " values (2, 22)");
-        conn.createStatement().execute("upsert into " + tableName + " values (3, 33)");
-        conn.createStatement().execute("upsert into " + tableName + " values (4,44)");
-
-        conn.commit();
-
-        ResultSet rs;
-        PhoenixStatement stmt = conn.createStatement().unwrap(PhoenixStatement.class);
-        rs = stmt.executeQuery("select id from " + tableName + " where id in (select id from "
-            + tableName + ") order by id");
-        assertTrue(rs.next());
-        assertEquals("1", rs.getString(1));
-    }
-
-    @Test
     public void testNullsLastWithDesc() throws Exception {
         Connection conn=null;
         try {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe4c053c/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
index 9a80d9f..06f612a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
@@ -17,7 +17,6 @@
  */
 package org.apache.phoenix.iterate;
 
-import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.REVERSE_SCAN;
 import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_ACTUAL_START_ROW;
 import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_START_ROW_SUFFIX;
 import static org.apache.phoenix.iterate.TableResultIterator.RenewLeaseStatus.CLOSED;
@@ -54,7 +53,6 @@ import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.StaleRegionBoundaryCacheException;
 import org.apache.phoenix.schema.tuple.Tuple;
-import org.apache.phoenix.schema.types.PBoolean;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.Closeables;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
@@ -248,12 +246,8 @@ public class TableResultIterator implements ResultIterator {
             ResultIterator delegate = this.scanIterator;
             if (delegate == UNINITIALIZED_SCANNER) {
                 try {
-                    if (scan.getAttribute(REVERSE_SCAN) != null
-                        && (boolean)(PBoolean.INSTANCE.toObject(scan.getAttribute(REVERSE_SCAN)))) {
-                        ScanUtil.prepareStopRowForReverseScan(scan);
-                    }
-                    this.scanIterator = new ScanningResultIterator(htable.getScanner(scan), scan,
-                        scanMetricsHolder);
+                    this.scanIterator =
+                            new ScanningResultIterator(htable.getScanner(scan), scan, scanMetricsHolder);
                 } catch (IOException e) {
                     Closeables.closeQuietly(htable);
                     throw ServerUtil.parseServerException(e);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe4c053c/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 2dd46a6..62ecebd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -656,25 +656,6 @@ public class ScanUtil {
     }
 
     /**
-     * HBase scan stopRow is exclusive.So we have to append trailing 0 to achieve inclusiveness.
-     * for reverse scan, need to append trailing F to stopRow.
-     * @param scan
-     */
-    public static void prepareStopRowForReverseScan(Scan scan) {
-        byte[] stopRow = scan.getStopRow();
-        if (stopRow == null) {
-            return;
-        }
-        byte[] newStopRow = new byte[stopRow.length + 1];
-        int i = 0;
-        for (byte nsr : stopRow) {
-            newStopRow[i++] = nsr;
-        }
-        newStopRow[i] = QueryConstants.DESC_SEPARATOR_BYTE;
-        scan.setStopRow(newStopRow);
-    }
-
-    /**
      * Start key and stop key of the original scan from client are regions start and end keys so
      * prefix scan start/stop key to the start row/stop row suffix and set them as scan boundaries.
      * @param scan