You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2015/03/04 23:41:23 UTC

[48/50] [abbrv] phoenix git commit: PHOENIX-1696 Selecting column more than once fails (Maryann Xue, Samarth Jain)

PHOENIX-1696 Selecting column more than once fails (Maryann Xue, Samarth Jain)


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

Branch: refs/heads/calcite
Commit: 9a546b9c89a3920345ea35ad503dfb360d4c34a5
Parents: 49f06b3
Author: James Taylor <jt...@salesforce.com>
Authored: Wed Mar 4 08:27:51 2015 -0800
Committer: James Taylor <jt...@salesforce.com>
Committed: Wed Mar 4 08:27:51 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/phoenix/end2end/QueryMoreIT.java  | 14 ++++++++++++++
 .../java/org/apache/phoenix/compile/RowProjector.java |  3 ---
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9a546b9c/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index af5e6fa..e725376 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -18,6 +18,8 @@
 package org.apache.phoenix.end2end;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
 import java.sql.Date;
@@ -33,6 +35,7 @@ import java.util.Properties;
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
@@ -314,4 +317,15 @@ public class QueryMoreIT extends BaseHBaseManagedTimeIT {
         sb.append(")");
         return sb.toString();
     }
+    
+    @Test // see - https://issues.apache.org/jira/browse/PHOENIX-1696
+    public void testSelectColumnMoreThanOnce() throws Exception {
+        Date date = new Date(System.currentTimeMillis());
+        initEntityHistoryTableValues("abcd", getDefaultSplits("abcd"), date, 100l);
+        String query = "SELECT NEW_VALUE, NEW_VALUE FROM " + TestUtil.ENTITY_HISTORY_TABLE_NAME + " LIMIT 1";
+        ResultSet rs = DriverManager.getConnection(getUrl()).createStatement().executeQuery(query);
+        assertTrue(rs.next());
+        rs.getObject("NEW_VALUE");
+        assertFalse(rs.next());
+    }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9a546b9c/phoenix-core/src/main/java/org/apache/phoenix/compile/RowProjector.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/RowProjector.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/RowProjector.java
index 364ebd6..1b35e92 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/RowProjector.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/RowProjector.java
@@ -139,9 +139,6 @@ public class RowProjector {
                 throw new ColumnNotFoundException(name);
             }
         }
-        if (index.size() > 1) {
-            throw new AmbiguousColumnException(name);
-        }
         
         return index.get(0);
     }