@Test
  public void testUnionVariable() {
    String[] expectedHeader = new String[] {"time", "match", "price", "lower_or_higher", "label"};
    String[] retArray1 =
        new String[] {
          "2025-01-01T00:01:00.000Z,1,90.0,H,H,",
          "2025-01-01T00:02:00.000Z,1,80.0,H,A,",
          "2025-01-01T00:03:00.000Z,2,70.0,L,L,",
          "2025-01-01T00:04:00.000Z,2,80.0,L,A,",
        };

    String sql =
        "SELECT m.time, m.match, m.price, m.lower_or_higher, m.label "
            + "FROM t4 "
            + "MATCH_RECOGNIZE ( "
            + "    MEASURES "
            + "        MATCH_NUMBER() AS match, "
            + "        RUNNING RPR_LAST(totalprice) AS price, "
            + "        CLASSIFIER(U) AS lower_or_higher, "
            + "        CLASSIFIER(W) AS label "
            + "    ALL ROWS PER MATCH "
            + "    AFTER MATCH SKIP PAST LAST ROW "
            + "    PATTERN ((L | H) A) "
            + "    SUBSET "
            + "        U = (L, H), "
            + "        W = (A, L, H) "
            + "    DEFINE "
            + "        A AS A.totalprice = 80, "
            + "        L AS L.totalprice < 80, "
            + "        H AS H.totalprice > 80 "
            + ") AS m";

    tableResultSetEqualTest(sql, expectedHeader, retArray1, DATABASE_NAME);
  }
Search range: all devices whose department is 'DEP_1', each device's data is grouped
separately, and the time range is between 2025-01-01T00:00:00 and 2025-01-01T01:00:00.

<p>Event analysis: Whenever the altitude exceeds 500 and then drops below 500, it is marked as
an event.
integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBPatternRecognitionIT.java