samperson1997 opened a new pull request #3180:
URL: https://github.com/apache/iotdb/pull/3180


   MetadataIndexTree constructs error when existing more than one chunks in 
vector.
   
   Here is an example.
   
   Change config ` avg_series_point_number_threshold` to `1`.
   
   Then, insert with aligned timeseries:
   ```
   private static void insertTabletWithAlignedTimeseries()
         throws IoTDBConnectionException, StatementExecutionException {
       // The schema of measurements of one device
       // only measurementId and data type in MeasurementSchema take effects in 
Tablet
       List<IMeasurementSchema> schemaList = new ArrayList<>();
       schemaList.add(
           new VectorMeasurementSchema(
               new String[] {"s1", "s2"}, new TSDataType[] {TSDataType.INT64, 
TSDataType.INT32}));
   
       Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList, 1);
       long timestamp = System.currentTimeMillis();
   
       for (long row = 0; row < 5; row++) {
         int rowIndex = tablet.rowSize++;
         tablet.addTimestamp(rowIndex, timestamp);
         tablet.addValue(
             schemaList.get(0).getValueMeasurementIdList().get(0),
             rowIndex,
             new SecureRandom().nextLong());
         tablet.addValue(
             schemaList.get(0).getValueMeasurementIdList().get(1),
             rowIndex,
             new SecureRandom().nextInt());
   
         if (tablet.rowSize == tablet.getMaxRowNumber()) {
           session.insertTablet(tablet, true);
           tablet.reset();
         }
         timestamp++;
       }
   
       if (tablet.rowSize != 0) {
         session.insertTablet(tablet);
         tablet.reset();
       }
   
       session.executeNonQueryStatement("flush");
     }
   ```
   
   And query:
   ```
   SessionDataSet dataSet = session.executeQueryStatement("select * from 
root.sg_1.d1");
       System.out.println(dataSet.getColumnNames());
       while (dataSet.hasNext()) {
         System.out.println(dataSet.next());
       }
   ```


-- 
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:
[email protected]


Reply via email to