@Test
  public void testUpsertAliasAndTagsAndAttributes() {
    try {
      prepareTimeseries();
      try {
        schemaRegion.upsertAliasAndTagsAndAttributes(
            "s2", null, null, new PartialPath("root.sg.wf01.wt01.v1.s1"));
        Assert.fail();
      } catch (final Exception e) {
        Assert.assertTrue(
            e.getMessage()
                .contains("The alias is duplicated with the name or alias of other measurement"));
      }
      try {
        schemaRegion.upsertAliasAndTagsAndAttributes(
            "temp", null, null, new PartialPath("root.sg.wf01.wt01.v1.s1"));
        Assert.fail();
      } catch (final Exception e) {
        Assert.assertTrue(
            e.getMessage()
                .contains("The alias is duplicated with the name or alias of other measurement"));
      }

      final Map<String, String> newTags =
          new HashMap<String, String>() {
            {
              put("tag1", "new1");
              put("tag2", "new2");
              put("tag3", "new3");
            }
          };
      final Map<String, String> newAttributes =
          new HashMap<String, String>() {
            {
              put("attr1", "new1");
              put("attr2", "new2");
              put("attr3", "new3");
            }
          };
      final List<String> fullPaths =
          Arrays.asList(
              "root.sg.wf01.wt01.v1.s1",
              "root.sg.wf01.wt01.v1.s2",
              "root.sg.wf01.aligned_device1.s1",
              "root.sg.wf01.aligned_device1.s2",
              "root.sg.wf01.aligned_device2.s1",
              "root.sg.wf01.aligned_device2.s2");
      final List<String> aliasList =
          Arrays.asList(
              "newAlias1", "newAlias2", "newAlias3", "newAlias4", "newAlias5", "newAlias6");
      for (int i = 0; i < fullPaths.size(); i++) {
        schemaRegion.upsertAliasAndTagsAndAttributes(
            aliasList.get(i), newTags, newAttributes, new PartialPath(fullPaths.get(i)));
        checkAliasAndTagsAndAttributes(fullPaths.get(i), aliasList.get(i), newTags, newAttributes);
      }
    } catch (final Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
Prepare timeseries

<p>"root.sg.wf01.wt01.v1.s1" without tags, attributes and alias

<p>"root.sg.wf01.wt01.v1.s2" with tags, attributes and alias

<p>"root.sg.wf01.aligned_device1.(s1,s2)" aligned without tags, attributes and alias

<p>"root.sg.wf01.aligned_device2.(s1,s2)" aligned with tags, attributes and alias
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionAliasAndTagTest.java