@Test
  public void testOutputMode() {
    String[] expectedHeader = new String[] {"match", "price", "label"};
    String[] retArray1 =
        new String[] {
          "1,null,null,", "2,70.0,B,", "3,null,null,",
        };
    String[] retArray2 =
        new String[] {
          "1,null,null,", "2,80.0,B,", "2,70.0,B,", "3,null,null,",
        };
    String[] retArray3 =
        new String[] {
          "1,80.0,B,", "1,70.0,B,",
        };
    String[] retArray4 =
        new String[] {
          "2,80.0,B,", "2,70.0,B,",
        };
    String[] retArray5 =
        new String[] {
          "null,null,null,", "1,80.0,B,", "1,70.0,B,", "null,null,null,",
        };

    String sql =
        "SELECT m.match, m.price, m.label "
            + "FROM t1 "
            + "MATCH_RECOGNIZE ( "
            + "    MEASURES "
            + "        MATCH_NUMBER() AS match, "
            + "        RUNNING RPR_LAST(totalprice) AS price,  "
            + "        CLASSIFIER() AS label "
            + "    %s "
            + "    AFTER MATCH SKIP PAST LAST ROW "
            + "    %s "
            + "    DEFINE "
            + "        B AS B.totalprice < PREV(B.totalprice) "
            + ") AS m";

    tableResultSetEqualTest(
        format(sql, "ONE ROW PER MATCH", "PATTERN (B*)"), expectedHeader, retArray1, DATABASE_NAME);

    tableResultSetEqualTest(
        format(sql, "ALL ROWS PER MATCH", "PATTERN (B*)"),
        expectedHeader,
        retArray2,
        DATABASE_NAME);

    tableResultSetEqualTest(
        format(sql, "ALL ROWS PER MATCH", "PATTERN (B+)"),
        expectedHeader,
        retArray3,
        DATABASE_NAME);

    tableResultSetEqualTest(
        format(sql, "ALL ROWS PER MATCH OMIT EMPTY MATCHES", "PATTERN (B*)"),
        expectedHeader,
        retArray4,
        DATABASE_NAME);

    tableResultSetEqualTest(
        format(sql, "ALL ROWS PER MATCH WITH UNMATCHED ROWS", "PATTERN (B+)"),
        expectedHeader,
        retArray5,
        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