You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/11/14 07:21:41 UTC

[iotdb] branch new_vector updated (875816b -> 463cf70)

This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a change to branch new_vector
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


    from 875816b  Merge branch 'new_vector' of https://github.com/apache/iotdb into new_vector
     add 7c398bb  [IOTDB-1859] CI fails on coveralls caused by openapi generated files (#4364)
     add e085250  [IOTDB-1990] Fix uncheck null result by calling IReaderByTimestamp.getValuesInTimestamps() (#4358)
     add 480c0f3  [ISSUE-4314] [docs] fix the Url of 'Get started quickly' in the file ContributeGuide.md (#4368)
     add 16fb554  [IOTDB-1859] CI fails on coveralls caused by openapi generated files (#4370)
     add 973157a  Adapt serialization/deserialization in CreateTemplatePlan with former template structure (#4355)
     add 4c80522  [IOTDB-2003] add overwrite method with @Override (#4374)
     add 4f615ea  [IoTDB-1865]【Cluster】Compaction is blocking when removing old files  (#4365)
     add 1e43fc7  [IOTDB-2001] Remove redundant StorageGroupNotReadyException (#4377)
     new 463cf70  fix conflicts

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../cluster/query/fill/ClusterFillExecutor.java    |   2 +-
 .../iotdb/cluster/query/reader/DataSourceInfo.java |   5 +-
 .../query/reader/mult/MultDataSourceInfo.java      |   5 +-
 docs/Development/ContributeGuide.md                |   2 +-
 pom.xml                                            |   1 +
 .../WrappedSingleThreadScheduledExecutor.java      |  17 ++
 .../org/apache/iotdb/db/engine/StorageEngine.java  |   5 -
 .../AbstractCrossSpaceCompactionSelector.java      |   1 +
 .../AbstractInnerSpaceCompactionSelector.java      |   1 +
 .../SizeTieredCompactionRecoverTask.java           |   1 +
 .../compaction/task/AbstractCompactionTask.java    |   1 +
 .../apache/iotdb/db/engine/flush/FlushManager.java |   1 +
 .../modification/utils/TracedBufferedReader.java   |   8 +
 .../iotdb/db/metadata/mnode/IEntityMNode.java      |   1 +
 .../iotdb/db/metadata/mnode/InternalMNode.java     |   1 +
 .../iotdb/db/metadata/template/Template.java       |  56 +++--
 .../db/qp/physical/crud/CreateTemplatePlan.java    | 103 ++++++++-
 .../db/qp/physical/crud/InsertMultiTabletPlan.java |   2 +
 .../physical/crud/InsertRowsOfOneDevicePlan.java   |   1 +
 .../iotdb/db/qp/physical/crud/InsertRowsPlan.java  |   1 +
 .../qp/physical/sys/CreateMultiTimeSeriesPlan.java |   1 +
 .../iotdb/db/qp/utils/EmptyOutputStream.java       |   1 +
 .../iotdb/db/query/control/QueryFileManager.java   |  38 +--
 .../dataset/RawQueryDataSetWithValueFilter.java    |   4 +-
 .../db/query/executor/AggregationExecutor.java     |   6 +-
 .../iotdb/db/metadata/MManagerBasicTest.java       |   1 +
 .../org/apache/iotdb/db/metadata/TemplateTest.java | 254 +++++++++++++++++++++
 .../iotdb/db/metadata/mlog/MLogUpgraderTest.java   |  72 ++++++
 28 files changed, 524 insertions(+), 68 deletions(-)
 create mode 100644 server/src/test/java/org/apache/iotdb/db/metadata/TemplateTest.java

[iotdb] 01/01: fix conflicts

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch new_vector
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 463cf70765a6c9dfd3ea72a8a2e87a01c233e261
Merge: 875816b 1e43fc7
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Sun Nov 14 15:21:06 2021 +0800

    fix conflicts

 .../cluster/query/fill/ClusterFillExecutor.java    |   2 +-
 .../iotdb/cluster/query/reader/DataSourceInfo.java |   5 +-
 .../query/reader/mult/MultDataSourceInfo.java      |   5 +-
 docs/Development/ContributeGuide.md                |   2 +-
 pom.xml                                            |   1 +
 .../WrappedSingleThreadScheduledExecutor.java      |  17 ++
 .../org/apache/iotdb/db/engine/StorageEngine.java  |   5 -
 .../AbstractCrossSpaceCompactionSelector.java      |   1 +
 .../AbstractInnerSpaceCompactionSelector.java      |   1 +
 .../SizeTieredCompactionRecoverTask.java           |   1 +
 .../compaction/task/AbstractCompactionTask.java    |   1 +
 .../apache/iotdb/db/engine/flush/FlushManager.java |   1 +
 .../modification/utils/TracedBufferedReader.java   |   8 +
 .../iotdb/db/metadata/mnode/IEntityMNode.java      |   1 +
 .../iotdb/db/metadata/mnode/InternalMNode.java     |   1 +
 .../iotdb/db/metadata/template/Template.java       |  56 +++--
 .../db/qp/physical/crud/CreateTemplatePlan.java    | 103 ++++++++-
 .../db/qp/physical/crud/InsertMultiTabletPlan.java |   2 +
 .../physical/crud/InsertRowsOfOneDevicePlan.java   |   1 +
 .../iotdb/db/qp/physical/crud/InsertRowsPlan.java  |   1 +
 .../qp/physical/sys/CreateMultiTimeSeriesPlan.java |   1 +
 .../iotdb/db/qp/utils/EmptyOutputStream.java       |   1 +
 .../iotdb/db/query/control/QueryFileManager.java   |  38 +--
 .../dataset/RawQueryDataSetWithValueFilter.java    |   4 +-
 .../db/query/executor/AggregationExecutor.java     |   6 +-
 .../iotdb/db/metadata/MManagerBasicTest.java       |   1 +
 .../org/apache/iotdb/db/metadata/TemplateTest.java | 254 +++++++++++++++++++++
 .../iotdb/db/metadata/mlog/MLogUpgraderTest.java   |  72 ++++++
 28 files changed, 524 insertions(+), 68 deletions(-)

diff --cc server/src/main/java/org/apache/iotdb/db/qp/physical/crud/CreateTemplatePlan.java
index 0fd43b3,da7e7b3..24f2673
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/CreateTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/CreateTemplatePlan.java
@@@ -20,9 -20,10 +20,10 @@@
  package org.apache.iotdb.db.qp.physical.crud;
  
  import org.apache.iotdb.db.exception.metadata.MetadataException;
 -import org.apache.iotdb.db.metadata.PartialPath;
 +import org.apache.iotdb.db.metadata.path.PartialPath;
  import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
  import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+ import org.apache.iotdb.db.utils.TestOnly;
  import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
  import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
  import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --cc server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
index fdbd5c3,8289683..b0d9f5b
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
@@@ -118,21 -118,14 +118,21 @@@ public class RawQueryDataSetWithValueFi
  
        // 3. use values in results to fill row record
        for (int j = 0; j < cachedTimeCnt; j++) {
-         if (results[j] == null) {
+         if (results == null || results[j] == null) {
            rowRecords[j].addField(null);
          } else {
 -          hasField[j] = true;
            if (dataTypes.get(i) == TSDataType.VECTOR) {
              TsPrimitiveType[] result = (TsPrimitiveType[]) results[j];
 -            rowRecords[j].addField(result[0].getValue(), result[0].getDataType());
 +            for (TsPrimitiveType value : result) {
 +              if (value == null) {
 +                rowRecords[j].addField(null);
 +              } else {
 +                hasField[j] = true;
 +                rowRecords[j].addField(value.getValue(), value.getDataType());
 +              }
 +            }
            } else {
 +            hasField[j] = true;
              rowRecords[j].addField(results[j], dataTypes.get(i));
            }
          }
diff --cc server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
index 23368ae,8549589..e4257c3
--- a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
@@@ -849,132 -858,7 +849,133 @@@ public class MManagerBasicTest 
      }
    }
  
 +  @Test
 +  public void testTemplate() throws MetadataException {
 +    CreateTemplatePlan plan = getCreateTemplatePlan();
 +
 +    MManager manager = IoTDB.metaManager;
 +    manager.createSchemaTemplate(plan);
 +
 +    // set device template
 +    SetSchemaTemplatePlan setSchemaTemplatePlan =
 +        new SetSchemaTemplatePlan("template1", "root.sg1.d1");
 +
 +    manager.setSchemaTemplate(setSchemaTemplatePlan);
 +
 +    IMNode node = manager.getDeviceNode(new PartialPath("root.sg1.d1"));
 +    node = manager.setUsingSchemaTemplate(node);
 +
 +    UnaryMeasurementSchema s11 =
 +        new UnaryMeasurementSchema("s11", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY);
 +    assertNotNull(node.getSchemaTemplate());
 +
 +    Set<IMeasurementSchema> allSchema =
 +        new HashSet<>(node.getSchemaTemplate().getSchemaMap().values());
 +    for (MeasurementPath measurementPath :
 +        manager.getMeasurementPaths(new PartialPath("root.sg1.d1.*"))) {
 +      allSchema.remove(measurementPath.getMeasurementSchema());
 +    }
 +
 +    assertTrue(allSchema.isEmpty());
 +
 +    IMeasurementMNode mNode = manager.getMeasurementMNode(new PartialPath("root.sg1.d1.s11"));
 +    IMeasurementMNode mNode2 =
 +        manager.getMeasurementMNode(new PartialPath("root.sg1.d1.vector.s2"));
 +    assertNotNull(mNode);
 +    assertEquals(mNode.getSchema(), s11);
 +    assertNotNull(mNode2);
 +    assertEquals(
 +        mNode2.getSchema(), manager.getTemplate("template1").getSchemaMap().get("vector.s2"));
 +
 +    try {
 +      manager.getMeasurementMNode(new PartialPath("root.sg1.d1.s100"));
 +      fail();
 +    } catch (PathNotExistException e) {
 +      assertEquals("Path [root.sg1.d1.s100] does not exist", e.getMessage());
 +    }
 +  }
 +
 +  @Test
 +  public void testTemplateInnerTree() {
 +    CreateTemplatePlan plan = getTreeTemplatePlan();
 +    Template template;
 +    MManager manager = IoTDB.metaManager;
 +
 +    try {
 +      manager.createSchemaTemplate(plan);
 +      template = manager.getTemplate("treeTemplate");
 +      assertEquals(4, template.getMeasurementsCount());
 +      assertEquals("d1", template.getPathNodeInTemplate("d1").getName());
 +      assertNull(template.getPathNodeInTemplate("notExists"));
 +      assertEquals("[GPS]", template.getAllAlignedPrefix().toString());
 +
 +      String[] alignedMeasurements = {"to.be.prefix.s1", "to.be.prefix.s2"};
 +      TSDataType[] dataTypes = {TSDataType.INT32, TSDataType.INT32};
 +      TSEncoding[] encodings = {TSEncoding.RLE, TSEncoding.RLE};
 +      CompressionType[] compressionTypes = {CompressionType.SNAPPY, CompressionType.SNAPPY};
 +      template.addAlignedMeasurements(alignedMeasurements, dataTypes, encodings, compressionTypes);
 +
 +      assertEquals("[GPS, to.be.prefix]", template.getAllAlignedPrefix().toString());
 +      assertEquals("[s1, s2]", template.getAlignedMeasurements("to.be.prefix").toString());
 +
 +      template.deleteAlignedPrefix("to.be.prefix");
 +
 +      assertEquals("[GPS]", template.getAllAlignedPrefix().toString());
 +      assertEquals(null, template.getDirectNode("prefix"));
 +      assertEquals("to", template.getDirectNode("to").getName());
 +
 +      try {
 +        template.deleteMeasurements("a.single");
 +        fail();
 +      } catch (IllegalPathException e) {
 +        assertEquals("a.single is not a legal path, because Path does not exist", e.getMessage());
 +      }
 +      assertEquals(
 +          "[d1.s1, GPS.x, to.be.prefix.s2, GPS.y, to.be.prefix.s1, s2]",
 +          template.getAllMeasurementsPaths().toString());
 +
 +      template.deleteSeriesCascade("to");
 +
 +      assertEquals("[d1.s1, GPS.x, GPS.y, s2]", template.getAllMeasurementsPaths().toString());
 +
 +    } catch (MetadataException e) {
 +      e.printStackTrace();
 +    }
 +  }
 +
 +  private CreateTemplatePlan getTreeTemplatePlan() {
 +    /**
 +     * Construct a template like: create schema template treeTemplate ( (d1.s1 INT32 GORILLA
 +     * SNAPPY), (s2 INT32 GORILLA SNAPPY), (GPS.x FLOAT RLE SNAPPY), (GPS.y FLOAT RLE SNAPPY), )with
 +     * aligned (GPS)
 +     *
 +     * <p>Check aligned path whether with same prefix? Construct tree
 +     */
 +    List<List<String>> measurementList = new ArrayList<>();
 +    measurementList.add(Collections.singletonList("d1.s1"));
 +    measurementList.add(Collections.singletonList("s2"));
 +    measurementList.add(Arrays.asList("GPS.x", "GPS.y"));
 +
 +    List<List<TSDataType>> dataTypeList = new ArrayList<>();
 +    dataTypeList.add(Collections.singletonList(TSDataType.INT32));
 +    dataTypeList.add(Collections.singletonList(TSDataType.INT32));
 +    dataTypeList.add(Arrays.asList(TSDataType.FLOAT, TSDataType.FLOAT));
 +
 +    List<List<TSEncoding>> encodingList = new ArrayList<>();
 +    encodingList.add(Collections.singletonList(TSEncoding.GORILLA));
 +    encodingList.add(Collections.singletonList(TSEncoding.GORILLA));
 +    encodingList.add(Arrays.asList(TSEncoding.RLE, TSEncoding.RLE));
 +
 +    List<List<CompressionType>> compressionTypes = new ArrayList<>();
 +    compressionTypes.add(Collections.singletonList(CompressionType.SDT));
 +    compressionTypes.add(Collections.singletonList(CompressionType.SNAPPY));
 +    compressionTypes.add(Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY));
 +
 +    return new CreateTemplatePlan(
 +        "treeTemplate", measurementList, dataTypeList, encodingList, compressionTypes);
 +  }
 +
+   @SuppressWarnings("Duplicates")
    private CreateTemplatePlan getCreateTemplatePlan() {
      List<List<String>> measurementList = new ArrayList<>();
      measurementList.add(Collections.singletonList("s11"));
diff --cc server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java
index 4f37ba3,e0b59c9..456a2a9
--- a/server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java
@@@ -22,10 -22,12 +22,12 @@@ import org.apache.iotdb.db.conf.IoTDBDe
  import org.apache.iotdb.db.exception.metadata.MetadataException;
  import org.apache.iotdb.db.metadata.MManager;
  import org.apache.iotdb.db.metadata.MetadataConstant;
 -import org.apache.iotdb.db.metadata.PartialPath;
  import org.apache.iotdb.db.metadata.logfile.MLogTxtWriter;
  import org.apache.iotdb.db.metadata.logfile.MLogUpgrader;
 +import org.apache.iotdb.db.metadata.path.PartialPath;
  import org.apache.iotdb.db.metadata.tag.TagLogFile;
+ import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+ import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
  import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
  import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
  import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;