-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](broker load)fix wildcard import failure caused by 0-byte metadata files #59486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
qidaye
wants to merge
1
commit into
apache:master
Choose a base branch
from
qidaye:fix_broker_load_wildcard_import
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
fe/fe-core/src/test/java/org/apache/doris/datasource/FileGroupInfoTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| // 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.datasource; | ||
|
|
||
| import org.apache.doris.analysis.BrokerDesc; | ||
| import org.apache.doris.catalog.Table; | ||
| import org.apache.doris.common.UserException; | ||
| import org.apache.doris.common.jmockit.Deencapsulation; | ||
| import org.apache.doris.load.BrokerFileGroup; | ||
| import org.apache.doris.planner.FileLoadScanNode; | ||
| import org.apache.doris.thrift.TBrokerFileStatus; | ||
| import org.apache.doris.thrift.TFileCompressType; | ||
| import org.apache.doris.thrift.TFileFormatType; | ||
| import org.apache.doris.thrift.TFileRangeDesc; | ||
| import org.apache.doris.thrift.TFileScanRangeParams; | ||
| import org.apache.doris.thrift.TScanRangeLocations; | ||
|
|
||
| import mockit.Expectations; | ||
| import mockit.Injectable; | ||
| import mockit.Mocked; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public class FileGroupInfoTest { | ||
|
|
||
| @Test | ||
| public void testCreateScanRangeLocationsUnsplittable( | ||
| @Injectable FileLoadScanNode.ParamCreateContext context, | ||
| @Injectable FederationBackendPolicy backendPolicy, | ||
| @Injectable BrokerFileGroup fileGroup, | ||
| @Injectable Table targetTable, | ||
| @Mocked BrokerDesc brokerDesc) throws UserException { | ||
|
|
||
| List<TBrokerFileStatus> fileStatuses = new ArrayList<>(); | ||
| TBrokerFileStatus lzoFile = new TBrokerFileStatus(); | ||
| lzoFile.path = "hdfs://localhost:8900/data.csv.lzo"; | ||
| lzoFile.size = 100; | ||
| fileStatuses.add(lzoFile); | ||
|
|
||
| TBrokerFileStatus plainFile = new TBrokerFileStatus(); | ||
| plainFile.path = "hdfs://localhost:8900/data.csv"; | ||
| plainFile.size = 50; | ||
| fileStatuses.add(plainFile); | ||
|
|
||
| FileGroupInfo fileGroupInfo = new FileGroupInfo(1L, 1L, targetTable, brokerDesc, fileGroup, fileStatuses, 2, false, 1); | ||
| Deencapsulation.setField(fileGroupInfo, "numInstances", 1); | ||
|
|
||
| TFileScanRangeParams params = new TFileScanRangeParams(); | ||
| context.params = params; | ||
| context.fileGroup = fileGroup; | ||
|
|
||
| new Expectations() { | ||
| { | ||
| fileGroup.getFileFormatProperties().getFormatName(); | ||
| result = "csv"; | ||
| fileGroup.getFileFormatProperties().getCompressionType(); | ||
| result = TFileCompressType.UNKNOWN; // infer from path | ||
| fileGroup.getColumnNamesFromPath(); | ||
| result = new ArrayList<String>(); | ||
| } | ||
| }; | ||
|
|
||
| List<TScanRangeLocations> scanRangeLocations = new ArrayList<>(); | ||
| fileGroupInfo.createScanRangeLocationsUnsplittable(context, backendPolicy, scanRangeLocations); | ||
|
|
||
| Assert.assertEquals(1, scanRangeLocations.size()); | ||
| List<TFileRangeDesc> ranges = scanRangeLocations.get(0).getScanRange().getExtScanRange().getFileScanRange().getRanges(); | ||
| Assert.assertEquals(2, ranges.size()); | ||
|
|
||
| // Check LZO file | ||
| TFileRangeDesc lzoRange = ranges.get(0); | ||
| Assert.assertEquals(TFileFormatType.FORMAT_CSV_PLAIN, lzoRange.getFormatType()); | ||
| Assert.assertEquals(TFileCompressType.LZOP, lzoRange.getCompressType()); | ||
|
|
||
| // Check Plain file | ||
| TFileRangeDesc plainRange = ranges.get(1); | ||
| Assert.assertEquals(TFileFormatType.FORMAT_CSV_PLAIN, plainRange.getFormatType()); | ||
| Assert.assertEquals(TFileCompressType.PLAIN, plainRange.getCompressType()); | ||
|
|
||
| // Shared params should NOT be set (they are deprecated and we want to avoid overwriting) | ||
| // Actually, in my implementation I removed the setFormatType/setCompressType from the loop. | ||
| // They might still have default values or be set elsewhere, but they shouldn't be the LZO/PLAIN from the loop. | ||
| Assert.assertFalse(params.isSetFormatType()); | ||
| Assert.assertFalse(params.isSetCompressType()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是可以类似这个pr:(#59398)把下划线和点开头的文件都过滤一下?如果担心影响比较大,可以在broker load的option里加一个开关。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
支持一个file Group中指定不同的文件类型后,这里其实不过滤也没有问题了。目前是为了保险起见增加了这个_SUCCESS文件的特殊过滤。