@@ -226,8 +226,11 @@ protected void setSchema(TableSchema schema) {
226
226
227
227
for (int i = 0 ; i < columns .length ; i ++) {
228
228
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 ) {
231
234
case Int8 :
232
235
case Int16 :
233
236
case UInt8 :
@@ -362,7 +365,11 @@ public BigDecimal getBigDecimal(String colName) {
362
365
public Instant getInstant (String colName ) {
363
366
int colIndex = schema .nameToIndex (colName );
364
367
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 ) {
366
373
case Date :
367
374
case Date32 :
368
375
LocalDate data = readValue (colName );
@@ -380,7 +387,11 @@ public Instant getInstant(String colName) {
380
387
public ZonedDateTime getZonedDateTime (String colName ) {
381
388
int colIndex = schema .nameToIndex (colName );
382
389
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 ) {
384
395
case DateTime :
385
396
case DateTime64 :
386
397
case Date :
@@ -396,8 +407,12 @@ public Duration getDuration(String colName) {
396
407
int colIndex = schema .nameToIndex (colName );
397
408
ClickHouseColumn column = schema .getColumns ().get (colIndex );
398
409
BigInteger value = readValue (colName );
410
+ ClickHouseDataType columnDataType = column .getDataType ();
411
+ if (columnDataType .equals (ClickHouseDataType .SimpleAggregateFunction )){
412
+ columnDataType = column .getNestedColumns ().get (0 ).getDataType ();
413
+ }
399
414
try {
400
- switch (column . getDataType () ) {
415
+ switch (columnDataType ) {
401
416
case IntervalYear :
402
417
return Duration .of (value .longValue (), java .time .temporal .ChronoUnit .YEARS );
403
418
case IntervalQuarter :
0 commit comments