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

    https://github.com/apache/carbondata/pull/2665#discussion_r217945289
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/datamap/DataMapChooser.java ---
    @@ -268,23 +238,38 @@ private ExpressionTuple selectDataMap(Expression 
expression, List<TableDataMap>
     
       private void extractColumnExpression(Expression expression,
           List<ColumnExpression> columnExpressions) {
    -    if (expression instanceof ColumnExpression) {
    -      columnExpressions.add((ColumnExpression) expression);
    -    } else if (expression instanceof MatchExpression) {
    -      // this is a special case for lucene
    -      // build a fake ColumnExpression to filter datamaps which contain 
target column
    -      // a Lucene query string is alike "column:query term"
    -      String[] queryItems = expression.getString().split(":", 2);
    -      if (queryItems.length == 2) {
    -        columnExpressions.add(new ColumnExpression(queryItems[0], null));
    -      }
    -    } else if (expression != null) {
    -      List<Expression> children = expression.getChildren();
    -      if (children != null && children.size() > 0) {
    -        for (Expression exp : children) {
    -          extractColumnExpression(exp, columnExpressions);
    +    switch (expression.getFilterExpressionType()) {
    --- End diff --
    
    I think these operation should not be in DataMapChooser.
    DataMapChooser is for common logic and should not handle specific datamap's 
logic.
    If you want to decide which expression will be supported by the specific 
datamap, here I do propose you to refactor the 'SUPPORTED_EXPRESSION' in the 
specific datamap. In that place, the datamap should declare what kind of 
operand and operator it will support and in DataMapChooser we just need to call 
that method and decide which expression will be handled by that datamap.


---

Reply via email to