Repository: phoenix
Updated Branches:
  refs/heads/4.0 193622e53 -> 1c33da317


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/1c33da31
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1c33da31
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1c33da31

Branch: refs/heads/4.0
Commit: 1c33da31721d3d5a9b5c50e5e55a3404bfb4abdc
Parents: 193622e
Author: James Taylor <jtay...@salesforce.com>
Authored: Wed Mar 4 08:27:51 2015 -0800
Committer: James Taylor <jtay...@salesforce.com>
Committed: Wed Mar 4 08:34:07 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/1c33da31/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/1c33da31/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);
     }

Reply via email to