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