[ 
https://issues.apache.org/jira/browse/TAJO-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14712322#comment-14712322
 ] 

ASF GitHub Bot commented on TAJO-1798:
--------------------------------------

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

    https://github.com/apache/tajo/pull/709#discussion_r37939197
  
    --- Diff: tajo-core/src/main/java/org/apache/tajo/querymaster/Query.java ---
    @@ -505,30 +510,31 @@ private QueryState finalizeQuery(Query query, 
QueryCompletedEvent event) {
             QueryHookExecutor hookExecutor = new 
QueryHookExecutor(query.context.getQueryMasterContext());
             hookExecutor.execute(query.context.getQueryContext(), query, 
event.getExecutionBlockId(), finalOutputDir);
     
    -        TableDesc desc = query.getResultDesc();
    -
    -        // If there is partitions
    -        List<PartitionDescProto> partitions = query.getPartitions();
    -        if (partitions!= null && !partitions.isEmpty()) {
    -
    -          String databaseName, simpleTableName;
    -
    -          if (CatalogUtil.isFQTableName(desc.getName())) {
    -            String[] split = CatalogUtil.splitFQTableName(desc.getName());
    -            databaseName = split[0];
    -            simpleTableName = split[1];
    +        // Add dynamic partitions to catalog for partition table.
    +        if (queryContext.hasOutputTableUri() && 
queryContext.hasPartition()) {
    +          Set<PartitionDescProto> partitions = query.getPartitions();
    +          if (partitions != null) {
    +            String databaseName, simpleTableName;
    +
    +            if (CatalogUtil.isFQTableName(tableDesc.getName())) {
    +              String[] split = 
CatalogUtil.splitFQTableName(tableDesc.getName());
    +              databaseName = split[0];
    +              simpleTableName = split[1];
    +            } else {
    +              databaseName = queryContext.getCurrentDatabase();
    +              simpleTableName = tableDesc.getName();
    +            }
    +
    +            // Store partitions to CatalogStore using alter table 
statement.
    +            catalog.addPartitions(databaseName, simpleTableName, 
TUtil.newList(partitions), true);
    +            LOG.info("Added partitions to catalog (total=" + 
partitions.size() + ")");
               } else {
    -            databaseName = queryContext.getCurrentDatabase();
    -            simpleTableName = desc.getName();
    +            LOG.info("Can't find partitions for adding.");
               }
    -
    -          // Store partitions to CatalogStore using alter table statement.
    -          catalog.addPartitions(databaseName, simpleTableName, partitions, 
true);
    -        } else {
    -          LOG.info("Can't find partitions for adding.");
    +          query.clearPartitions();
    +          partitions.clear();
    --- End diff --
    
    please remove unnecessary code


> Query execution is not finished even though it actually is done.
> ----------------------------------------------------------------
>
>                 Key: TAJO-1798
>                 URL: https://issues.apache.org/jira/browse/TAJO-1798
>             Project: Tajo
>          Issue Type: Bug
>            Reporter: Jihoon Son
>            Assignee: Jaehwa Jung
>             Fix For: 0.11.0
>
>
> The following query runs continuously even though the progress is reached to 
> 100%.
> {noformat}
> tpch1> create table partitioned_lineitem (l_orderkey int8, l_partkey int8, 
> l_suppkey int8, l_linenumber int8, l_quantity float8, l_extendedprice float8, 
> l_discount float8, l_tax float8, l_linestatus text, l_shipdate text, 
> l_commitdate text, l_receiptdate text, l_shipinstruct text, l_shipmode text, 
> l_comment text) partition by column (l_returnflag text) as select l_orderkey, 
> l_partkey, l_suppkey, l_linenumber , l_quantity , l_extendedprice , 
> l_discount , l_tax , l_linestatus , l_shipdate , l_commitdate , l_receiptdate 
> , l_shipinstruct , l_shipmode , l_comment, l_returnflag from lineitem;
> ...
> Progress: 100%, response time: 328.515 sec
> Progress: 100%, response time: 329.517 sec
> Progress: 100%, response time: 330.524 sec
> Progress: 100%, response time: 331.527 sec
> Progress: 100%, response time: 332.529 sec
> ...
> {noformat}
> When I check the query status through the web UI, its all stages are already 
> completed with 'SUCCEEDED' state. So, I killed the running query. However, 
> surprisingly, I found that the result table of the above query is 
> successfully registered in catalog as follows.
> {noformat}
> tpch1> \d
> customer
> lineitem
> nation
> orders
> partitioned_lineitem
> partitioned_nation
> partitioned_region
> partsupp
> region
> supplier
> tpch1> \d partitioned_lineitem
> table name: tpch1.partitioned_lineitem
> table uri: hdfs://localhost:7020/tajo/warehouse/tpch1/partitioned_lineitem
> store type: TEXT
> number of rows: 6001215
> volume: 750.5 MB
> Options: 
>       'text.delimiter'='|'
> schema: 
> l_orderkey    INT8
> l_partkey     INT8
> l_suppkey     INT8
> l_linenumber  INT8
> l_quantity    FLOAT8
> l_extendedprice       FLOAT8
> l_discount    FLOAT8
> l_tax FLOAT8
> l_linestatus  TEXT
> l_shipdate    TEXT
> l_commitdate  TEXT
> l_receiptdate TEXT
> l_shipinstruct        TEXT
> l_shipmode    TEXT
> l_comment     TEXT
> Partitions: 
> type:COLUMN
> columns::l_returnflag (TEXT)
> tpch1> select count(*) from partitioned_lineitem;
> Progress: 6%, response time: 1.164 sec
> Progress: 6%, response time: 1.165 sec
> Progress: 6%, response time: 1.568 sec
> Progress: 100%, response time: 1.793 sec
> ?count
> -------------------------------
> 6001215
> (1 rows, 1.793 sec, 8 B selected)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to