Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1136#discussion_r128918164 --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java --- @@ -25,197 +25,142 @@ public class TableSpec { - // contains name and type for each dimension - private DimensionSpec dimensionSpec; - // contains name and type for each measure - private MeasureSpec measureSpec; + // column spec for each dimension and measure + private DimensionSpec[] dimensionSpec; + private MeasureSpec[] measureSpec; - public TableSpec(List<CarbonDimension> dimensions, List<CarbonMeasure> measures) { - dimensionSpec = new DimensionSpec(dimensions); - measureSpec = new MeasureSpec(measures); - } + // number of simple dimensions + private int numSimpleDimensions; - public DimensionSpec getDimensionSpec() { - return dimensionSpec; - } - - public MeasureSpec getMeasureSpec() { - return measureSpec; - } - - public class DimensionSpec { - - // field name of each dimension, in schema order - private String[] fieldName; - - // encoding type of each dimension, in schema order - private DimensionType[] types; - - // number of simple dimensions - private int numSimpleDimensions; - - // number of complex dimensions - private int numComplexDimensions; - - // number of dimensions after complex column expansion - private int numDimensionExpanded; - - DimensionSpec(List<CarbonDimension> dimensions) { - // first calculate total number of columnar field considering column group and complex column - numDimensionExpanded = 0; - numSimpleDimensions = 0; - numComplexDimensions = 0; - boolean inColumnGroup = false; - for (CarbonDimension dimension : dimensions) { - if (dimension.isColumnar()) { - if (inColumnGroup) { - inColumnGroup = false; - } - if (dimension.isComplex()) { - numDimensionExpanded += dimension.getNumDimensionsExpanded(); - numComplexDimensions++; - } else { - numDimensionExpanded++; - numSimpleDimensions++; - } - } else { - // column group - if (!inColumnGroup) { - inColumnGroup = true; - numDimensionExpanded++; - numSimpleDimensions++; - } + public TableSpec(List<CarbonDimension> dimensions, List<CarbonMeasure> measures) { + // first calculate total number of columnar field considering column group and complex column + numSimpleDimensions = 0; + for (CarbonDimension dimension : dimensions) { + if (dimension.isColumnar()) { + if (!dimension.isComplex()) { + numSimpleDimensions++; } + } else { + throw new UnsupportedOperationException("column group is not supported"); } + } + dimensionSpec = new DimensionSpec[dimensions.size()]; + measureSpec = new MeasureSpec[measures.size()]; + addDimensions(dimensions); + addMeasures(measures); + } - // then extract dimension name and type for each column - fieldName = new String[numDimensionExpanded]; - types = new DimensionType[numDimensionExpanded]; - inColumnGroup = false; - int index = 0; - for (CarbonDimension dimension : dimensions) { - if (dimension.isColumnar()) { - if (inColumnGroup) { - inColumnGroup = false; - } - if (dimension.isComplex()) { - int count = addDimension(index, dimension); - index += count; - } else if (dimension.getDataType() == DataType.TIMESTAMP || - dimension.getDataType() == DataType.DATE) { - addSimpleDimension(index++, dimension.getColName(), DimensionType.DIRECT_DICTIONARY); - } else if (dimension.isGlobalDictionaryEncoding()) { - addSimpleDimension(index++, dimension.getColName(), DimensionType.GLOBAL_DICTIONARY); - } else { - addSimpleDimension(index++, dimension.getColName(), DimensionType.PLAIN_VALUE); - } + private void addDimensions(List<CarbonDimension> dimensions) { + int dimIndex = 0; + for (int i = 0; i < dimensions.size(); i++) { + CarbonDimension dimension = dimensions.get(i); + if (dimension.isColumnar()) { + if (dimension.isComplex()) { + DimensionSpec spec = new DimensionSpec(DimensionType.COMPLEX, dimension); + dimensionSpec[dimIndex++] = spec; + } else if (dimension.getDataType() == DataType.TIMESTAMP || --- End diff -- fixed --- 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 [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1136 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/3180/ --- 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 [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1136 Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/585/ --- 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 [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/1136 LGTM --- 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 [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user jackylk closed the pull request at:
https://github.com/apache/carbondata/pull/1136 --- 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 [hidden email] or file a JIRA ticket with INFRA. --- |
Free forum by Nabble | Edit this page |