@@ -226,8 +226,11 @@ protected void setSchema(TableSchema schema) {
226226
227227 for (int i = 0 ; i < columns .length ; i ++) {
228228 ClickHouseColumn column = columns [i ];
229-
230- switch (column .getDataType ()) {
229+ ClickHouseDataType columnDataType = column .getDataType ();
230+ if (columnDataType .equals (ClickHouseDataType .SimpleAggregateFunction )){
231+ columnDataType = column .getNestedColumns ().get (0 ).getDataType ();
232+ }
233+ switch (columnDataType ) {
231234 case Int8 :
232235 case Int16 :
233236 case UInt8 :
@@ -362,7 +365,11 @@ public BigDecimal getBigDecimal(String colName) {
362365 public Instant getInstant (String colName ) {
363366 int colIndex = schema .nameToIndex (colName );
364367 ClickHouseColumn column = schema .getColumns ().get (colIndex );
365- switch (column .getDataType ()) {
368+ ClickHouseDataType columnDataType = column .getDataType ();
369+ if (columnDataType .equals (ClickHouseDataType .SimpleAggregateFunction )){
370+ columnDataType = column .getNestedColumns ().get (0 ).getDataType ();
371+ }
372+ switch (columnDataType ) {
366373 case Date :
367374 case Date32 :
368375 LocalDate data = readValue (colName );
@@ -380,7 +387,11 @@ public Instant getInstant(String colName) {
380387 public ZonedDateTime getZonedDateTime (String colName ) {
381388 int colIndex = schema .nameToIndex (colName );
382389 ClickHouseColumn column = schema .getColumns ().get (colIndex );
383- switch (column .getDataType ()) {
390+ ClickHouseDataType columnDataType = column .getDataType ();
391+ if (columnDataType .equals (ClickHouseDataType .SimpleAggregateFunction )){
392+ columnDataType = column .getNestedColumns ().get (0 ).getDataType ();
393+ }
394+ switch (columnDataType ) {
384395 case DateTime :
385396 case DateTime64 :
386397 case Date :
@@ -396,8 +407,12 @@ public Duration getDuration(String colName) {
396407 int colIndex = schema .nameToIndex (colName );
397408 ClickHouseColumn column = schema .getColumns ().get (colIndex );
398409 BigInteger value = readValue (colName );
410+ ClickHouseDataType columnDataType = column .getDataType ();
411+ if (columnDataType .equals (ClickHouseDataType .SimpleAggregateFunction )){
412+ columnDataType = column .getNestedColumns ().get (0 ).getDataType ();
413+ }
399414 try {
400- switch (column . getDataType () ) {
415+ switch (columnDataType ) {
401416 case IntervalYear :
402417 return Duration .of (value .longValue (), java .time .temporal .ChronoUnit .YEARS );
403418 case IntervalQuarter :
0 commit comments