Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/824#discussion_r41978151
  
    --- Diff: 
tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
 ---
    @@ -1340,411 +1327,12 @@ public final void testDuplicatedPartitions() 
throws Exception {
       }
     
       @Test
    -  public final void testPatternMatchingPredicatesAndStringFunctions() 
throws Exception {
    -    ResultSet res = null;
    -    String tableName = 
CatalogUtil.normalizeIdentifier("testPatternMatchingPredicatesAndStringFunctions");
    -    String expectedResult;
    -
    -    if (nodeType == NodeType.INSERT) {
    -      executeString("create table " + tableName
    -        + " (col1 int4, col2 int4) partition by column(l_shipdate text, 
l_returnflag text) ").close();
    -
    -      assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    -      assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getSchema().size());
    -      assertEquals(4, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getLogicalSchema().size());
    -
    -      executeString(
    -        "insert overwrite into " + tableName + " select l_orderkey, 
l_partkey, l_shipdate, l_returnflag from lineitem");
    -    } else {
    -      executeString(
    -        "create table " + tableName + "(col1 int4, col2 int4) partition by 
column(l_shipdate text, l_returnflag text) "
    -          + " as select l_orderkey, l_partkey, l_shipdate, l_returnflag 
from lineitem");
    -    }
    -
    -    assertTrue(client.existTable(tableName));
    -
    -    // Like
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE l_shipdate LIKE '1996%' and l_returnflag = 'N' order by 
l_shipdate");
    -
    -    expectedResult = "col1,col2,l_shipdate,l_returnflag\n" +
    -      "-------------------------------\n" +
    -      "1,1,1996-03-13,N\n" +
    -      "1,1,1996-04-12,N\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Not like
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE l_shipdate NOT LIKE '1996%' and l_returnflag IN ('R') 
order by l_shipdate");
    -
    -    expectedResult = "col1,col2,l_shipdate,l_returnflag\n" +
    -      "-------------------------------\n" +
    -      "3,3,1993-11-09,R\n" +
    -      "3,2,1994-02-02,R\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // In
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE l_shipdate IN ('1993-11-09', '1994-02-02', '1997-01-28') 
AND l_returnflag = 'R' order by l_shipdate");
    -
    -    expectedResult = "col1,col2,l_shipdate,l_returnflag\n" +
    -      "-------------------------------\n" +
    -      "3,3,1993-11-09,R\n" +
    -      "3,2,1994-02-02,R\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Similar to
    -    res = executeString("SELECT * FROM " + tableName + " WHERE l_shipdate 
similar to '1993%' order by l_shipdate");
    -
    -    expectedResult = "col1,col2,l_shipdate,l_returnflag\n" +
    -      "-------------------------------\n" +
    -      "3,3,1993-11-09,R\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Regular expression
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE l_shipdate regexp 
'[1-2][0-9][0-9][3-9]-[0-1][0-9]-[0-3][0-9]' "
    -      + " AND l_returnflag <> 'N' ORDER BY l_shipdate");
    -
    -    expectedResult = "col1,col2,l_shipdate,l_returnflag\n" +
    -      "-------------------------------\n" +
    -      "3,3,1993-11-09,R\n" +
    -      "3,2,1994-02-02,R\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Concatenate
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE l_shipdate = ( '1996' || '-' || '03' || '-' || '13' ) 
order by l_shipdate");
    -
    -    expectedResult = "col1,col2,l_shipdate,l_returnflag\n" +
    -      "-------------------------------\n" +
    -      "1,1,1996-03-13,N\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    executeString("DROP TABLE " + tableName + " PURGE").close();
    -    res.close();
    -  }
    -
    -  @Test
    -  public final void testDatePartitionColumn() throws Exception {
    -    ResultSet res = null;
    -    String tableName = 
CatalogUtil.normalizeIdentifier("testDatePartitionColumn");
    -    String expectedResult;
    -
    -    if (nodeType == NodeType.INSERT) {
    -      executeString("create table " + tableName + " (col1 int4, col2 int4) 
partition by column(key date) ").close();
    -
    -      assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    -      assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getSchema().size());
    -      assertEquals(3, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getLogicalSchema().size());
    -
    -      executeString(
    -        "insert overwrite into " + tableName + " select l_orderkey, 
l_partkey, l_shipdate from lineitem");
    -    } else {
    -      executeString(
    -        "create table " + tableName + "(col1 int4, col2 int4) partition by 
column(key date) "
    -          + " as select l_orderkey, l_partkey, l_shipdate::date from 
lineitem");
    -    }
    -
    -    assertTrue(client.existTable(tableName));
    -
    -    // LessThanOrEquals
    -    res = executeString("SELECT * FROM " + tableName + " WHERE key <= date 
'1995-09-01' order by col1, col2, key");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "3,2,1994-02-02\n" +
    -      "3,3,1993-11-09\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // LessThan and GreaterThan
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > to_date('1993-01-01', 'YYYY-MM-DD') " +
    -      " and key < to_date('1996-01-01', 'YYYY-MM-DD') order by col1, col2, 
key desc");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "3,2,1994-02-02\n" +
    -      "3,3,1993-11-09\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Between
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key between date '1993-01-01' and date '1997-01-01' order 
by col1, col2, key desc");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,1996-04-12\n" +
    -      "1,1,1996-03-13\n" +
    -      "3,2,1994-02-02\n" +
    -      "3,3,1993-11-09\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Cast
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > '1993-01-01'::date " +
    -      " and key < '1997-01-01'::timestamp order by col1, col2, key ");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,1996-03-13\n" +
    -      "1,1,1996-04-12\n" +
    -      "3,2,1994-02-02\n" +
    -      "3,3,1993-11-09\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Interval
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > '1993-01-01'::date " +
    -      " and key < date '1994-01-01' + interval '1 year' order by col1, 
col2, key ");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "3,2,1994-02-02\n" +
    -      "3,3,1993-11-09\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // DateTime Function #1
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > '1993-01-01'::date " +
    -      " and key < add_months(date '1994-01-01', 12) order by col1, col2, 
key ");
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // DateTime Function #2
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > '1993-01-01'::date " +
    -      " and key < add_months('1994-01-01'::timestamp, 12) order by col1, 
col2, key ");
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    executeString("DROP TABLE " + tableName + " PURGE").close();
    -    res.close();
    -  }
    -
    -  @Test
    -  public final void testTimestampPartitionColumn() throws Exception {
    -    ResultSet res = null;
    -    String tableName = 
CatalogUtil.normalizeIdentifier("testTimestampPartitionColumn");
    -    String expectedResult;
    -
    -    if (nodeType == NodeType.INSERT) {
    -      executeString("create table " + tableName
    -        + " (col1 int4, col2 int4) partition by column(key timestamp) 
").close();
    -
    -      assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    -      assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getSchema().size());
    -      assertEquals(3, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getLogicalSchema().size());
    -
    -      executeString(
    -        "insert overwrite into " + tableName
    -          + " select l_orderkey, l_partkey, to_timestamp(l_shipdate, 
'YYYY-MM-DD') from lineitem");
    -    } else {
    -      executeString(
    -        "create table " + tableName + "(col1 int4, col2 int4) partition by 
column(key timestamp) "
    -          + " as select l_orderkey, l_partkey, to_timestamp(l_shipdate, 
'YYYY-MM-DD') from lineitem");
    -    }
    -
    -    assertTrue(client.existTable(tableName));
    -
    -    // LessThanOrEquals
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key <= to_timestamp('1995-09-01', 'YYYY-MM-DD') order by 
col1, col2, key");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "3,2,1994-02-02 00:00:00\n" +
    -      "3,3,1993-11-09 00:00:00\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // LessThan and GreaterThan
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > to_timestamp('1993-01-01', 'YYYY-MM-DD') and " +
    -      "key < to_timestamp('1996-01-01', 'YYYY-MM-DD') order by col1, col2, 
key desc");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "3,2,1994-02-02 00:00:00\n" +
    -      "3,3,1993-11-09 00:00:00\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Between
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key between to_timestamp('1993-01-01', 'YYYY-MM-DD') " +
    -      "and to_timestamp('1997-01-01', 'YYYY-MM-DD') order by col1, col2, 
key desc");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,1996-04-12 00:00:00\n" +
    -      "1,1,1996-03-13 00:00:00\n" +
    -      "3,2,1994-02-02 00:00:00\n" +
    -      "3,3,1993-11-09 00:00:00\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    executeString("DROP TABLE " + tableName + " PURGE").close();
    -    res.close();
    -  }
    -
    -  @Test
    -  public final void testTimePartitionColumn() throws Exception {
    -    ResultSet res = null;
    -    String tableName = 
CatalogUtil.normalizeIdentifier("testTimePartitionColumn");
    -    String  expectedResult;
    -
    -    if (nodeType == NodeType.INSERT) {
    -      executeString("create table " + tableName
    -        + " (col1 int4, col2 int4) partition by column(key time) 
").close();
    -
    -      assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    -      assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getSchema().size());
    -      assertEquals(3, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getLogicalSchema().size());
    -
    -      executeString(
    -        "insert overwrite into " + tableName
    -          + " select l_orderkey, l_partkey " +
    -          " , CASE l_shipdate WHEN '1996-03-13' THEN cast ('11:20:40' as 
time) " +
    -          " WHEN '1997-01-28' THEN cast ('12:10:20' as time) " +
    -          " WHEN '1994-02-02' THEN cast ('12:10:30' as time) " +
    -          " ELSE cast ('00:00:00' as time) END " +
    -          " from lineitem");
    -    } else {
    -      executeString(
    -        "create table " + tableName + "(col1 int4, col2 int4) partition by 
column(key time) "
    -          + " as select l_orderkey, l_partkey " +
    -          " , CASE l_shipdate WHEN '1996-03-13' THEN cast ('11:20:40' as 
time) " +
    -          " WHEN '1997-01-28' THEN cast ('12:10:20' as time) " +
    -          " WHEN '1994-02-02' THEN cast ('12:10:30' as time) " +
    -          " ELSE cast ('00:00:00' as time) END " +
    -          " from lineitem");
    -    }
    -
    -    assertTrue(client.existTable(tableName));
    -    // LessThanOrEquals
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key <= cast('12:10:20' as time) order by col1, col2, key");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,00:00:00\n" +
    -      "1,1,11:20:40\n" +
    -      "2,2,12:10:20\n" +
    -      "3,3,00:00:00\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // LessThan and GreaterThan
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key > cast('00:00:00' as time) and " +
    -      "key < cast('12:10:00' as time) order by col1, col2, key desc");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,11:20:40\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    // Between
    -    res = executeString("SELECT * FROM " + tableName
    -      + " WHERE key between cast('11:00:00' as time) " +
    -      "and cast('13:00:00' as time) order by col1, col2, key desc");
    -
    -    expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,11:20:40\n" +
    -      "2,2,12:10:20\n" +
    -      "3,2,12:10:30\n";
    -
    -    assertEquals(expectedResult, resultSetToString(res));
    -    res.close();
    -
    -    executeString("DROP TABLE " + tableName + " PURGE").close();
    -    res.close();
    -  }
    -
    -  @Test
    -  public final void testDatabaseNameIncludeTableName() throws Exception {
    -    executeString("create database test_partition").close();
    -
    -    String databaseName = "test_partition";
    -    String tableName = CatalogUtil.normalizeIdentifier("part");
    -
    -    if (nodeType == NodeType.INSERT) {
    -      executeString(
    -        "create table " + databaseName + "." + tableName + " (col1 int4, 
col2 int4) partition by column(key float8) ");
    -
    -      assertTrue(catalog.existsTable(databaseName, tableName));
    -      assertEquals(2, catalog.getTableDesc(databaseName, 
tableName).getSchema().size());
    -      assertEquals(3, catalog.getTableDesc(databaseName, 
tableName).getLogicalSchema().size());
    -
    -      executeString(
    -        "insert overwrite into " + databaseName + "." + tableName + " 
select l_orderkey, l_partkey, " +
    -          "l_quantity from lineitem");
    -    } else {
    -      executeString(
    -        "create table "+ databaseName + "." + tableName + "(col1 int4, 
col2 int4) partition by column(key float8) "
    -          + " as select l_orderkey, l_partkey, l_quantity from lineitem");
    -    }
    -
    -    TableDesc tableDesc = catalog.getTableDesc(databaseName, tableName);
    -    verifyPartitionDirectoryFromCatalog(databaseName, tableName, new 
String[]{"key"},
    -      tableDesc.getStats().getNumRows());
    -
    -    ResultSet res = executeString("select * from " + databaseName + "." + 
tableName + " ORDER BY key");
    -
    -    String result = resultSetToString(res);
    -    String expectedResult = "col1,col2,key\n" +
    -      "-------------------------------\n" +
    -      "1,1,17.0\n" +
    -      "1,1,36.0\n" +
    -      "2,2,38.0\n" +
    -      "3,2,45.0\n" +
    -      "3,3,49.0\n";
    -    res.close();
    -    assertEquals(expectedResult, result);
    -
    -    executeString("DROP TABLE " + databaseName + "." + tableName + " 
PURGE").close();
    -    executeString("DROP database " + databaseName).close();
    -  }
    -
    -  @Test
    -  public void testAbnormalDirectories()  throws Exception {
    +  public void testExternalTable()  throws Exception {
    --- End diff --
    
    This test includes testing on managed tables as well as external tables. 
Please change the name.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to