@Test
  public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() {
    String[] retArray =
        new String[] {
          "1,d1,1.0,true",
          "2,d1,2.0,null",
          "3,d1,30000.0,true",
          "4,d1,4.0,true",
          "5,d1,5.0,true",
          "6,d1,6.0,true",
          "7,d1,7.0,false",
          "8,d1,8.0,null",
          "9,d1,9.0,false",
          "10,d1,null,true",
          "11,d1,11.0,null",
          "12,d1,12.0,null",
          "13,d1,130000.0,true",
          "14,d1,14.0,null",
          "15,d1,15.0,null",
          "16,d1,16.0,null",
          "17,d1,17.0,null",
          "18,d1,18.0,null",
          "19,d1,19.0,null",
          "20,d1,20.0,null",
          "21,d1,null,true",
          "22,d1,null,true",
          "23,d1,230000.0,false",
          "24,d1,null,true",
          "25,d1,null,true",
          "26,d1,null,false",
          "27,d1,null,false",
          "28,d1,null,false",
          "29,d1,null,false",
          "30,d1,null,false",
          "31,d1,null,null",
          "32,d1,null,null",
          "33,d1,null,null",
          "34,d1,null,null",
          "35,d1,null,null",
          "36,d1,null,null",
          "37,d1,null,null",
          "38,d1,null,null",
          "39,d1,null,null",
          "40,d1,null,null",
        };

    String[] columnNames = {"Device", "s1", "s4"};

    try (Connection connection = EnvFactory.getEnv().getTableConnection();
        Statement statement = connection.createStatement()) {
      statement.execute(USE_DB);
      try (ResultSet resultSet =
          statement.executeQuery("select Time,Device,s1,s4 from table0 where device='d1'")) {
        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
        Map<String, Integer> map = new HashMap<>();
        for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
          map.put(resultSetMetaData.getColumnName(i), i);
        }
        assertEquals(columnNames.length + 1, resultSetMetaData.getColumnCount());
        int cnt = 0;
        while (resultSet.next()) {
          StringBuilder builder = new StringBuilder();
          builder.append(resultSet.getLong(1));
          for (String columnName : columnNames) {
            int index = map.get(columnName);
            builder.append(",").append(resultSet.getString(index));
          }
          assertEquals(retArray[cnt], builder.toString());
          cnt++;
        }
        assertEquals(retArray.length, cnt);
      }

    } catch (SQLException e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
aggregate multi columns of aligned timeseries in one SQL
integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java