You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by kunal642 <gi...@git.apache.org> on 2018/11/27 08:52:54 UTC

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

GitHub user kunal642 opened a pull request:

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

    [CARBONDATA-3134] fixed null values when cachelevel is set as blocklet

    **Problem:**
    For each blocklet an object of SegmentPropertiesAndSchemaHolder is created to store the schema used for query. This object is created only if no other blocklet has the same schema. To check the schema we are comparing List<ColumnSchema>, as the equals method in ColumnSchema does not check for columnUniqueId therefore this check is failing and the new restructured blocklet is using the schema of the old blocklet. Due to this the newly added column is being ignored as the old blocklet schema specifies that the column is delete(alter drop).
    
    **Solution:**
    Instead of checking the equality through equals and hashcode, write a new implementation for both and check based on columnUniqueId.
    
    Be sure to do all of the following checklist to help us incorporate 
    your contribution quickly and easily:
    
     - [ ] Any interfaces changed?
     
     - [ ] Any backward compatibility impacted?
     
     - [ ] Document update required?
    
     - [ ] Testing done
            Please provide details on 
            - Whether new unit test cases have been added or why no new tests are required?
            - 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.
           
     - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. 
    


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

    $ git pull https://github.com/kunal642/carbondata bug/CARBONDATA-3134

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

    https://github.com/apache/carbondata/pull/2956.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 #2956
    
----
commit e74b3f22d285f5b5c37b17a11248b5e7977326b2
Author: kunal642 <ku...@...>
Date:   2018-11-27T08:43:27Z

    [CARBONDATA-3134] fixed null values when cachelevel is set as blocklet
    
    Problem:
    For each blocklet an object of SegmentPropertiesAndSchemaHolder is created to store the schema used for query. This object is created only if no other blocklet has the same schema. To check the schema we are comparing List<ColumnSchema>, as the equals method in ColumnSchema does not check for columnUniqueId therefore this check is failing and the new restructured blocklet is using the schema of the old blocklet. Due to this the newly added column is being ignored as the old blocklet schema specifies that the column is delete(alter drop).
    
    Solution:
    Instead of checking the equality through equals and hashcode, write a new implementation for both and check based on columnUniqueId.

----


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1763/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

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


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1773/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed  with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9823/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1567/



---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236646004
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    +      List<ColumnSchema> clonedObj2 = new ArrayList<>(obj2);
    +      clonedObj1.addAll(obj1);
    +      clonedObj2.addAll(obj2);
    +      Collections.sort(clonedObj1, new Comparator<ColumnSchema>() {
    +        @Override public int compare(ColumnSchema o1, ColumnSchema o2) {
    +          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
    +        }
    +      });
    +      Collections.sort(clonedObj2, new Comparator<ColumnSchema>() {
    +        @Override public int compare(ColumnSchema o1, ColumnSchema o2) {
    +          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
    +        }
    +      });
    +      boolean exists = true;
    +      for (int i = 0; i < obj1.size(); i++) {
    +        if (!clonedObj1.get(i).equalsWithColumnId(clonedObj2.get(i))) {
    +          exists = false;
    +          break;
    +        }
    +      }
    +      return exists;
    +    }
    +
         @Override public int hashCode() {
    -      return tableIdentifier.hashCode() + columnsInTable.hashCode() + Arrays
    +      int hashCode = 0;
    +      for (ColumnSchema columnSchema: columnsInTable) {
    +        hashCode += columnSchema.hashCodeWithColumnId();
    --- End diff --
    
    rename variable name to `allColumnsHashCode`


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1551/



---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236768667
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    --- End diff --
    
    done


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1561/



---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236689465
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    --- End diff --
    
    I think checkColumnSchemaEquality method need consider "obj2 == null"


---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236685568
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    +      List<ColumnSchema> clonedObj2 = new ArrayList<>(obj2);
    +      clonedObj1.addAll(obj1);
    +      clonedObj2.addAll(obj2);
    +      Collections.sort(clonedObj1, new Comparator<ColumnSchema>() {
    +        @Override public int compare(ColumnSchema o1, ColumnSchema o2) {
    +          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
    +        }
    +      });
    +      Collections.sort(clonedObj2, new Comparator<ColumnSchema>() {
    --- End diff --
    
    You can optimize the duplicate code of two comparators, because they are same


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1565/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1547/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed  with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9811/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed  with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9807/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1772/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9816/



---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

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


---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236768643
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    +      List<ColumnSchema> clonedObj2 = new ArrayList<>(obj2);
    +      clonedObj1.addAll(obj1);
    +      clonedObj2.addAll(obj2);
    +      Collections.sort(clonedObj1, new Comparator<ColumnSchema>() {
    +        @Override public int compare(ColumnSchema o1, ColumnSchema o2) {
    +          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
    +        }
    +      });
    +      Collections.sort(clonedObj2, new Comparator<ColumnSchema>() {
    +        @Override public int compare(ColumnSchema o1, ColumnSchema o2) {
    +          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
    +        }
    +      });
    +      boolean exists = true;
    +      for (int i = 0; i < obj1.size(); i++) {
    +        if (!clonedObj1.get(i).equalsWithColumnId(clonedObj2.get(i))) {
    +          exists = false;
    +          break;
    +        }
    +      }
    +      return exists;
    +    }
    +
         @Override public int hashCode() {
    -      return tableIdentifier.hashCode() + columnsInTable.hashCode() + Arrays
    +      int hashCode = 0;
    +      for (ColumnSchema columnSchema: columnsInTable) {
    +        hashCode += columnSchema.hashCodeWithColumnId();
    --- End diff --
    
    done


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1562/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed  with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9819/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1759/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1557/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    @manishgupta88 Please review


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1769/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9825/



---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236644573
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    --- End diff --
    
    You can add the first check for length in the first line of method...if length of 2 lists is not same then we can return false from here itself


---

[GitHub] carbondata pull request #2956: [CARBONDATA-3134] fixed null values when cach...

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

    https://github.com/apache/carbondata/pull/2956#discussion_r236768636
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java ---
    @@ -332,13 +334,42 @@ public void clear() {
           }
           SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper other =
               (SegmentPropertiesAndSchemaHolder.SegmentPropertiesWrapper) obj;
    -      return tableIdentifier.equals(other.tableIdentifier) && columnsInTable
    -          .equals(other.columnsInTable) && Arrays
    +      return tableIdentifier.equals(other.tableIdentifier) && checkColumnSchemaEquality(
    +          columnsInTable, other.columnsInTable) && Arrays
               .equals(columnCardinality, other.columnCardinality);
         }
     
    +    private boolean checkColumnSchemaEquality(List<ColumnSchema> obj1, List<ColumnSchema> obj2) {
    +      List<ColumnSchema> clonedObj1 = new ArrayList<>(obj1);
    +      List<ColumnSchema> clonedObj2 = new ArrayList<>(obj2);
    +      clonedObj1.addAll(obj1);
    +      clonedObj2.addAll(obj2);
    +      Collections.sort(clonedObj1, new Comparator<ColumnSchema>() {
    +        @Override public int compare(ColumnSchema o1, ColumnSchema o2) {
    +          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
    +        }
    +      });
    +      Collections.sort(clonedObj2, new Comparator<ColumnSchema>() {
    --- End diff --
    
    done


---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1778/



---

[GitHub] carbondata issue #2956: [CARBONDATA-3134] fixed null values when cachelevel ...

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

    https://github.com/apache/carbondata/pull/2956
  
    Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1776/



---