Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590183 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java --- @@ -206,4 +202,68 @@ public void setStorePath(String storePath) { } return true; } + + /** + * This method will return the table size. Default table block size will be considered + * in case not specified by the user + */ + int getTableBlockSizeInMB() { + String tableBlockSize = null; + // In case of old store there will not be any map for table properties so table properties + // will be null + Map<String, String> tableProperties = getFactTable().getTableProperties(); + if (null != tableProperties) { + tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE); + } + if (null == tableBlockSize) { + tableBlockSize = CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL; + LOGGER.info("Table block size not specified for " + getTableUniqueName() + + ". Therefore considering the default value " + + CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL + " MB"); + } + return Integer.parseInt(tableBlockSize); + } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, databaseName); + WritableUtil.writeString(out, tableUniqueName); + factTable.write(out); + out.writeLong(lastUpdatedTime); + WritableUtil.writeString(out, metaDataFilepath); + WritableUtil.writeString(out, storePath); + } + + @Override + public void readFields(DataInput in) throws IOException { + this.databaseName = WritableUtil.readString(in); + this.tableUniqueName = WritableUtil.readString(in); + this.factTable = new TableSchema(); + this.factTable.readFields(in); + this.lastUpdatedTime = in.readLong(); + this.metaDataFilepath = WritableUtil.readString(in); + this.storePath = WritableUtil.readString(in); + } + + public AbsoluteTableIdentifier getOrCreateAbsoluteTableIdentifier() { + if (identifier == null) { + CarbonTableIdentifier carbontableIdentifier = + new CarbonTableIdentifier(databaseName, factTable.getTableName(), factTable.getTableId()); + identifier = new AbsoluteTableIdentifier(storePath, carbontableIdentifier); + } + return identifier; + } + + public byte[] serielize() throws IOException { + ByteArrayOutputStream bao = new ByteArrayOutputStream(); + this.write(new DataOutputStream(bao)); + return bao.toByteArray(); + } + + public static TableInfo deserielize(byte[] bytes) throws IOException { --- End diff -- Typo, change to `deserialize` --- 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 a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590258 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java --- @@ -198,4 +201,28 @@ public PartitionInfo getPartitionInfo() { public void setPartitionInfo(PartitionInfo partitionInfo) { this.partitionInfo = partitionInfo; } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, tableId); --- End diff -- please use `out.writeUTF` --- 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 a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590492 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/column/ColumnSchema.java --- @@ -421,4 +418,67 @@ public boolean isSortColumn() { public void setSortColumn(boolean sortColumn) { isSortColumn = sortColumn; } + + @Override + public void write(DataOutput out) throws IOException { + out.writeInt(dataType.ordinal()); + WritableUtil.writeString(out, columnName); + WritableUtil.writeString(out, columnUniqueId); + WritableUtil.writeString(out, columnReferenceId); + if (encodingList == null) { + out.writeInt(0); + } else { + out.writeInt(encodingList.size()); + for (Encoding encoding : encodingList) { + out.writeInt(encoding.ordinal()); + } + } + out.writeBoolean(isDimensionColumn); + out.writeInt(scale); + out.writeInt(precision); + out.writeInt(schemaOrdinal); + out.writeInt(numberOfChild); --- End diff -- please use short instead of using int --- 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 a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590547 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/WritableUtil.java --- @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.carbondata.core.metadata.schema.table; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class WritableUtil { + + public static void writeString(DataOutput out, String string) throws IOException { --- End diff -- no need of this method, use out.writeUTF --- 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 a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590596 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java --- @@ -19,7 +19,14 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; -import java.util.*; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; --- End diff -- use `import java.util.*` --- 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 a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590721 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java --- @@ -101,51 +109,50 @@ private static final String FILTER_PREDICATE = "mapreduce.input.carboninputformat.filter.predicate"; private static final String COLUMN_PROJECTION = "mapreduce.input.carboninputformat.projection"; - private static final String CARBON_TABLE = "mapreduce.input.carboninputformat.table"; + private static final String TABLE_INFO = "mapreduce.input.carboninputformat.tableinfo"; private static final String CARBON_READ_SUPPORT = "mapreduce.input.carboninputformat.readsupport"; + // a cache for carbon table, it will be used in task side + private CarbonTable carbonTable; + /** - * It is optional, if user does not set then it reads from store - * - * @param configuration - * @param carbonTable - * @throws IOException + * Set the `tableInfo` in `configuration` */ - public static void setCarbonTable(Configuration configuration, CarbonTable carbonTable) + public static void setTableInfo(Configuration configuration, TableInfo tableInfo) throws IOException { - if (null != carbonTable) { - configuration.set(CARBON_TABLE, ObjectSerializationUtil.convertObjectToString(carbonTable)); + if (null != tableInfo) { + configuration.set(TABLE_INFO, ObjectSerializationUtil.convertObjectToString(tableInfo)); } } - public static CarbonTable getCarbonTable(Configuration configuration) throws IOException { - String carbonTableStr = configuration.get(CARBON_TABLE); - if (carbonTableStr == null) { - populateCarbonTable(configuration); - // read it from schema file in the store - carbonTableStr = configuration.get(CARBON_TABLE); - return (CarbonTable) ObjectSerializationUtil.convertStringToObject(carbonTableStr); - } - return (CarbonTable) ObjectSerializationUtil.convertStringToObject(carbonTableStr); + /** + * Get TableInfo object from `configuration` + */ + private TableInfo getTableInfo(Configuration configuration) throws IOException { + String tableInfoStr = configuration.get(TABLE_INFO); --- End diff -- is null check required for `tableInfoStr` ? --- 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 a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126590815 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java --- @@ -208,17 +215,14 @@ public static void setSegmentsToAccess(Configuration configuration, List<String> .set(CarbonInputFormat.INPUT_SEGMENT_NUMBERS, CarbonUtil.getSegmentString(validSegments)); } - /** - * Set list of files to access - */ - public static void setFilesToAccess(Configuration configuration, List<String> validFiles) { --- End diff -- it seems this method is added by some out side contributor recently to set the files to read, so better keep it --- 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 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126597904 --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/block/AbstractIndex.java --- @@ -69,7 +69,7 @@ public SegmentProperties getSegmentProperties() { return segmentProperties; } - /** + /**` --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126597920 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java --- @@ -18,10 +18,14 @@ package org.apache.carbondata.core.metadata.schema.table; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126597983 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java --- @@ -206,4 +202,68 @@ public void setStorePath(String storePath) { } return true; } + + /** + * This method will return the table size. Default table block size will be considered + * in case not specified by the user + */ + int getTableBlockSizeInMB() { + String tableBlockSize = null; + // In case of old store there will not be any map for table properties so table properties + // will be null + Map<String, String> tableProperties = getFactTable().getTableProperties(); + if (null != tableProperties) { + tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE); + } + if (null == tableBlockSize) { + tableBlockSize = CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL; + LOGGER.info("Table block size not specified for " + getTableUniqueName() + + ". Therefore considering the default value " + + CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL + " MB"); + } + return Integer.parseInt(tableBlockSize); + } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, databaseName); + WritableUtil.writeString(out, tableUniqueName); + factTable.write(out); + out.writeLong(lastUpdatedTime); + WritableUtil.writeString(out, metaDataFilepath); + WritableUtil.writeString(out, storePath); + } + + @Override + public void readFields(DataInput in) throws IOException { + this.databaseName = WritableUtil.readString(in); + this.tableUniqueName = WritableUtil.readString(in); + this.factTable = new TableSchema(); + this.factTable.readFields(in); + this.lastUpdatedTime = in.readLong(); + this.metaDataFilepath = WritableUtil.readString(in); + this.storePath = WritableUtil.readString(in); + } + + public AbsoluteTableIdentifier getOrCreateAbsoluteTableIdentifier() { + if (identifier == null) { + CarbonTableIdentifier carbontableIdentifier = + new CarbonTableIdentifier(databaseName, factTable.getTableName(), factTable.getTableId()); + identifier = new AbsoluteTableIdentifier(storePath, carbontableIdentifier); + } + return identifier; + } + + public byte[] serielize() throws IOException { --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126598004 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java --- @@ -206,4 +202,68 @@ public void setStorePath(String storePath) { } return true; } + + /** + * This method will return the table size. Default table block size will be considered + * in case not specified by the user + */ + int getTableBlockSizeInMB() { + String tableBlockSize = null; + // In case of old store there will not be any map for table properties so table properties + // will be null + Map<String, String> tableProperties = getFactTable().getTableProperties(); + if (null != tableProperties) { + tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE); + } + if (null == tableBlockSize) { + tableBlockSize = CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL; + LOGGER.info("Table block size not specified for " + getTableUniqueName() + + ". Therefore considering the default value " + + CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL + " MB"); + } + return Integer.parseInt(tableBlockSize); + } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, databaseName); + WritableUtil.writeString(out, tableUniqueName); + factTable.write(out); + out.writeLong(lastUpdatedTime); + WritableUtil.writeString(out, metaDataFilepath); + WritableUtil.writeString(out, storePath); + } + + @Override + public void readFields(DataInput in) throws IOException { + this.databaseName = WritableUtil.readString(in); + this.tableUniqueName = WritableUtil.readString(in); + this.factTable = new TableSchema(); + this.factTable.readFields(in); + this.lastUpdatedTime = in.readLong(); + this.metaDataFilepath = WritableUtil.readString(in); + this.storePath = WritableUtil.readString(in); + } + + public AbsoluteTableIdentifier getOrCreateAbsoluteTableIdentifier() { + if (identifier == null) { + CarbonTableIdentifier carbontableIdentifier = + new CarbonTableIdentifier(databaseName, factTable.getTableName(), factTable.getTableId()); + identifier = new AbsoluteTableIdentifier(storePath, carbontableIdentifier); + } + return identifier; + } + + public byte[] serielize() throws IOException { + ByteArrayOutputStream bao = new ByteArrayOutputStream(); + this.write(new DataOutputStream(bao)); + return bao.toByteArray(); + } + + public static TableInfo deserielize(byte[] bytes) throws IOException { --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126598180 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java --- @@ -19,7 +19,14 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; -import java.util.*; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126598388 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java --- @@ -101,51 +109,50 @@ private static final String FILTER_PREDICATE = "mapreduce.input.carboninputformat.filter.predicate"; private static final String COLUMN_PROJECTION = "mapreduce.input.carboninputformat.projection"; - private static final String CARBON_TABLE = "mapreduce.input.carboninputformat.table"; + private static final String TABLE_INFO = "mapreduce.input.carboninputformat.tableinfo"; private static final String CARBON_READ_SUPPORT = "mapreduce.input.carboninputformat.readsupport"; + // a cache for carbon table, it will be used in task side + private CarbonTable carbonTable; + /** - * It is optional, if user does not set then it reads from store - * - * @param configuration - * @param carbonTable - * @throws IOException + * Set the `tableInfo` in `configuration` */ - public static void setCarbonTable(Configuration configuration, CarbonTable carbonTable) + public static void setTableInfo(Configuration configuration, TableInfo tableInfo) throws IOException { - if (null != carbonTable) { - configuration.set(CARBON_TABLE, ObjectSerializationUtil.convertObjectToString(carbonTable)); + if (null != tableInfo) { + configuration.set(TABLE_INFO, ObjectSerializationUtil.convertObjectToString(tableInfo)); } } - public static CarbonTable getCarbonTable(Configuration configuration) throws IOException { - String carbonTableStr = configuration.get(CARBON_TABLE); - if (carbonTableStr == null) { - populateCarbonTable(configuration); - // read it from schema file in the store - carbonTableStr = configuration.get(CARBON_TABLE); - return (CarbonTable) ObjectSerializationUtil.convertStringToObject(carbonTableStr); - } - return (CarbonTable) ObjectSerializationUtil.convertStringToObject(carbonTableStr); + /** + * Get TableInfo object from `configuration` + */ + private TableInfo getTableInfo(Configuration configuration) throws IOException { + String tableInfoStr = configuration.get(TABLE_INFO); --- End diff -- It is checked inside `convertStringToObject` --- 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 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126598615 --- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java --- @@ -208,17 +215,14 @@ public static void setSegmentsToAccess(Configuration configuration, List<String> .set(CarbonInputFormat.INPUT_SEGMENT_NUMBERS, CarbonUtil.getSegmentString(validSegments)); } - /** - * Set list of files to access - */ - public static void setFilesToAccess(Configuration configuration, List<String> validFiles) { --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126598933 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/column/ColumnSchema.java --- @@ -421,4 +418,67 @@ public boolean isSortColumn() { public void setSortColumn(boolean sortColumn) { isSortColumn = sortColumn; } + + @Override + public void write(DataOutput out) throws IOException { + out.writeInt(dataType.ordinal()); + WritableUtil.writeString(out, columnName); + WritableUtil.writeString(out, columnUniqueId); + WritableUtil.writeString(out, columnReferenceId); + if (encodingList == null) { + out.writeInt(0); + } else { + out.writeInt(encodingList.size()); + for (Encoding encoding : encodingList) { + out.writeInt(encoding.ordinal()); + } + } + out.writeBoolean(isDimensionColumn); + out.writeInt(scale); + out.writeInt(precision); + out.writeInt(schemaOrdinal); + out.writeInt(numberOfChild); --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126603309 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java --- @@ -198,4 +201,28 @@ public PartitionInfo getPartitionInfo() { public void setPartitionInfo(PartitionInfo partitionInfo) { this.partitionInfo = partitionInfo; } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, tableId); --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126603318 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/WritableUtil.java --- @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.carbondata.core.metadata.schema.table; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class WritableUtil { + + public static void writeString(DataOutput out, String string) throws IOException { --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126603344 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java --- @@ -206,4 +202,68 @@ public void setStorePath(String storePath) { } return true; } + + /** + * This method will return the table size. Default table block size will be considered + * in case not specified by the user + */ + int getTableBlockSizeInMB() { + String tableBlockSize = null; + // In case of old store there will not be any map for table properties so table properties + // will be null + Map<String, String> tableProperties = getFactTable().getTableProperties(); + if (null != tableProperties) { + tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE); + } + if (null == tableBlockSize) { + tableBlockSize = CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL; + LOGGER.info("Table block size not specified for " + getTableUniqueName() + + ". Therefore considering the default value " + + CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL + " MB"); + } + return Integer.parseInt(tableBlockSize); + } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, databaseName); + WritableUtil.writeString(out, tableUniqueName); + factTable.write(out); + out.writeLong(lastUpdatedTime); + WritableUtil.writeString(out, metaDataFilepath); + WritableUtil.writeString(out, storePath); + } + + @Override + public void readFields(DataInput in) throws IOException { + this.databaseName = WritableUtil.readString(in); --- 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 jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1146#discussion_r126603356 --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java --- @@ -206,4 +202,68 @@ public void setStorePath(String storePath) { } return true; } + + /** + * This method will return the table size. Default table block size will be considered + * in case not specified by the user + */ + int getTableBlockSizeInMB() { + String tableBlockSize = null; + // In case of old store there will not be any map for table properties so table properties + // will be null + Map<String, String> tableProperties = getFactTable().getTableProperties(); + if (null != tableProperties) { + tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE); + } + if (null == tableBlockSize) { + tableBlockSize = CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL; + LOGGER.info("Table block size not specified for " + getTableUniqueName() + + ". Therefore considering the default value " + + CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL + " MB"); + } + return Integer.parseInt(tableBlockSize); + } + + @Override + public void write(DataOutput out) throws IOException { + WritableUtil.writeString(out, databaseName); --- 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/1146 Build Failed with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/425/ --- 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 |