You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/05/19 15:56:29 UTC
[incubator-doris] branch master updated: [fix](sparkload): fix min_value will be negative number when `maxGlobalDictValue` exceeds integer range (#9436)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new c048b1f0f9 [fix](sparkload): fix min_value will be negative number when `maxGlobalDictValue` exceeds integer range (#9436)
c048b1f0f9 is described below
commit c048b1f0f952d76af27b12f387dc135f82adcbe0
Author: spaces-x <we...@gmail.com>
AuthorDate: Thu May 19 23:56:24 2022 +0800
[fix](sparkload): fix min_value will be negative number when `maxGlobalDictValue` exceeds integer range (#9436)
---
.../java/org/apache/doris/load/loadv2/dpp/GlobalDictBuilder.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fe/spark-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/GlobalDictBuilder.java b/fe/spark-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/GlobalDictBuilder.java
index 8ffbc223f0..8e2124ae4b 100644
--- a/fe/spark-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/GlobalDictBuilder.java
+++ b/fe/spark-dpp/src/main/java/org/apache/doris/load/loadv2/dpp/GlobalDictBuilder.java
@@ -309,8 +309,9 @@ public class GlobalDictBuilder {
sql.append("insert overwrite table ").append(globalDictTableName).append(" partition(dict_column='").append(distinctColumnName).append("') ")
.append(" select dict_key,dict_value from ").append(globalDictTableName).append(" where dict_column='").append(distinctColumnName).append("' ");
for (Map.Entry<String, Long> entry : distinctKeyMap.entrySet()) {
- sql.append(" union all select dict_key, (row_number() over(order by dict_key)) ")
- .append(String.format(" +(%s) as dict_value from %s", entry.getValue(), entry.getKey()));
+ sql.append(" union all select dict_key, CAST((row_number() over(order by dict_key)) as BIGINT) ")
+ .append(String.format("+ CAST(%s as BIGINT) as dict_value from %s",
+ entry.getValue(), entry.getKey()));
}
return sql.toString();
}
@@ -334,7 +335,9 @@ public class GlobalDictBuilder {
private String getBuildGlobalDictSql(long maxGlobalDictValue, String distinctColumnName) {
return "insert overwrite table " + globalDictTableName + " partition(dict_column='" + distinctColumnName + "') "
+ " select dict_key,dict_value from " + globalDictTableName + " where dict_column='" + distinctColumnName + "' "
- + " union all select t1.dict_key as dict_key,(row_number() over(order by t1.dict_key)) + (" + maxGlobalDictValue + ") as dict_value from "
+ + " union all select t1.dict_key as dict_key,"
+ + "CAST((row_number() over(order by t1.dict_key)) as BIGINT) + "
+ + "CAST(" + maxGlobalDictValue + " as BIGINT) as dict_value from "
+ "(select dict_key from " + distinctKeyTableName + " where dict_column='" + distinctColumnName + "' and dict_key is not null)t1 left join "
+ " (select dict_key,dict_value from " + globalDictTableName + " where dict_column='" + distinctColumnName + "' )t2 " +
"on t1.dict_key = t2.dict_key where t2.dict_value is null";
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org