@@ -1985,6 +1985,31 @@ public void testReadingSimpleAggregateFunction() throws Exception {
19851985 }
19861986 }
19871987
1988+ @ Test (groups = {"integration" })
1989+ public void testReadingSimpleAggregateFunction2 () throws Exception {
1990+ final String tableName = "simple_aggregate_function_test_table" ;
1991+ client .execute ("DROP TABLE IF EXISTS " + tableName ).get ();
1992+ client .execute ("CREATE TABLE `" + tableName + "` " +
1993+ "(idx UInt8, lowest_value SimpleAggregateFunction(min, UInt8), count SimpleAggregateFunction(sum, Int64), date SimpleAggregateFunction(anyLast, DateTime32)) " +
1994+ "ENGINE Memory;" ).get ();
1995+
1996+
1997+ try (InsertResponse response = client .insert (tableName , new ByteArrayInputStream ("1\t 2\t 3\t 2024-12-22T12:00:00" .getBytes (StandardCharsets .UTF_8 )), ClickHouseFormat .TSV ).get (30 , TimeUnit .SECONDS )) {
1998+ Assert .assertEquals (response .getWrittenRows (), 1 );
1999+ }
2000+
2001+ try (QueryResponse queryResponse = client .query ("SELECT * FROM " + tableName + " LIMIT 1" ).get (30 , TimeUnit .SECONDS )) {
2002+
2003+ ClickHouseBinaryFormatReader reader = client .newBinaryFormatReader (queryResponse );
2004+ Assert .assertNotNull (reader .next ());
2005+ Assert .assertEquals (reader .getByte ("idx" ), Byte .valueOf ("1" ));
2006+ Assert .assertEquals ((Short ) reader .getShort ("lowest_value" ), Short .parseShort ("2" ));
2007+ Assert .assertEquals ((Long ) reader .getLong ("count" ), Long .parseLong ("3" ));
2008+ Assert .assertEquals (reader .getLocalDateTime ("date" ), LocalDateTime .of (2024 ,12 ,22 ,12 ,00 ,00 ));
2009+ Assert .assertFalse (reader .hasNext ());
2010+ }
2011+ }
2012+
19882013 @ Test (groups = {"integration" })
19892014 public void testReadingEnumsAsStrings () throws Exception {
19902015 final String tableName = "enums_as_strings_test_table" ;
0 commit comments