View Issue Details

IDProjectCategoryView StatusLast Update
0004703SymmetricDS ProBugpublic2024-01-25 19:11
Reporterpmarzullo Assigned Topmarzullo  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.12.5 
Target Version3.12.6Fixed in Version3.12.6 
Summary0004703: BigDecimal value in Row needs to use toPlainString() when returning string representation
DescriptionWhen a Row object has a BigDecimal value in it, the string representation that is returned by Row returns exponents when the scale (the number of digits to the right of the decimal point) is greater than 6.

See code in "Steps To Reproduce" for demonstration of the problem.

The Row object should use the toPlainString() method of BigDecimal when the object type is a BigDecimal.
Steps To Reproduce    public static void main(String[] args) {
        BigDecimal bd = new BigDecimal(BigInteger.valueOf(0l), 8);
        Row row = new Row("col1", bd);
        System.out.println(row.getString("col1"));
        System.out.println(bd.toPlainString());
        bd = new BigDecimal(BigInteger.valueOf(0l), 7);
        row = new Row("col1", bd);
        System.out.println(row.getString("col1"));
        System.out.println(bd.toPlainString());
        bd = new BigDecimal(BigInteger.valueOf(0l), 6);
        row = new Row("col1", bd);
        System.out.println(row.getString("col1"));
        System.out.println(bd.toPlainString());
    }
Additional InformationActual planned code change:

Old method:

public class Row
.
.
.
    public String getString(String columnName, boolean checkForColumn) {
        Object obj = this.get(columnName);
        if (obj != null) {
                return obj.toString();
        } else {
            if (checkForColumn) {
                checkForColumn(columnName);
            }
            return null;
        }
    }
.
.
.
}

Updated method:

public class Row
.
.
.
    public String getString(String columnName, boolean checkForColumn) {
        Object obj = this.get(columnName);
        if (obj != null) {
            if(obj instanceof BigDecimal) {
                return ((BigDecimal) obj).toPlainString();
            } else {
                return obj.toString();
            }
        } else {
            if (checkForColumn) {
                checkForColumn(columnName);
            }
            return null;
        }
    }
.
.
.
}
Tagsdbimport/dbexport

Relationships

related to 0004702 closedpmarzullo BigDecimal value in Row needs to use toPlainString() when returning string representation 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-12-14 17:59 pmarzullo New Issue
2020-12-14 17:59 pmarzullo Status new => assigned
2020-12-14 17:59 pmarzullo Assigned To => pmarzullo
2020-12-14 17:59 pmarzullo Tag Attached: dbexport
2020-12-14 17:59 pmarzullo Relationship added related to 0004702
2020-12-14 18:49 pmarzullo Status assigned => resolved
2020-12-14 18:49 pmarzullo Resolution open => fixed
2020-12-14 18:49 pmarzullo Fixed in Version => 3.12.6
2021-01-11 13:48 admin Status resolved => closed
2024-01-25 19:11 elong Tag Attached: dbimport/dbexport
2024-01-25 19:11 elong Tag Detached: dbexport