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

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

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

    https://github.com/apache/tajo/pull/624#discussion_r39012228
  
    --- Diff: 
tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/PartitionedTableRewriter.java
 ---
    @@ -118,32 +121,264 @@ public String toString() {
        * @return
        * @throws IOException
        */
    -  private Path [] findFilteredPaths(OverridableConf queryContext, Schema 
partitionColumns, EvalNode [] conjunctiveForms,
    -                                    Path tablePath)
    -      throws IOException {
    +  private Path [] findFilteredPaths(OverridableConf queryContext, String 
tableName,
    +                                    Schema partitionColumns, EvalNode [] 
conjunctiveForms, Path tablePath)
    +      throws IOException, UndefinedDatabaseException, 
UndefinedTableException,
    +      UndefinedPartitionMethodException, UndefinedOperatorException {
     
    +    Path [] filteredPaths = null;
         FileSystem fs = tablePath.getFileSystem(queryContext.getConf());
    +    String [] splits = CatalogUtil.splitFQTableName(tableName);
    +    List<PartitionDescProto> partitions = null;
     
    -    PathFilter [] filters;
    -    if (conjunctiveForms == null) {
    -      filters = buildAllAcceptingPathFilters(partitionColumns);
    -    } else {
    -      filters = buildPathFiltersForAllLevels(partitionColumns, 
conjunctiveForms);
    +    String store = 
queryContext.getConf().get(CatalogConstants.STORE_CLASS);
    +
    +    try {
    +      // HiveCatalogStore provides list of table partitions with where 
clause because hive just provides api using
    +      // the filter string. So, this rewriter need to differentiate 
HiveCatalogStore and other catalogs.
    +      if (store.equals("org.apache.tajo.catalog.store.HiveCatalogStore")) {
    --- End diff --
    
    A RewriteRule should not consider its catalog storage type. It does not 
make sense. CatalogService should just take an algebra, and HiveCatalogStore 
should generates a filter expression string representation from the algebra.


> Add a method to get partition directories with filter conditions.
> -----------------------------------------------------------------
>
>                 Key: TAJO-1493
>                 URL: https://issues.apache.org/jira/browse/TAJO-1493
>             Project: Tajo
>          Issue Type: Sub-task
>          Components: Catalog
>            Reporter: Jaehwa Jung
>            Assignee: Jaehwa Jung
>             Fix For: 0.11.0, 0.12.0
>
>         Attachments: TAJO-1493.patch, TAJO-1493_2.patch, TAJO-1493_3.patch, 
> TAJO-1493_4.patch
>
>
> Currently, PartitionedTableRewriter take a look into partition directories 
> for rewriting filter conditions. It get all sub directories of table path 
> because catalog doesn’t provide partition directories. But if there are lots 
> of sub directories on HDFS, such as, more than 10,000 directories, it might 
> be cause overload to NameNode. Thus, CatalogStore need to provide partition 
> directories for specified filter conditions. I designed new method to 
> CatalogStore as follows:
> * method name: getPartitionsWithConditionFilters
> * first parameter: database name
> * second parameter: table name
> * third parameter: where clause (included target column name and partition 
> value)
> * return values: 
> List<org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto>
> * description: It scan right partition directories on CatalogStore with where 
> caluse. 
>   For examples, users set parameters as following:
> ** first parameter: default
> ** second parameter: table1
> ** third parameter: COLUMN_NAME = 'col1' AND PARTITION_VALUE = '3
> In the previous cases, this method will create select clause as follows.
> {code:xml}
> SELECT DISTINCT A.PATH
> FROM PARTITIONS A, (
>   SELECT B.PARTITION_ID
>   FROM PARTITION_KEYS B
>   WHERE B.PARTITION_ID > 0 
>   AND (
>     COLUMN_NAME = 'col1' AND PARTITION_VALUE = '3'
>   )
> ) B
> WHERE A.PARTITION_ID > 0
> AND A.TID = ${table_id}
> AND A.PARTITION_ID = B.PARTITION_ID
> {code}
> At the first time, I considered to use EvalNode instead of where clause. But 
> I can’t use it because of recursive related problems between tajo-catalog 
> module and tajo-plan module. So, I’ll implement utility class to convert 
> EvalNode to SQL.



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

Reply via email to