This is an automated email from the ASF dual-hosted git repository.
starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 4adb321c9bd [fix](nereids)fix load command failed with bitmap column
expr mapping (#53918)
4adb321c9bd is described below
commit 4adb321c9bdfbd28ae86d8fd11ce317b732011f6
Author: starocean999 <[email protected]>
AuthorDate: Tue Sep 16 10:38:10 2025 +0800
[fix](nereids)fix load command failed with bitmap column expr mapping
(#53918)
column mapping expr in form:
`column = expr`, and the '=' should not be treat as equalTo but assign.
So when analyze `column = expr,` we analyze the column and expr
separately to work around the type mismatch issue with equalTo
---
.../doris/nereids/load/NereidsDataDescription.java | 12 ++++++-
.../trees/plans/commands/LoadCommandTest.java | 42 ++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/load/NereidsDataDescription.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/load/NereidsDataDescription.java
index eb1a727afdf..5f9b7140c58 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/load/NereidsDataDescription.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/load/NereidsDataDescription.java
@@ -17,6 +17,7 @@
package org.apache.doris.nereids.load;
+import org.apache.doris.analysis.BinaryPredicate;
import org.apache.doris.analysis.ColumnDef;
import org.apache.doris.analysis.DataDescription;
import org.apache.doris.analysis.Expr;
@@ -1170,7 +1171,16 @@ public class NereidsDataDescription {
if (this.columnMappingList != null &&
!this.columnMappingList.isEmpty()) {
for (Expression expression : this.columnMappingList) {
if (expression != null) {
-
legacyColumnMappingList.add(PlanUtils.translateToLegacyExpr(expression, null,
ctx));
+ if (expression instanceof EqualTo) {
+ // we should not cast right type to left type here,
because we do the cast when
+ // creating load plan later, see
NereidsLoadUtils.createLoadPlan for more details
+ Expr left = PlanUtils.translateToLegacyExpr(((EqualTo)
expression).left(), null, ctx);
+ Expr right =
PlanUtils.translateToLegacyExpr(((EqualTo) expression).right(), null, ctx);
+ legacyColumnMappingList.add(new
BinaryPredicate(BinaryPredicate.Operator.EQ, left, right));
+ } else {
+ throw new AnalysisException(String.format("column
mapping expr must be EqualTo, but it's %s",
+ expression));
+ }
}
}
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
index 1c3481640f4..50b9da79c5b 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/LoadCommandTest.java
@@ -73,6 +73,48 @@ public class LoadCommandTest extends TestWithFeService {
+ "\"storage_format\" = \"V2\"\n"
+ ");";
createTable(createTableSql);
+
+ String createTableBitmapSql = "CREATE TABLE `load_bitmap_table`\n"
+ + " (\n"
+ + " `dt_h` datetime NOT NULL,\n"
+ + " `userid_bitmap` bitmap BITMAP_UNION NOT NULL\n"
+ + " ) ENGINE = OLAP AGGREGATE KEY(`dt_h`)\n"
+ + " DISTRIBUTED BY HASH(`dt_h`) BUCKETS 4\n"
+ + " PROPERTIES (\"replication_num\" = \"1\");";
+ createTable(createTableBitmapSql);
+ }
+
+ @Test
+ public void testLoadCommandBitmap() {
+ String loadSql1 = "LOAD LABEL load_bitmap_table_test( "
+ + " DATA INFILE(\"s3://bucket/load_bitmap_table\") "
+ + " INTO TABLE load_bitmap_table "
+ + " COLUMNS TERMINATED BY \"|\""
+ + " LINES TERMINATED BY \"\n\""
+ + " (raw_dt_h,raw_userid_bitmap) "
+ + " SET (`dt_h` = raw_dt_h, `userid_bitmap` =
bitmap_from_array(cast(raw_userid_bitmap as ARRAY<BIGINT(20)>)))"
+ + " ) "
+ + " WITH S3( "
+ + " \"s3.access_key\" = \"AK\", "
+ + " \"s3.secret_key\" = \"SK\", "
+ + " \"s3.endpoint\" = \"cos.ap-beijing.myqcloud.com\", "
+ + " \"s3.region\" = \"ap-beijing\") "
+ + "PROPERTIES( \"exec_mem_limit\" = \"8589934592\") COMMENT
\"test\";";
+
+ List<Pair<LogicalPlan, StatementContext>> statements = new
NereidsParser().parseMultiple(loadSql1);
+ Assertions.assertFalse(statements.isEmpty());
+
+ // columns
+ LoadCommand command = (LoadCommand) statements.get(0).first;
+ List<NereidsDataDescription> dataDescriptions =
command.getDataDescriptions();
+ Assertions.assertFalse(dataDescriptions.isEmpty());
+ NereidsDataDescription dataDescription = dataDescriptions.get(0);
+ List<String> colNames = dataDescription.getFileFieldNames();
+ Assertions.assertEquals(2, colNames.size());
+ Assertions.assertTrue(colNames.contains("raw_dt_h"));
+ Assertions.assertTrue(colNames.contains("raw_userid_bitmap"));
+ Assertions.assertTrue(dataDescription.getColumnMappingList().size() ==
2);
+
Assertions.assertTrue(dataDescription.getColumnMappingList().get(1).child(0).getExpressionName().contains("userid_bitmap"));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]