vdiravka commented on a change in pull request #1642: DRILL-6734: JDBC storage 
plugin returns null for fields without aliases
URL: https://github.com/apache/drill/pull/1642#discussion_r259087150
 
 

 ##########
 File path: 
contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
 ##########
 @@ -252,4 +252,46 @@ public void testCaseSensitiveTableNames() throws 
Exception {
     assertEquals(1, queryBuilder().sql("describe 
caseSensitiveTable").run().recordCount());
     assertEquals(2, queryBuilder().sql("describe 
CASESENSITIVETABLE").run().recordCount());
   }
+
+  @Test // DRILL-6734
+  public void testExpressionsWithoutAlias() throws Exception {
+    String query = "select count(*), 1+1+2+3+5+8+13+21+34, (1+sqrt(5))/2\n" +
+        "from mysql.`drill_mysql_test`.person";
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("EXPR$0", "EXPR$1", "EXPR$2")
+        .baselineValues(4L, 88L, 1.618033988749895)
+        .go();
+  }
+
+  @Test // DRILL-6734
+  public void testExpressionsWithoutAliasesPermutations() throws Exception {
+    String query = "select EXPR$1, EXPR$0, EXPR$2\n" +
+        "from (select 1+1+2+3+5+8+13+21+34, (1+sqrt(5))/2, count(*) from 
mysql.`drill_mysql_test`.person)";
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("EXPR$1", "EXPR$0", "EXPR$2")
+        .baselineValues(1.618033988749895, 88L, 4L)
+        .go();
+  }
+
+  @Test // DRILL-6893
+  public void testJoinStar() throws Exception {
+    String query = "select * from (select person_id from 
mysql.`drill_mysql_test`.person) t1 join " +
+        "(select person_id from mysql.`drill_mysql_test`.person) t2 on 
t1.person_id = t2.person_id";
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("person_id", "person_id0")
+        .baselineValues(1, 1)
+        .baselineValues(2, 2)
+        .baselineValues(3, 3)
+        .baselineValues(5, 5)
+        .go();
+  }
 
 Review comment:
   What do you think about some extra test case with aliases? Something similar 
to:
    ``select person_id as ID from mysql.`drill_mysql_test`.person limit 2``

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to