Zesong Sun created IOTDB-1371:
---------------------------------

             Summary: NPE when creating aligned timeseries and inserting with 
mismatched data type
                 Key: IOTDB-1371
                 URL: https://issues.apache.org/jira/browse/IOTDB-1371
             Project: Apache IoTDB
          Issue Type: Bug
          Components: Schema Manager
            Reporter: Zesong Sun
            Assignee: Zesong Sun
             Fix For: 0.13.0


When creating aligned timeseries and inserting with mismatched data type, the 
MNode will be null and a NullPointerException would be thrown.


Here is the related test:
{code}
@Test
  public void testCreateAlignedTimeseriesAndInsertWithMismatchDataType() {
    MManager manager = IoTDB.metaManager;
    try {
      manager.setStorageGroup(new PartialPath("root.laptop"));
      manager.createAlignedTimeSeries(
          new PartialPath("root.laptop.d1"),
          Arrays.asList("s1", "s2", "s3"),
          Arrays.asList(
              TSDataType.valueOf("FLOAT"),
              TSDataType.valueOf("INT64"),
              TSDataType.valueOf("INT32")),
          Arrays.asList(
              TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), 
TSEncoding.valueOf("RLE")),
          compressionType);

      // construct an insertRowPlan with mismatch data type
      long time = 1L;
      TSDataType[] dataTypes =
          new TSDataType[] {TSDataType.FLOAT, TSDataType.DOUBLE, 
TSDataType.INT32};

      String[] columns = new String[3];
      columns[0] = 2.0 + "";
      columns[1] = 10000 + "";
      columns[2] = 100 + "";

      InsertRowPlan insertRowPlan =
          new InsertRowPlan(
              new PartialPath("root.laptop.d1"),
              time,
              new String[] {"(s1,s2,s3)"},
              dataTypes,
              columns);
      insertRowPlan.setMeasurementMNodes(
          new MeasurementMNode[insertRowPlan.getMeasurements().length]);

      // call getSeriesSchemasAndReadLockDevice
      MNode mNode = manager.getSeriesSchemasAndReadLockDevice(insertRowPlan);
      assertNotNull(insertRowPlan.getMeasurementMNodes()[0]);

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
}

{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to