amansinha100 commented on code in PR #4990:
URL: https://github.com/apache/hive/pull/4990#discussion_r1446874029


##########
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java:
##########
@@ -610,6 +610,25 @@ public void testNullCast() throws Throwable {
     testScriptFile(SCRIPT_TEXT, args(), "^(.(?!(NullPointerException)))*$", 
OutStream.ERR);
   }
 
+  @Test
+  public void testTableAliasInColumnName() throws Throwable {
+    String SCRIPT_TEXT =
+        "DROP TABLE IF EXISTS input;\n" +
+        "DROP TABLE IF EXISTS result;\n" +
+        "CREATE TABLE input (col1 string, col2 int);\n" +
+        "CREATE TABLE result (res string);\n" +
+        "INSERT INTO input VALUES('Hive', 3);\n" +
+        "CREATE PROCEDURE p1() AS\n" +
+        "  BEGIN\n" +
+        "    FOR rec IN (select tab.col1, tab.col2 num from input tab) LOOP\n" 
+

Review Comment:
   Will this fail if 2 columns have the same alias name defined and within the 
LOOP we try to reference it ?  It would be good to have a meaningful error such 
as 'ambiguous column reference'.   
   If this is not supported in the current code, it is ok to file a separate 
Jira and go ahead with this. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to