File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed
Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ public boolean isNull() {
136136
137137 @ Override
138138 public void setNull () {
139- unscaledValue = DECIMAL128_MIN_VALUE . toBigInteger () ;
139+ unscaledValue = BIGINT_MIN_VALUE ;
140140 }
141141
142142 @ Override
Original file line number Diff line number Diff line change 1111import java .util .Arrays ;
1212import java .util .Objects ;
1313import static com .xxdb .data .Entity .DATA_TYPE .DT_DECIMAL128 ;
14+ import static com .xxdb .data .Entity .DATA_TYPE .DT_DECIMAL64 ;
1415
1516public class BasicDecimal128Vector extends AbstractVector {
1617
@@ -393,7 +394,10 @@ public void add(BigDecimal value) {
393394 }
394395
395396 public void add (String value ) {
396- add (new BigDecimal (value ));
397+ if (value .equals ("" ))
398+ add (DECIMAL128_MIN_VALUE .scaleByPowerOfTen (-this .scale_ ));
399+ else
400+ add (new BigDecimal (value ));
397401 }
398402
399403 public void addRange (BigInteger [] valueList ) {
@@ -446,7 +450,11 @@ public void addRange(BigDecimal[] valueList) {
446450 public void Append (Scalar value ) throws Exception {
447451 if (scale_ < 0 )
448452 throw new RuntimeException ("Please set scale first." );
449- add (value .getNumber ().toString ());
453+ if (value .getDataType () == DT_DECIMAL128 ) {
454+ add (value .getString ());
455+ }
456+ else
457+ add (value .getNumber ().toString ());
450458 }
451459
452460 @ Override
Original file line number Diff line number Diff line change @@ -248,6 +248,8 @@ public void add(String value) {
248248 capacity = values .length ;
249249 if (value .equals ("0.0" ))
250250 values [size ] = 0 ;
251+ else if (value .equals ("" ))
252+ values [size ] = Integer .MIN_VALUE ;
251253 else {
252254 BigDecimal pow = BigDecimal .TEN .pow (scale_ );
253255 BigDecimal bd = new BigDecimal (value );
@@ -331,7 +333,11 @@ public void Append(Scalar value) throws Exception{
331333 if (scale_ < 0 ){
332334 throw new RuntimeException ("Please set scale first." );
333335 }
334- add (value .getNumber ().doubleValue ());
336+ if (value .getDataType () == DT_DECIMAL32 ) {
337+ add (value .getString ());
338+ }
339+ else
340+ add (value .getNumber ().doubleValue ());
335341 }
336342
337343 @ Override
Original file line number Diff line number Diff line change 99import java .nio .ByteBuffer ;
1010import java .nio .ByteOrder ;
1111import java .util .Arrays ;
12+
13+ import static com .xxdb .data .Entity .DATA_TYPE .DT_DECIMAL32 ;
1214import static com .xxdb .data .Entity .DATA_TYPE .DT_DECIMAL64 ;
1315
1416public class BasicDecimal64Vector extends AbstractVector {
@@ -254,6 +256,8 @@ public void add(String value) {
254256 capaticy = values .length ;
255257 if (value .equals ("0.0" ))
256258 values [size ] = 0 ;
259+ else if (value .equals ("" ))
260+ values [size ] = Long .MIN_VALUE ;
257261 else {
258262 BigDecimal pow = BigDecimal .TEN .pow (scale_ );
259263 BigDecimal bd = new BigDecimal (value );
@@ -336,7 +340,11 @@ public void addRange(double[] valueList) {
336340 public void Append (Scalar value ) throws Exception {
337341 if (scale_ < 0 )
338342 throw new RuntimeException ("Please set scale first." );
339- add (value .getNumber ().doubleValue ());
343+ if (value .getDataType () == DT_DECIMAL64 ) {
344+ add (value .getString ());
345+ }
346+ else
347+ add (value .getNumber ().doubleValue ());
340348 }
341349
342350 @ Override
You can’t perform that action at this time.
0 commit comments