You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/03/15 03:47:01 UTC

[GitHub] [incubator-iotdb] liutaohua opened a new pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

liutaohua opened a new pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392760589
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
 Review comment:
   How about using `List` here

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392760633
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
   public TimeColumn() {
-    this(DEFAULT_INIT_SIZE);
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
+    this.writeCurListIndex = 0;
+    this.writeCurArrayIndex = 0;
+    timeRet = new ArrayList<>();
+    timeRet.add(new long[capacity]);
+    count = 0;
   }
 
-  public TimeColumn(int initSize) {
-    times = new long[initSize];
-  }
+  public TimeColumn(ArrayList<long[]> timeRet, int count) {
 
 Review comment:
   Also use `List`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392760922
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
   public TimeColumn() {
-    this(DEFAULT_INIT_SIZE);
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
+    this.writeCurListIndex = 0;
+    this.writeCurArrayIndex = 0;
+    timeRet = new ArrayList<>();
+    timeRet.add(new long[capacity]);
+    count = 0;
   }
 
-  public TimeColumn(int initSize) {
-    times = new long[initSize];
-  }
+  public TimeColumn(ArrayList<long[]> timeRet, int count) {
+    this.count = count;
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
 
+    while (capacity < capacityThreshold) {
+      capacity <<= 1;
+    }
 
-  public TimeColumn(long[] times) {
-    this.times = times;
+    this.writeCurListIndex = count / capacity;
+    this.writeCurArrayIndex = count & (capacity - 1);
+    this.timeRet = timeRet;
   }
 
   public void add(long time) {
-    if (size == times.length) {
-      long[] newArray = new long[times.length * 2];
-      System.arraycopy(times, 0, newArray, 0, times.length);
-      times = newArray;
+    if (writeCurArrayIndex == capacity) {
+      if (capacity >= capacityThreshold) {
+        timeRet.add(new long[capacity]);
+        writeCurListIndex++;
+        writeCurArrayIndex = 0;
+      } else {
+        int newCapacity = capacity << 1;
+
+        long[] newTimeData = new long[newCapacity];
+        System.arraycopy(timeRet.get(0), 0, newTimeData, 0, capacity);
+        timeRet.set(0, newTimeData);
+
+        capacity = newCapacity;
+      }
     }
-    times[size++] = time;
-  }
-
-  public long[] getTimes() {
-    return times;
+    timeRet.get(writeCurListIndex)[writeCurArrayIndex] = time;
+    writeCurArrayIndex++;
+    count++;
   }
 
   public boolean hasCurrent() {
-    return size > 0 && cur < size;
+    if (readCurListIndex < writeCurListIndex) {
+      return readCurArrayIndex < capacity;
+    } else if (readCurListIndex == writeCurListIndex) {
+      return readCurArrayIndex < writeCurArrayIndex;
+    } else {
+      return false;
+    }
 
 Review comment:
   could be simpliy:
   ```suggestion
       } else {
         return readCurListIndex == writeCurListIndex && readCurArrayIndex < writeCurArrayIndex;
       }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin merged pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
qiaojialin merged pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392772202
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
   public TimeColumn() {
-    this(DEFAULT_INIT_SIZE);
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
+    this.writeCurListIndex = 0;
+    this.writeCurArrayIndex = 0;
+    timeRet = new ArrayList<>();
+    timeRet.add(new long[capacity]);
+    count = 0;
   }
 
-  public TimeColumn(int initSize) {
-    times = new long[initSize];
-  }
+  public TimeColumn(ArrayList<long[]> timeRet, int count) {
+    this.count = count;
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
 
+    while (capacity < capacityThreshold) {
+      capacity <<= 1;
+    }
 
-  public TimeColumn(long[] times) {
-    this.times = times;
+    this.writeCurListIndex = count / capacity;
+    this.writeCurArrayIndex = count & (capacity - 1);
+    this.timeRet = timeRet;
   }
 
   public void add(long time) {
-    if (size == times.length) {
-      long[] newArray = new long[times.length * 2];
-      System.arraycopy(times, 0, newArray, 0, times.length);
-      times = newArray;
+    if (writeCurArrayIndex == capacity) {
+      if (capacity >= capacityThreshold) {
+        timeRet.add(new long[capacity]);
+        writeCurListIndex++;
+        writeCurArrayIndex = 0;
+      } else {
+        int newCapacity = capacity << 1;
+
+        long[] newTimeData = new long[newCapacity];
+        System.arraycopy(timeRet.get(0), 0, newTimeData, 0, capacity);
+        timeRet.set(0, newTimeData);
+
+        capacity = newCapacity;
+      }
     }
-    times[size++] = time;
-  }
-
-  public long[] getTimes() {
-    return times;
+    timeRet.get(writeCurListIndex)[writeCurArrayIndex] = time;
+    writeCurArrayIndex++;
+    count++;
   }
 
   public boolean hasCurrent() {
-    return size > 0 && cur < size;
+    if (readCurListIndex < writeCurListIndex) {
+      return readCurArrayIndex < capacity;
+    } else if (readCurListIndex == writeCurListIndex) {
+      return readCurArrayIndex < writeCurArrayIndex;
+    } else {
+      return false;
+    }
 
 Review comment:
   excellent advice,  exchange order will be more easy to understand

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392770415
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
   public TimeColumn() {
-    this(DEFAULT_INIT_SIZE);
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
+    this.writeCurListIndex = 0;
+    this.writeCurArrayIndex = 0;
+    timeRet = new ArrayList<>();
+    timeRet.add(new long[capacity]);
+    count = 0;
   }
 
-  public TimeColumn(int initSize) {
-    times = new long[initSize];
-  }
+  public TimeColumn(ArrayList<long[]> timeRet, int count) {
+    this.count = count;
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
 
+    while (capacity < capacityThreshold) {
+      capacity <<= 1;
+    }
 
-  public TimeColumn(long[] times) {
-    this.times = times;
+    this.writeCurListIndex = count / capacity;
+    this.writeCurArrayIndex = count & (capacity - 1);
+    this.timeRet = timeRet;
   }
 
   public void add(long time) {
-    if (size == times.length) {
-      long[] newArray = new long[times.length * 2];
-      System.arraycopy(times, 0, newArray, 0, times.length);
-      times = newArray;
+    if (writeCurArrayIndex == capacity) {
+      if (capacity >= capacityThreshold) {
+        timeRet.add(new long[capacity]);
+        writeCurListIndex++;
+        writeCurArrayIndex = 0;
+      } else {
+        int newCapacity = capacity << 1;
+
+        long[] newTimeData = new long[newCapacity];
+        System.arraycopy(timeRet.get(0), 0, newTimeData, 0, capacity);
+        timeRet.set(0, newTimeData);
+
+        capacity = newCapacity;
+      }
     }
-    times[size++] = time;
-  }
-
-  public long[] getTimes() {
-    return times;
+    timeRet.get(writeCurListIndex)[writeCurArrayIndex] = time;
+    writeCurArrayIndex++;
+    count++;
   }
 
   public boolean hasCurrent() {
-    return size > 0 && cur < size;
+    if (readCurListIndex < writeCurListIndex) {
+      return readCurArrayIndex < capacity;
+    } else if (readCurListIndex == writeCurListIndex) {
+      return readCurArrayIndex < writeCurArrayIndex;
+    } else {
+      return false;
+    }
   }
 
   public long currentTime() {
-    return times[cur];
+    return this.timeRet.get(readCurListIndex)[readCurArrayIndex];
   }
 
   public void next() {
-    cur++;
+    readCurArrayIndex++;
+    if (readCurArrayIndex == capacity) {
+      readCurArrayIndex = 0;
+      readCurListIndex++;
+    }
   }
 
-  public long getLastTime() {
-    return times[size - 1];
+  public int size() {
+    return this.count;
   }
 
-  public int size() {
-    return size;
+  public TimeColumnR asReadOnlyTimeColumn() {
+    return new TimeColumnR(timeRet, count);
+  }
+
+  private class TimeColumnR extends TimeColumn {
+
+    public TimeColumnR(ArrayList<long[]> timeRet, int count) {
 
 Review comment:
   done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392761045
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
   public TimeColumn() {
-    this(DEFAULT_INIT_SIZE);
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
+    this.writeCurListIndex = 0;
+    this.writeCurArrayIndex = 0;
+    timeRet = new ArrayList<>();
+    timeRet.add(new long[capacity]);
+    count = 0;
   }
 
-  public TimeColumn(int initSize) {
-    times = new long[initSize];
-  }
+  public TimeColumn(ArrayList<long[]> timeRet, int count) {
+    this.count = count;
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
 
+    while (capacity < capacityThreshold) {
+      capacity <<= 1;
+    }
 
-  public TimeColumn(long[] times) {
-    this.times = times;
+    this.writeCurListIndex = count / capacity;
+    this.writeCurArrayIndex = count & (capacity - 1);
+    this.timeRet = timeRet;
   }
 
   public void add(long time) {
-    if (size == times.length) {
-      long[] newArray = new long[times.length * 2];
-      System.arraycopy(times, 0, newArray, 0, times.length);
-      times = newArray;
+    if (writeCurArrayIndex == capacity) {
+      if (capacity >= capacityThreshold) {
+        timeRet.add(new long[capacity]);
+        writeCurListIndex++;
+        writeCurArrayIndex = 0;
+      } else {
+        int newCapacity = capacity << 1;
+
+        long[] newTimeData = new long[newCapacity];
+        System.arraycopy(timeRet.get(0), 0, newTimeData, 0, capacity);
+        timeRet.set(0, newTimeData);
+
+        capacity = newCapacity;
+      }
     }
-    times[size++] = time;
-  }
-
-  public long[] getTimes() {
-    return times;
+    timeRet.get(writeCurListIndex)[writeCurArrayIndex] = time;
+    writeCurArrayIndex++;
+    count++;
   }
 
   public boolean hasCurrent() {
-    return size > 0 && cur < size;
+    if (readCurListIndex < writeCurListIndex) {
+      return readCurArrayIndex < capacity;
+    } else if (readCurListIndex == writeCurListIndex) {
+      return readCurArrayIndex < writeCurArrayIndex;
+    } else {
+      return false;
+    }
   }
 
   public long currentTime() {
-    return times[cur];
+    return this.timeRet.get(readCurListIndex)[readCurArrayIndex];
   }
 
   public void next() {
-    cur++;
+    readCurArrayIndex++;
+    if (readCurArrayIndex == capacity) {
+      readCurArrayIndex = 0;
+      readCurListIndex++;
+    }
   }
 
-  public long getLastTime() {
-    return times[size - 1];
+  public int size() {
+    return this.count;
   }
 
-  public int size() {
-    return size;
+  public TimeColumnR asReadOnlyTimeColumn() {
+    return new TimeColumnR(timeRet, count);
+  }
+
+  private class TimeColumnR extends TimeColumn {
+
+    public TimeColumnR(ArrayList<long[]> timeRet, int count) {
 
 Review comment:
   use `List` ?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392767871
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
 Review comment:
   done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
samperson1997 commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392760067
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/BatchData.java
 ##########
 @@ -21,6 +21,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 
 Review comment:
   Remove this useless import

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392767889
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/TimeColumn.java
 ##########
 @@ -19,60 +19,115 @@
 package org.apache.iotdb.tsfile.read.common;
 
 
+import java.nio.ReadOnlyBufferException;
+import java.util.ArrayList;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+
 public class TimeColumn {
 
-  private static final int DEFAULT_INIT_SIZE = 1000;
+  private static final int capacityThreshold = TSFileDescriptor.getInstance().getConfig()
+      .getBatchSize();
+  private int capacity = 16;
 
+  // outer list index for read
+  private int readCurListIndex;
+  // inner array index for read
+  private int readCurArrayIndex;
 
-  private long[] times;
+  // outer list index for write
+  private int writeCurListIndex;
+  // inner array index for write
+  private int writeCurArrayIndex;
 
-  private int size;
+  // the insert timestamp number of timeRet
+  private int count;
 
-  private int cur;
+  private ArrayList<long[]> timeRet;
 
   public TimeColumn() {
-    this(DEFAULT_INIT_SIZE);
+    this.readCurListIndex = 0;
+    this.readCurArrayIndex = 0;
+    this.writeCurListIndex = 0;
+    this.writeCurArrayIndex = 0;
+    timeRet = new ArrayList<>();
+    timeRet.add(new long[capacity]);
+    count = 0;
   }
 
-  public TimeColumn(int initSize) {
-    times = new long[initSize];
-  }
+  public TimeColumn(ArrayList<long[]> timeRet, int count) {
 
 Review comment:
   done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct

Posted by GitBox <gi...@apache.org>.
liutaohua commented on a change in pull request #913: [IOTDB-500] Let timeColumn and batchData store time in the same struct
URL: https://github.com/apache/incubator-iotdb/pull/913#discussion_r392767835
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/BatchData.java
 ##########
 @@ -21,6 +21,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 
 Review comment:
   done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services