public static InsertRowStatement createStatement(TSInsertRecordReq insertRecordReq)
      throws IllegalPathException, QueryProcessException {
    final long startTime = System.nanoTime();
    // construct insert statement
    InsertRowStatement insertStatement = new InsertRowStatement();
    insertStatement.setDevicePath(
        DEVICE_PATH_CACHE.getPartialPath(insertRecordReq.getPrefixPath()));
    TimestampPrecisionUtils.checkTimestampPrecision(insertRecordReq.getTimestamp());
    insertStatement.setTime(insertRecordReq.getTimestamp());
    insertStatement.setMeasurements(insertRecordReq.getMeasurements().toArray(new String[0]));
    insertStatement.setAligned(insertRecordReq.isAligned);
    insertStatement.fillValues(insertRecordReq.values);
    if (insertRecordReq.isSetIsWriteToTable()) {
      insertStatement.setWriteToTable(insertRecordReq.isIsWriteToTable());
      if (!insertRecordReq.isSetColumnCategoryies()
          || insertRecordReq.getColumnCategoryiesSize() != insertRecordReq.getMeasurementsSize()) {
        throw new IllegalArgumentException(
            "Missing or invalid column categories for table " + "insertion");
      }
      TsTableColumnCategory[] columnCategories =
          new TsTableColumnCategory[insertRecordReq.getColumnCategoryies().size()];
      for (int i = 0; i < columnCategories.length; i++) {
        columnCategories[i] =
            TsTableColumnCategory.fromTsFileColumnCategory(
                ColumnCategory.values()[insertRecordReq.getColumnCategoryies().get(i).intValue()]);
      }
      insertStatement.setColumnCategories(columnCategories);
    }
    PERFORMANCE_OVERVIEW_METRICS.recordParseCost(System.nanoTime() - startTime);
    return insertStatement;
  }
Convert SQL and RPC requests to {@link Statement}.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java