@@ -97,6 +97,13 @@ public <T> T readValue(ClickHouseColumn column, Class<?> typeHint) throws IOExce
9797 int estimatedLen = column .getEstimatedLength ();
9898 int precision = column .getPrecision ();
9999 int scale = column .getScale ();
100+ if (dataType == ClickHouseDataType .Decimal || dataType == ClickHouseDataType .Decimal32 ||
101+ dataType == ClickHouseDataType .Decimal64 || dataType == ClickHouseDataType .Decimal128 ||
102+ dataType == ClickHouseDataType .Decimal256 ) {
103+ precision = readByte ();
104+ scale = readByte ();
105+ System .out .println ("p: " + precision + " " +scale );
106+ }
100107 TimeZone timezone = column .getTimeZoneOrDefault (timeZone );
101108
102109 try {
@@ -138,7 +145,7 @@ public <T> T readValue(ClickHouseColumn column, Class<?> typeHint) throws IOExce
138145 case UInt256 :
139146 return (T ) readBigIntegerLE (INT256_SIZE , true );
140147 case Decimal :
141- return (T ) readDecimal (column . getPrecision (), column . getScale () );
148+ return (T ) readDecimal (precision , scale );
142149 case Decimal32 :
143150 return (T ) readDecimal (ClickHouseDataType .Decimal32 .getMaxPrecision (), scale );
144151 case Decimal64 :
@@ -462,7 +469,6 @@ public BigDecimal readDecimal(int precision, int scale) throws IOException {
462469 } else {
463470 v = new BigDecimal (readBigIntegerLE (INT256_SIZE , false ), scale );
464471 }
465-
466472 return v ;
467473 }
468474
@@ -1010,31 +1016,14 @@ private ClickHouseDataType readDynamicData() throws IOException {
10101016 } else if (tag == ClickHouseDataType .CUSTOM_TYPE_BIN_TAG ) {
10111017 String typeName = readString (input );
10121018 return ClickHouseDataType .valueOf (typeName );
1013- } else if (tag == ClickHouseDataType .Decimal .getBinTag ()) {
1014- byte precision = readByte ();
1015- byte scale = readByte ();
1016- System .out .println ("precision: " + precision + " scale: " + scale );
1017- return ClickHouseDataType .Decimal ;
10181019 } else if (tag == ClickHouseDataType .Decimal32 .getBinTag ()) {
1019- byte precision = readByte ();
1020- byte scale = readByte ();
1021- System .out .println ("precision: " + precision + " scale: " + scale );
10221020 return ClickHouseDataType .Decimal ;
10231021 } else if (tag == ClickHouseDataType .Decimal64 .getBinTag ()) {
1024- byte precision = readByte ();
1025- byte scale = readByte ();
1026- System .out .println ("precision: " + precision + " scale: " + scale );
1027- return ClickHouseDataType .Decimal64 ;
1022+ return ClickHouseDataType .Decimal ;
10281023 } else if (tag == ClickHouseDataType .Decimal128 .getBinTag ()) {
1029- byte precision = readByte ();
1030- byte scale = readByte ();
1031- System .out .println ("precision: " + precision + " scale: " + scale );
1032- return ClickHouseDataType .Decimal128 ;
1024+ return ClickHouseDataType .Decimal ;
10331025 } else if (tag == ClickHouseDataType .Decimal256 .getBinTag ()) {
1034- byte precision = readByte ();
1035- byte scale = readByte ();
1036- System .out .println ("precision: " + precision + " scale: " + scale );
1037- return ClickHouseDataType .Decimal256 ;
1026+ return ClickHouseDataType .Decimal ;
10381027 } else {
10391028 type = ClickHouseDataType .binTag2Type .get (tag );
10401029 if (type == null ) {
0 commit comments