EmmyMiao87 commented on a change in pull request #5689:
URL: https://github.com/apache/incubator-doris/pull/5689#discussion_r618078005



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/LoadStmt.java
##########
@@ -114,6 +114,9 @@
     public static final String KEY_IN_PARAM_SEQUENCE_COL = "sequence_col";
     public static final String KEY_IN_PARAM_BACKEND_ID = "backend_id";
 
+    //export
+    public static final String EXPORT_KEY_IN_PARAM_COLUMNS = "columns";

Review comment:
       use  KEY_IN_PARAM_COLUMNS instead

##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java
##########
@@ -17,6 +17,7 @@
 
 package org.apache.doris.analysis;
 
+import com.google.common.base.Splitter;

Review comment:
       please pay attention to import sequence

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java
##########
@@ -235,8 +238,8 @@ public void setJob(ExportStmt stmt) throws UserException {
         }
     }
 
-    private void genExecFragment() throws UserException {
-        registerToDesc();
+    private void genExecFragment(ExportStmt stmt) throws UserException {

Review comment:
       ```suggestion
       private void genExecFragment() throws UserException {
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java
##########
@@ -220,7 +223,7 @@ public void setJob(ExportStmt stmt) throws UserException {
             }
             this.tableId = exportTable.getId();
             this.tableName = stmt.getTblName();
-            genExecFragment();
+            genExecFragment(stmt);

Review comment:
       ```suggestion
               genExecFragment();
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java
##########
@@ -252,17 +255,25 @@ private void genExecFragment() throws UserException {
         plan();
     }
 
-    private void registerToDesc() {
+    private void registerToDesc(ExportStmt stmt) {
         TableRef ref = new TableRef(tableName, null, partitions == null ? null 
: new PartitionNames(false, partitions));
         BaseTableRef tableRef = new BaseTableRef(ref, exportTable, tableName);
         exportTupleDesc = desc.createTupleDescriptor();
         exportTupleDesc.setTable(exportTable);
         exportTupleDesc.setRef(tableRef);
+        this.exportColumns = stmt.getColumns();

Review comment:
       please set it in public void setJob(ExportStmt stmt) throws UserException

##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java
##########
@@ -264,6 +271,13 @@ private void checkProperties(Map<String, String> 
properties) throws UserExceptio
                 properties, ExportStmt.DEFAULT_COLUMN_SEPARATOR));
         this.lineDelimiter = 
Separator.convertSeparator(PropertyAnalyzer.analyzeLineDelimiter(
                 properties, ExportStmt.DEFAULT_LINE_DELIMITER));
+        if(properties.containsKey(LoadStmt.EXPORT_KEY_IN_PARAM_COLUMNS)){

Review comment:
       code format

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java
##########
@@ -252,17 +255,25 @@ private void genExecFragment() throws UserException {
         plan();
     }
 
-    private void registerToDesc() {
+    private void registerToDesc(ExportStmt stmt) {

Review comment:
       ```suggestion
       private void registerToDesc() {
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java
##########
@@ -252,17 +255,25 @@ private void genExecFragment() throws UserException {
         plan();
     }
 
-    private void registerToDesc() {
+    private void registerToDesc(ExportStmt stmt) {
         TableRef ref = new TableRef(tableName, null, partitions == null ? null 
: new PartitionNames(false, partitions));
         BaseTableRef tableRef = new BaseTableRef(ref, exportTable, tableName);
         exportTupleDesc = desc.createTupleDescriptor();
         exportTupleDesc.setTable(exportTable);
         exportTupleDesc.setRef(tableRef);
+        this.exportColumns = stmt.getColumns();
         for (Column col : exportTable.getBaseSchema()) {
-            SlotDescriptor slot = desc.addSlotDescriptor(exportTupleDesc);
-            slot.setIsMaterialized(true);
-            slot.setColumn(col);
-            slot.setIsNullable(col.isAllowNull());
+            if(!this.exportColumns.isEmpty() && 
this.exportColumns.contains(col.getName().toLowerCase())) {

Review comment:
       code format




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to