[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:NonTransactional tabl...

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2299: [CARBONDATA-2472] Fixed:Refactor NonTransactional ta...

qiuchenjian-2
Github user ravipesala commented on the issue:

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



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2299: [CARBONDATA-2472] Fixed:Refactor NonTransactional ta...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

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



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2299: [CARBONDATA-2472] Fixed:Refactor NonTransactional ta...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

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



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2299: [CARBONDATA-2472] Fixed:Refactor NonTransactional ta...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

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



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:Refactor NonTransacti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2299#discussion_r188624043
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java ---
    @@ -115,13 +123,55 @@ public DataMapBuilder createBuilder(Segment segment, String shardName) {
         Set<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers =
             segmentMap.get(segment.getSegmentNo());
         if (tableBlockIndexUniqueIdentifiers == null) {
    +      CarbonTable carbonTable = this.getCarbonTable();
    +      if (!carbonTable.getTableInfo().isTransactionalTable()) {
    +        // For NonTransactional table, compare the schema of all index files with inferred schema.
    +        // If there is a mismatch throw exception. As all files must be of same schema.
    +        validateSchemaForNewTranscationalTableFiles(segment, carbonTable);
    +      }
           tableBlockIndexUniqueIdentifiers =
               BlockletDataMapUtil.getTableBlockUniqueIdentifiers(segment);
           segmentMap.put(segment.getSegmentNo(), tableBlockIndexUniqueIdentifiers);
         }
         return tableBlockIndexUniqueIdentifiers;
       }
     
    +  private void validateSchemaForNewTranscationalTableFiles(Segment segment, CarbonTable carbonTable)
    +      throws IOException {
    +    SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl();
    +    Map<String, String> indexFiles = segment.getCommittedIndexFile();
    +    for (Map.Entry<String, String> indexFileEntry : indexFiles.entrySet()) {
    +      Path indexFile = new Path(indexFileEntry.getKey());
    --- End diff --
   
    In below logs, we need to print just the index file name. Hence path object getName() is used.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:Refactor NonTransacti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2299#discussion_r188625173
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java ---
    @@ -297,7 +297,7 @@ public TableDataMap registerDataMap(CarbonTable table,
             dataMapSchema, dataMapFactory, blockletDetailsFetcher, segmentPropertiesFetcher);
     
         tableIndices.add(dataMap);
    -    allDataMaps.put(tableUniqueName, tableIndices);
    +    allDataMaps.put(tableUniqueName.toLowerCase(), tableIndices);
    --- End diff --
   
    I found the actual bug, for external table, during table creation itself table name and db name was not converted to lowercase, because of this if table name is not in lowercase, when drop table, blocklet datamap was not getting cleared.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:Refactor NonTransacti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2299#discussion_r188625272
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java ---
    @@ -115,13 +123,55 @@ public DataMapBuilder createBuilder(Segment segment, String shardName) {
         Set<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers =
             segmentMap.get(segment.getSegmentNo());
         if (tableBlockIndexUniqueIdentifiers == null) {
    +      CarbonTable carbonTable = this.getCarbonTable();
    +      if (!carbonTable.getTableInfo().isTransactionalTable()) {
    +        // For NonTransactional table, compare the schema of all index files with inferred schema.
    +        // If there is a mismatch throw exception. As all files must be of same schema.
    +        validateSchemaForNewTranscationalTableFiles(segment, carbonTable);
    +      }
           tableBlockIndexUniqueIdentifiers =
               BlockletDataMapUtil.getTableBlockUniqueIdentifiers(segment);
           segmentMap.put(segment.getSegmentNo(), tableBlockIndexUniqueIdentifiers);
         }
         return tableBlockIndexUniqueIdentifiers;
       }
     
    +  private void validateSchemaForNewTranscationalTableFiles(Segment segment, CarbonTable carbonTable)
    +      throws IOException {
    +    SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl();
    +    Map<String, String> indexFiles = segment.getCommittedIndexFile();
    +    for (Map.Entry<String, String> indexFileEntry : indexFiles.entrySet()) {
    +      Path indexFile = new Path(indexFileEntry.getKey());
    +      org.apache.carbondata.format.TableInfo tableInfo = CarbonUtil.inferSchemaFromIndexFile(
    +          indexFile.toString(), carbonTable.getTableName());
    +      TableInfo wrapperTableInfo = schemaConverter.fromExternalToWrapperTableInfo(
    +          tableInfo, identifier.getDatabaseName(),
    +          identifier.getTableName(),
    +          identifier.getTablePath());
    +      List<ColumnSchema> indexFileColumnList =
    +          wrapperTableInfo.getFactTable().getListOfColumns();
    +      List<ColumnSchema> tableColumnList =
    +          carbonTable.getTableInfo().getFactTable().getListOfColumns();
    +      if (!compareColumnSchemaList(indexFileColumnList, tableColumnList)) {
    +        LOG.error("Schema of " + indexFile.getName()
    +            + " doesn't match with the table's schema");
    +        throw new IOException("All the files doesn't have same schema. "
    +            + "Unsupported operation on nonTransactional table. Check logs.");
    +      }
    +    }
    +  }
    +
    +  private boolean compareColumnSchemaList(List<ColumnSchema> indexFileColumnList,
    +      List<ColumnSchema> tableColumnList) {
    +    if (indexFileColumnList.size() != tableColumnList.size()) {
    +      return false;
    --- End diff --
   
    Added detail logs in this flow


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:Refactor NonTransacti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2299#discussion_r188626030
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java ---
    @@ -115,13 +123,55 @@ public DataMapBuilder createBuilder(Segment segment, String shardName) {
         Set<TableBlockIndexUniqueIdentifier> tableBlockIndexUniqueIdentifiers =
             segmentMap.get(segment.getSegmentNo());
         if (tableBlockIndexUniqueIdentifiers == null) {
    +      CarbonTable carbonTable = this.getCarbonTable();
    +      if (!carbonTable.getTableInfo().isTransactionalTable()) {
    +        // For NonTransactional table, compare the schema of all index files with inferred schema.
    +        // If there is a mismatch throw exception. As all files must be of same schema.
    +        validateSchemaForNewTranscationalTableFiles(segment, carbonTable);
    +      }
           tableBlockIndexUniqueIdentifiers =
               BlockletDataMapUtil.getTableBlockUniqueIdentifiers(segment);
           segmentMap.put(segment.getSegmentNo(), tableBlockIndexUniqueIdentifiers);
         }
         return tableBlockIndexUniqueIdentifiers;
       }
     
    +  private void validateSchemaForNewTranscationalTableFiles(Segment segment, CarbonTable carbonTable)
    +      throws IOException {
    +    SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl();
    +    Map<String, String> indexFiles = segment.getCommittedIndexFile();
    +    for (Map.Entry<String, String> indexFileEntry : indexFiles.entrySet()) {
    +      Path indexFile = new Path(indexFileEntry.getKey());
    +      org.apache.carbondata.format.TableInfo tableInfo = CarbonUtil.inferSchemaFromIndexFile(
    +          indexFile.toString(), carbonTable.getTableName());
    +      TableInfo wrapperTableInfo = schemaConverter.fromExternalToWrapperTableInfo(
    +          tableInfo, identifier.getDatabaseName(),
    +          identifier.getTableName(),
    +          identifier.getTablePath());
    +      List<ColumnSchema> indexFileColumnList =
    +          wrapperTableInfo.getFactTable().getListOfColumns();
    +      List<ColumnSchema> tableColumnList =
    +          carbonTable.getTableInfo().getFactTable().getListOfColumns();
    +      if (!compareColumnSchemaList(indexFileColumnList, tableColumnList)) {
    +        LOG.error("Schema of " + indexFile.getName()
    +            + " doesn't match with the table's schema");
    +        throw new IOException("All the files doesn't have same schema. "
    +            + "Unsupported operation on nonTransactional table. Check logs.");
    +      }
    +    }
    +  }
    +
    +  private boolean compareColumnSchemaList(List<ColumnSchema> indexFileColumnList,
    --- End diff --
   
    @xuchuanyin : Changed  the method name as suggested


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:Refactor NonTransacti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2299#discussion_r188627098
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -401,6 +401,11 @@ public static Object getDataDataTypeForNoDictionaryColumn(String dimensionValue,
         } else if (actualDataType == DataTypes.LONG) {
           return ByteUtil.toBytes((Long) dimensionValue);
         } else if (actualDataType == DataTypes.TIMESTAMP) {
    +      if (dimensionValue instanceof String) {
    --- End diff --
   
    This fix is removed from this PR as it is not applicable


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2299: [CARBONDATA-2472] Fixed:Refactor NonTransactional ta...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on the issue:

    https://github.com/apache/carbondata/pull/2299
 
    @ravipesala : please review


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2299: [CARBONDATA-2472] Fixed:Refactor NonTransactional ta...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

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


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2299: [CARBONDATA-2472] Fixed:Refactor NonTransacti...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user asfgit closed the pull request at:

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


---
12