carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvramana <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #641: [CARBONDATA-767] Alter table support...
Date Tue, 14 Mar 2017 17:31:04 GMT
Github user gvramana commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/641#discussion_r105913851
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/scan/executor/util/RestructureUtil.java
---
    @@ -38,37 +52,174 @@
        * table blocks in that case we need to select only those dimension out of
        * query dimension which is present in the current table block
        *
    +   * @param blockExecutionInfo
        * @param queryDimensions
        * @param tableBlockDimensions
    +   * @param tableComplexDimension
        * @return list of query dimension which is present in the table block
        */
    -  public static List<QueryDimension> getUpdatedQueryDimension(List<QueryDimension>
queryDimensions,
    +  public static List<QueryDimension> createDimensionInfoAndGetUpdatedQueryDimension(
    +      BlockExecutionInfo blockExecutionInfo, List<QueryDimension> queryDimensions,
           List<CarbonDimension> tableBlockDimensions, List<CarbonDimension> tableComplexDimension)
{
         List<QueryDimension> presentDimension =
             new ArrayList<QueryDimension>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
    +    boolean[] isDimensionExists = new boolean[queryDimensions.size()];
    +    Object[] defaultValues = new Object[queryDimensions.size()];
         // selecting only those dimension which is present in the query
    +    int dimIndex = 0;
         for (QueryDimension queryDimension : queryDimensions) {
           if (queryDimension.getDimension().hasEncoding(Encoding.IMPLICIT)) {
             presentDimension.add(queryDimension);
    +        isDimensionExists[dimIndex] = true;
           } else {
             for (CarbonDimension tableDimension : tableBlockDimensions) {
    -          if (tableDimension.equals(queryDimension.getDimension())) {
    -            presentDimension.add(queryDimension);
    +          if (tableDimension.getColumnId().equals(queryDimension.getDimension().getColumnId()))
{
    +            QueryDimension currentBlockDimension = new QueryDimension(tableDimension.getColName());
    +            tableDimension.getColumnSchema()
    +                .setDataType(queryDimension.getDimension().getDataType());
    +            tableDimension.getColumnSchema()
    +                .setPrecision(queryDimension.getDimension().getColumnSchema().getPrecision());
    +            tableDimension.getColumnSchema()
    +                .setScale(queryDimension.getDimension().getColumnSchema().getScale());
    +            tableDimension.getColumnSchema()
    +                .setDefaultValue(queryDimension.getDimension().getDefaultValue());
    +            currentBlockDimension.setDimension(tableDimension);
    +            currentBlockDimension.setQueryOrder(queryDimension.getQueryOrder());
    +            presentDimension.add(currentBlockDimension);
    +            isDimensionExists[dimIndex] = true;
    +            break;
               }
             }
    +        // add default value only in case query dimension is not found in the current
block
    +        if (!isDimensionExists[dimIndex]) {
    +          defaultValues[dimIndex] = validateAndGetDefaultValue(queryDimension.getDimension());
    +          blockExecutionInfo.setRestructuredBlock(true);
    --- End diff --
    
    This has to be set only if complex dimension also does not match


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message