This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
new 3cb414309f [fix](LOAD statement): fix bug for `toSql` func of
LoadStmt. (#12648)
3cb414309f is described below
commit 3cb414309fabe40348eb7ecf82b9c8ea8859608e
Author: wxy <[email protected]>
AuthorDate: Thu Sep 22 09:07:46 2022 +0800
[fix](LOAD statement): fix bug for `toSql` func of LoadStmt. (#12648)
---
.../src/main/java/org/apache/doris/analysis/DataDescription.java | 9 ++++++---
.../test/java/org/apache/doris/analysis/DataDescriptionTest.java | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
index 727c73c0c6..3ecfff45f7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
@@ -916,14 +916,17 @@ public class DataDescription {
if (columnSeparator != null) {
sb.append(" COLUMNS TERMINATED BY
").append(columnSeparator.toSql());
}
- if (columnsFromPath != null && !columnsFromPath.isEmpty()) {
- sb.append(" COLUMNS FROM PATH AS (");
- Joiner.on(", ").appendTo(sb, columnsFromPath).append(")");
+ if (fileFormat != null && !fileFormat.isEmpty()) {
+ sb.append(" FORMAT AS '" + fileFormat + "'");
}
if (fileFieldNames != null && !fileFieldNames.isEmpty()) {
sb.append(" (");
Joiner.on(", ").appendTo(sb, fileFieldNames).append(")");
}
+ if (columnsFromPath != null && !columnsFromPath.isEmpty()) {
+ sb.append(" COLUMNS FROM PATH AS (");
+ Joiner.on(", ").appendTo(sb, columnsFromPath).append(")");
+ }
if (columnMappingList != null && !columnMappingList.isEmpty()) {
sb.append(" SET (");
Joiner.on(", ").appendTo(sb, Lists.transform(columnMappingList,
new Function<Expr, Object>() {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/analysis/DataDescriptionTest.java
b/fe/fe-core/src/test/java/org/apache/doris/analysis/DataDescriptionTest.java
index dee1b0f319..19ecc0bdef 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/analysis/DataDescriptionTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/analysis/DataDescriptionTest.java
@@ -123,7 +123,7 @@ public class DataDescriptionTest {
desc = new DataDescription("testTable", null,
Lists.newArrayList("abc.txt"),
Lists.newArrayList("col1", "col2"), new Separator(","), "csv",
null, false, null, null, whereExpr, LoadTask.MergeType.MERGE, whereExpr, null,
null);
desc.analyze("testDb");
- Assert.assertEquals("MERGE DATA INFILE ('abc.txt') INTO TABLE
testTable COLUMNS TERMINATED BY ',' (col1, col2) WHERE 1 = 1 DELETE ON 1 = 1",
desc.toString());
+ Assert.assertEquals("MERGE DATA INFILE ('abc.txt') INTO TABLE
testTable COLUMNS TERMINATED BY ',' FORMAT AS 'csv' (col1, col2) WHERE 1 = 1
DELETE ON 1 = 1", desc.toString());
Assert.assertEquals("1 = 1", desc.getWhereExpr().toSql());
Assert.assertEquals("1 = 1", desc.getDeleteCondition().toSql());
Assert.assertEquals(",", desc.getColumnSeparator());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]