jackylk commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server
URL:
https://github.com/apache/carbondata/pull/3177#discussion_r277920410
##########
File path: core/src/main/java/org/apache/carbondata/core/datamap/DistributableDataMapFormat.java
##########
@@ -154,4 +200,74 @@ public void close() throws IOException {
};
}
+ public CarbonTable getCarbonTable() {
+ return table;
+ }
+
+ @Override public void write(DataOutput out) throws IOException {
+ table.write(out);
+ out.writeInt(invalidSegments.size());
+ for (String invalidSegment : invalidSegments) {
+ out.writeUTF(invalidSegment);
+ }
+ out.writeBoolean(isJobToClearDataMaps);
+ out.writeBoolean(isFallbackJob);
+ if (dataMapLevel == null) {
+ out.writeBoolean(false);
+ } else {
+ out.writeBoolean(true);
+ out.writeUTF(dataMapLevel.name());
+ }
+ byte[] readCommittedBytes = ObjectSerializationUtil.convertObjectToString(readCommittedScope)
+ .getBytes(Charset.defaultCharset());
+ out.writeInt(readCommittedBytes.length);
+ out.write(readCommittedBytes);
+ out.writeInt(validSegments.size());
+ for (Segment segment : validSegments) {
+ segment.write(out);
+ }
+ out.writeUTF(ObjectSerializationUtil.convertObjectToString(partitions));
+ }
+
+ @Override public void readFields(DataInput in) throws IOException {
+ this.table = new CarbonTable();
+ table.readFields(in);
+ int invalidSegmentSize = in.readInt();
+ invalidSegments = new ArrayList<>();
+ for (int i = 0; i < invalidSegmentSize; i++) {
+ invalidSegments.add(in.readUTF());
+ }
+ this.isJobToClearDataMaps = in.readBoolean();
+ this.isFallbackJob = in.readBoolean();
+ if (in.readBoolean()) {
+ this.dataMapLevel = DataMapLevel.valueOf(in.readUTF());
+ }
+ byte[] readCommittedBytes = new byte[in.readInt()];
+ in.readFully(readCommittedBytes);
+ this.readCommittedScope = (ReadCommittedScope) ObjectSerializationUtil
+ .convertStringToObject(new String(readCommittedBytes, Charset.defaultCharset()));
+ int validSegmentSize = in.readInt();
+ validSegments = new ArrayList<>();
Review comment:
```suggestion
validSegments = new ArrayList<>(validSegmentSize);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]
With regards,
Apache Git Services