You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/01/17 09:42:33 UTC

[incubator-inlong] branch master updated: [INLONG-2171] Fix the problem that partition computed is negative when using distributed table of clickhouse (#2172)

This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a9f392  [INLONG-2171] Fix the problem that partition computed is negative when using distributed table of clickhouse (#2172)
8a9f392 is described below

commit 8a9f3929136341ffe147e01fdc89a9f72720bf94
Author: TianqiWan <52...@users.noreply.github.com>
AuthorDate: Mon Jan 17 17:42:26 2022 +0800

    [INLONG-2171] Fix the problem that partition computed is negative when using distributed table of clickhouse (#2172)
    
    Co-authored-by: tianqiwan <ti...@tencent.com>
---
 .../inlong/sort/flink/clickhouse/partitioner/HashPartitioner.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/clickhouse/partitioner/HashPartitioner.java b/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/clickhouse/partitioner/HashPartitioner.java
index 6f78ced..650106b 100644
--- a/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/clickhouse/partitioner/HashPartitioner.java
+++ b/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/flink/clickhouse/partitioner/HashPartitioner.java
@@ -34,7 +34,7 @@ public class HashPartitioner implements ClickHousePartitioner {
     }
 
     public int select(Tuple2<Boolean, Row> record, int numShards) {
-        return Objects.hashCode(record.f1.getField(pos)) % numShards;
+        return Math.abs(Objects.hashCode(record.f1.getField(pos))) % numShards;
     }
 }