You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Shengnan YU (Jira)" <ji...@apache.org> on 2020/08/13 10:46:00 UTC

[jira] [Created] (FLINK-18939) Sort-partition result is incorrect when use Bigdecimal as Key

Shengnan YU created FLINK-18939:
-----------------------------------

             Summary: Sort-partition result is incorrect when use Bigdecimal as Key
                 Key: FLINK-18939
                 URL: https://issues.apache.org/jira/browse/FLINK-18939
             Project: Flink
          Issue Type: Bug
          Components: API / DataSet
    Affects Versions: 1.9.1
            Reporter: Shengnan YU


result of Dataset sort-partition method gives incorrect result when use BigDecimal as key. 
Here is the test code. The print result does not give the right order.
{code:java}
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<String> ss = env.fromElements("1234567.89", "3456789.12", "2345678.91");
DataSet<String> result = ss.sortPartition(new KeySelector<String,BigDecimal>() {
    @Override
    public BigDecimal getKey(String value) throws Exception {
        return new BigDecimal(value);
    }
}, Order.ASCENDING).setParallelism(1);
result.print();
{code}
It seems that class BigDecComprator some problem and the normalized key cannot be compared correctly.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)