You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by QiangCai <gi...@git.apache.org> on 2018/02/25 11:13:59 UTC

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

GitHub user QiangCai opened a pull request:

    https://github.com/apache/carbondata/pull/1996

    [CARBONDATA-2200] Fix bug of LIKE operation on streaming table

    
     - [x] Any interfaces changed?
     no
     - [x] Any backward compatibility impacted?
     no
     - [x] Document update required?
     no
     - [x] Testing done
            Please provide details on 
            - Whether new unit test cases have been added or why no new tests are required?
                 added UT
            - How it is tested? Please attach test report.
            - Is it a performance related change? Please attach the performance test report.
            - Any additional information to help reviewers in testing this change.
           
     - [x] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. 
    small changes


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/QiangCai/carbondata streaming_like

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/carbondata/pull/1996.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1996
    
----
commit cac99ccda928a44c5e7bc96a4155cc8cf4b2cfe3
Author: QiangCai <qi...@...>
Date:   2018-02-25T10:53:41Z

    fix NPE for LIKE operation on streaming table

----


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2635/



---

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

Posted by sraghunandan <gi...@git.apache.org>.
Github user sraghunandan commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1996#discussion_r170451788
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java ---
    @@ -276,12 +277,82 @@ public BitSetGroup applyFilter(BlocksChunkHolder blockChunkHolder, boolean useBi
       public boolean applyFilter(RowIntf value, int dimOrdinalMax)
           throws FilterUnsupportedException, IOException {
         try {
    -      return exp.evaluate(value).getBoolean();
    +      Boolean result = exp.evaluate(createRow(value, dimOrdinalMax)).getBoolean();
    --- End diff --
    
    pls explain why createRow needs to be called.what was the problem without this


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2633/



---

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1996#discussion_r170451620
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java ---
    @@ -276,12 +277,82 @@ public BitSetGroup applyFilter(BlocksChunkHolder blockChunkHolder, boolean useBi
       public boolean applyFilter(RowIntf value, int dimOrdinalMax)
           throws FilterUnsupportedException, IOException {
         try {
    -      return exp.evaluate(value).getBoolean();
    +      Boolean result = exp.evaluate(createRow(value, dimOrdinalMax)).getBoolean();
    +      return result == null ? false : result;
         } catch (FilterIllegalMemberException e) {
           throw new FilterUnsupportedException(e);
         }
       }
     
    +  /**
    +   * create row for row filter to evaluate expression
    +   */
    +  private RowIntf createRow(RowIntf value, int dimOrdinalMax) throws IOException {
    +    Object[] record = new Object[value.size()];
    +    String memberString;
    +    for (int i = 0; i < dimColEvaluatorInfoList.size(); i++) {
    +      DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = dimColEvaluatorInfoList.get(i);
    +      int index = dimColumnEvaluatorInfo.getDimension().getOrdinal();
    +      // if filter dimension is not present in the current add its default value
    +      if (!isDimensionPresentInCurrentBlock[i]) {
    +        // fill default value here
    +        record[index] = getDimensionDefaultValue(dimColumnEvaluatorInfo);
    +        continue;
    +      }
    +      if (!dimColumnEvaluatorInfo.getDimension().getDataType().isComplexType()) {
    +        if (!dimColumnEvaluatorInfo.isDimensionExistsInCurrentSilce()) {
    +          record[index] = dimColumnEvaluatorInfo.getDimension().getDefaultValue();
    +        }
    +        byte[] memberBytes = (byte[]) value.getVal(index);
    +        if (!dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DICTIONARY)) {
    +          if (null != memberBytes) {
    +            if (Arrays.equals(CarbonCommonConstants.MEMBER_DEFAULT_VAL_ARRAY, memberBytes)) {
    +              memberBytes = null;
    +            } else if (memberBytes.length == 0) {
    +              memberBytes = null;
    +            }
    +            record[index] = DataTypeUtil.getDataBasedOnDataTypeForNoDictionaryColumn(memberBytes,
    +                dimColumnEvaluatorInfo.getDimension().getDataType());
    +          }
    +        } else {
    +          int dictionaryValue = ByteUtil.toInt(memberBytes, 0);
    +          if (dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DICTIONARY)
    +              && !dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
    +            memberString =
    +                getFilterActualValueFromDictionaryValue(dimColumnEvaluatorInfo, dictionaryValue);
    +            record[index] = DataTypeUtil.getDataBasedOnDataType(memberString,
    +                dimColumnEvaluatorInfo.getDimension().getDataType());
    +          } else if (
    +              dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
    +            Object member = getFilterActualValueFromDirectDictionaryValue(dimColumnEvaluatorInfo,
    +                dictionaryValue);
    +            record[index] = member;
    +          }
    +        }
    +      } else {
    +        record[index] = value.getVal(index);
    +      }
    +    }
    +
    +    for (int i = 0; i < msrColEvalutorInfoList.size(); i++) {
    +      MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = msrColEvalutorInfoList.get(i);
    +      int index = msrColumnEvalutorInfo.getMeasure().getOrdinal() + dimOrdinalMax;
    +      // add default value for the measure in case filter measure is not present
    +      // in the current block measure list
    +      if (!isMeasurePresentInCurrentBlock[i]) {
    +        byte[] defaultValue = msrColumnEvalutorInfo.getCarbonColumn().getDefaultValue();
    +        record[index] = RestructureUtil
    +            .getMeasureDefaultValue(msrColumnEvalutorInfo.getCarbonColumn().getColumnSchema(),
    +                defaultValue);
    +        continue;
    --- End diff --
    
    give comment why continue


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3662/



---

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1996#discussion_r170451511
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java ---
    @@ -276,12 +277,82 @@ public BitSetGroup applyFilter(BlocksChunkHolder blockChunkHolder, boolean useBi
       public boolean applyFilter(RowIntf value, int dimOrdinalMax)
           throws FilterUnsupportedException, IOException {
         try {
    -      return exp.evaluate(value).getBoolean();
    +      Boolean result = exp.evaluate(createRow(value, dimOrdinalMax)).getBoolean();
    +      return result == null ? false : result;
         } catch (FilterIllegalMemberException e) {
           throw new FilterUnsupportedException(e);
         }
       }
     
    +  /**
    +   * create row for row filter to evaluate expression
    --- End diff --
    
    describe what is input row and what is the return row


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3888/



---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    retest this please


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3657/



---

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/carbondata/pull/1996


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2643/



---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2638/



---

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1996#discussion_r170451602
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java ---
    @@ -276,12 +277,82 @@ public BitSetGroup applyFilter(BlocksChunkHolder blockChunkHolder, boolean useBi
       public boolean applyFilter(RowIntf value, int dimOrdinalMax)
           throws FilterUnsupportedException, IOException {
         try {
    -      return exp.evaluate(value).getBoolean();
    +      Boolean result = exp.evaluate(createRow(value, dimOrdinalMax)).getBoolean();
    +      return result == null ? false : result;
         } catch (FilterIllegalMemberException e) {
           throw new FilterUnsupportedException(e);
         }
       }
     
    +  /**
    +   * create row for row filter to evaluate expression
    +   */
    +  private RowIntf createRow(RowIntf value, int dimOrdinalMax) throws IOException {
    +    Object[] record = new Object[value.size()];
    +    String memberString;
    +    for (int i = 0; i < dimColEvaluatorInfoList.size(); i++) {
    +      DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = dimColEvaluatorInfoList.get(i);
    +      int index = dimColumnEvaluatorInfo.getDimension().getOrdinal();
    +      // if filter dimension is not present in the current add its default value
    +      if (!isDimensionPresentInCurrentBlock[i]) {
    +        // fill default value here
    +        record[index] = getDimensionDefaultValue(dimColumnEvaluatorInfo);
    +        continue;
    +      }
    +      if (!dimColumnEvaluatorInfo.getDimension().getDataType().isComplexType()) {
    +        if (!dimColumnEvaluatorInfo.isDimensionExistsInCurrentSilce()) {
    +          record[index] = dimColumnEvaluatorInfo.getDimension().getDefaultValue();
    +        }
    +        byte[] memberBytes = (byte[]) value.getVal(index);
    +        if (!dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DICTIONARY)) {
    +          if (null != memberBytes) {
    +            if (Arrays.equals(CarbonCommonConstants.MEMBER_DEFAULT_VAL_ARRAY, memberBytes)) {
    +              memberBytes = null;
    +            } else if (memberBytes.length == 0) {
    +              memberBytes = null;
    +            }
    +            record[index] = DataTypeUtil.getDataBasedOnDataTypeForNoDictionaryColumn(memberBytes,
    +                dimColumnEvaluatorInfo.getDimension().getDataType());
    +          }
    +        } else {
    +          int dictionaryValue = ByteUtil.toInt(memberBytes, 0);
    +          if (dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DICTIONARY)
    +              && !dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
    +            memberString =
    +                getFilterActualValueFromDictionaryValue(dimColumnEvaluatorInfo, dictionaryValue);
    +            record[index] = DataTypeUtil.getDataBasedOnDataType(memberString,
    +                dimColumnEvaluatorInfo.getDimension().getDataType());
    +          } else if (
    +              dimColumnEvaluatorInfo.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
    +            Object member = getFilterActualValueFromDirectDictionaryValue(dimColumnEvaluatorInfo,
    +                dictionaryValue);
    +            record[index] = member;
    +          }
    +        }
    +      } else {
    +        record[index] = value.getVal(index);
    +      }
    +    }
    +
    +    for (int i = 0; i < msrColEvalutorInfoList.size(); i++) {
    +      MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = msrColEvalutorInfoList.get(i);
    +      int index = msrColumnEvalutorInfo.getMeasure().getOrdinal() + dimOrdinalMax;
    +      // add default value for the measure in case filter measure is not present
    +      // in the current block measure list
    +      if (!isMeasurePresentInCurrentBlock[i]) {
    +        byte[] defaultValue = msrColumnEvalutorInfo.getCarbonColumn().getDefaultValue();
    +        record[index] = RestructureUtil
    +            .getMeasureDefaultValue(msrColumnEvalutorInfo.getCarbonColumn().getColumnSchema(),
    --- End diff --
    
    move `. getMeasureDefaultValue` to previous line


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3661/



---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3883/



---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3878/



---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3659/



---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    please add PR description


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    LGTM


---

[GitHub] carbondata issue #1996: [CARBONDATA-2200] Fix bug of LIKE operation on strea...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1996
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3880/



---

[GitHub] carbondata pull request #1996: [CARBONDATA-2200] Fix bug of LIKE operation o...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1996#discussion_r170451613
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java ---
    @@ -276,12 +277,82 @@ public BitSetGroup applyFilter(BlocksChunkHolder blockChunkHolder, boolean useBi
       public boolean applyFilter(RowIntf value, int dimOrdinalMax)
           throws FilterUnsupportedException, IOException {
         try {
    -      return exp.evaluate(value).getBoolean();
    +      Boolean result = exp.evaluate(createRow(value, dimOrdinalMax)).getBoolean();
    +      return result == null ? false : result;
         } catch (FilterIllegalMemberException e) {
           throw new FilterUnsupportedException(e);
         }
       }
     
    +  /**
    +   * create row for row filter to evaluate expression
    +   */
    +  private RowIntf createRow(RowIntf value, int dimOrdinalMax) throws IOException {
    +    Object[] record = new Object[value.size()];
    +    String memberString;
    +    for (int i = 0; i < dimColEvaluatorInfoList.size(); i++) {
    +      DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = dimColEvaluatorInfoList.get(i);
    +      int index = dimColumnEvaluatorInfo.getDimension().getOrdinal();
    +      // if filter dimension is not present in the current add its default value
    +      if (!isDimensionPresentInCurrentBlock[i]) {
    +        // fill default value here
    +        record[index] = getDimensionDefaultValue(dimColumnEvaluatorInfo);
    +        continue;
    --- End diff --
    
    give comment why continue


---