This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 15e6ba59f5b branch-3.0: [fix](export) fix error in show export outfile info column #46850 (#46953) 15e6ba59f5b is described below commit 15e6ba59f5b29901dec825ead0d5ad3167dff5f5 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Wed Jan 15 13:57:47 2025 +0800 branch-3.0: [fix](export) fix error in show export outfile info column #46850 (#46953) Cherry-picked from #46850 Co-authored-by: Mingyu Chen (Rayner) <morning...@163.com> --- .../org/apache/doris/load/ExportTaskExecutor.java | 2 +- .../apache/doris/load/ExportOutfileInfoTest.java | 84 ++++++++++++++++++++++ .../suites/export_p0/test_with_bom.groovy | 8 +-- 3 files changed, 89 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/ExportTaskExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/load/ExportTaskExecutor.java index 1cfdc0c174c..94f432f1c16 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/ExportTaskExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/ExportTaskExecutor.java @@ -183,7 +183,7 @@ public class ExportTaskExecutor implements TransientTaskExecutor { OutfileInfo outfileInfo = new OutfileInfo(); outfileInfo.setFileNumber(resultAttachedInfo.get(OutFileClause.FILE_NUMBER)); outfileInfo.setTotalRows(resultAttachedInfo.get(OutFileClause.TOTAL_ROWS)); - outfileInfo.setFileSize(resultAttachedInfo.get(OutFileClause.FILE_SIZE) + "bytes"); + outfileInfo.setFileSize(resultAttachedInfo.get(OutFileClause.FILE_SIZE)); outfileInfo.setUrl(resultAttachedInfo.get(OutFileClause.URL)); return outfileInfo; } diff --git a/fe/fe-core/src/test/java/org/apache/doris/load/ExportOutfileInfoTest.java b/fe/fe-core/src/test/java/org/apache/doris/load/ExportOutfileInfoTest.java new file mode 100644 index 00000000000..6aa6764cd8d --- /dev/null +++ b/fe/fe-core/src/test/java/org/apache/doris/load/ExportOutfileInfoTest.java @@ -0,0 +1,84 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.load; + +import org.apache.doris.persist.gson.GsonUtils; + +import com.google.common.collect.Lists; +import org.junit.Assert; +import org.junit.Test; + +import java.util.List; + +public class ExportOutfileInfoTest { + + @Test + public void testOutfileInfo() throws Exception { + // outfileInfoList1 + OutfileInfo outfileInfo1 = new OutfileInfo(); + outfileInfo1.setFileNumber("2"); + outfileInfo1.setTotalRows("1234"); + outfileInfo1.setFileSize("10240"); + outfileInfo1.setUrl("file:///172.20.32.136/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*"); + + OutfileInfo outfileInfo2 = new OutfileInfo(); + outfileInfo2.setFileNumber("2"); + outfileInfo2.setTotalRows("1235"); + outfileInfo2.setFileSize("10250"); + outfileInfo2.setUrl("file:///172.20.32.136/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*"); + + List<OutfileInfo> outfileInfoList1 = Lists.newArrayList(); + outfileInfoList1.add(outfileInfo1); + outfileInfoList1.add(outfileInfo2); + + // outfileInfoList2 + OutfileInfo outfileInfo3 = new OutfileInfo(); + outfileInfo3.setFileNumber("3"); + outfileInfo3.setTotalRows("2345"); + outfileInfo3.setFileSize("20260"); + outfileInfo3.setUrl("file:///172.20.32.137/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*"); + + OutfileInfo outfileInfo4 = new OutfileInfo(); + outfileInfo4.setFileNumber("3"); + outfileInfo4.setTotalRows("2346"); + outfileInfo4.setFileSize("20270"); + outfileInfo4.setUrl("file:///172.20.32.137/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*"); + + List<OutfileInfo> outfileInfoList2 = Lists.newArrayList(); + outfileInfoList2.add(outfileInfo3); + outfileInfoList2.add(outfileInfo4); + + List<List<OutfileInfo>> allOutfileInfo = Lists.newArrayList(); + allOutfileInfo.add(outfileInfoList1); + allOutfileInfo.add(outfileInfoList2); + + String showInfo = GsonUtils.GSON.toJson(allOutfileInfo); + System.out.println(showInfo); + Assert.assertEquals( + "[[{\"fileNumber\":\"2\",\"totalRows\":\"1234\",\"fileSize\":\"10240\"," + + "\"url\":\"file:///172.20.32.136/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*\"}," + + "{\"fileNumber\":\"2\",\"totalRows\":\"1235\",\"fileSize\":\"10250\"," + + "\"url\":\"file:///172.20.32.136/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*\"}]," + + "[{\"fileNumber\":\"3\",\"totalRows\":\"2345\",\"fileSize\":\"20260\"," + + "\"url\":\"file:///172.20.32.137/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*\"}," + + "{\"fileNumber\":\"3\",\"totalRows\":\"2346\",\"fileSize\":\"20270\"," + + "\"url\":\"file:///172.20.32.137/path/to/result2_c6df5f01bd664dde-a2168b019b6c2b3f_*\"}]]", + showInfo); + } + +} diff --git a/regression-test/suites/export_p0/test_with_bom.groovy b/regression-test/suites/export_p0/test_with_bom.groovy index 03bcaa4302c..9c7b028ae8e 100644 --- a/regression-test/suites/export_p0/test_with_bom.groovy +++ b/regression-test/suites/export_p0/test_with_bom.groovy @@ -126,7 +126,7 @@ suite("test_with_bom", "p0") { """ // check outfile bytes - check_bytes("145bytes", label) + check_bytes("145", label) } finally { } @@ -165,7 +165,7 @@ suite("test_with_bom", "p0") { """ // check outfile bytes - check_bytes("148bytes", label) + check_bytes("148", label) } finally { } @@ -204,7 +204,7 @@ suite("test_with_bom", "p0") { """ // check outfile bytes - check_bytes("161bytes", label) + check_bytes("161", label) } finally { } @@ -243,7 +243,7 @@ suite("test_with_bom", "p0") { """ // check outfile bytes - check_bytes("172bytes", label) + check_bytes("172", label) } finally { } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org