Xiangdong Huang created IOTDB-535:
-------------------------------------

             Summary: Do we need a more accurate data type in the ResultSet for 
aggregation functions
                 Key: IOTDB-535
                 URL: https://issues.apache.org/jira/browse/IOTDB-535
             Project: Apache IoTDB
          Issue Type: Improvement
          Components: Core/Engine
            Reporter: Xiangdong Huang


Hi, when I am trying to add a UT for GroupBy Time Interval clause, I find that 
all data in the resultSet are Strings... like:
{code:java}
// code placeholder

try (Connection connection = DriverManager.
        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
        Statement statement = connection.createStatement()) {
      statement.execute("INSERT INTO 
root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
          + "values(now(), 35.5, false, 650)");
      ResultSet resultSet = statement.executeQuery(
          "select count(temperature), sum(temperature), avg(temperature) from "
              + "root.ln.wf01.wt01 "
              + "GROUP BY ([now() - 1h, now()), 1h)");
      assertTrue(resultSet.next());
      //resultSet.getLong(1) is the timestamp
      assertEquals(1, Integer.valueOf(resultSet.getString(2)).intValue());
      assertEquals(35.5, Float.valueOf(resultSet.getString(3)).floatValue(), 
0.01);
      assertEquals(35.5, Double.valueOf(resultSet.getString(4)).doubleValue(), 
0.01);
    }{code}
I think we can get more accurate data types of the data in the resultSet.

E.g., count() returns INT, sum returns double or long for float/double or 
int/long measurement, avg() returns float or double..

How do you think?

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to