-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[MINOR] Making misc fixes to deltastreamer sources(S3 and GCS) #10095
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
Merged
codope
merged 5 commits into
apache:master
from
nsivabalan:s3GcsSourcesDeltaStreamerFix
Nov 23, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e363568
Making misc fixes to deltastreamer sources
nsivabalan a90b9b6
Fixing test failures
nsivabalan a6476f0
adding inference to CloudSourceconfig... cloud.data.datafile.format
nsivabalan a8f6cb4
Fix the tests for s3 events source
c1b5bd4
Fix the tests for s3 events source
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,4 +114,11 @@ private static String toHexString(byte[] bytes) { | |
| } | ||
| return sb.toString(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testTruncate() { | ||
| assertNull(StringUtils.truncate(null, 10, 10)); | ||
| assertEquals("http://use...ons/latest", StringUtils.truncate("http://username:[email protected]:5000/versions/latest", 10, 10)); | ||
| assertEquals("http://abc.com", StringUtils.truncate("http://abc.com", 10, 10)); | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |
| import org.apache.hudi.utilities.sources.helpers.QueryInfo; | ||
| import org.apache.hudi.utilities.sources.helpers.QueryRunner; | ||
|
|
||
| import org.apache.parquet.Strings; | ||
| import org.apache.spark.api.java.JavaSparkContext; | ||
| import org.apache.spark.sql.Dataset; | ||
| import org.apache.spark.sql.Encoders; | ||
|
|
@@ -51,6 +52,7 @@ | |
| import static org.apache.hudi.common.util.ConfigUtils.getIntWithAltKeys; | ||
| import static org.apache.hudi.common.util.ConfigUtils.getStringWithAltKeys; | ||
| import static org.apache.hudi.common.util.StringUtils.isNullOrEmpty; | ||
| import static org.apache.hudi.utilities.config.CloudSourceConfig.DATAFILE_FORMAT; | ||
| import static org.apache.hudi.utilities.config.CloudSourceConfig.ENABLE_EXISTS_CHECK; | ||
| import static org.apache.hudi.utilities.config.HoodieIncrSourceConfig.HOODIE_SRC_BASE_PATH; | ||
| import static org.apache.hudi.utilities.config.HoodieIncrSourceConfig.NUM_INSTANTS_PER_FETCH; | ||
|
|
@@ -70,6 +72,7 @@ | |
| public class S3EventsHoodieIncrSource extends HoodieIncrSource { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(S3EventsHoodieIncrSource.class); | ||
| private static final String EMPTY_STRING = ""; | ||
| private final String srcPath; | ||
| private final int numInstantsPerFetch; | ||
| private final boolean checkIfFileExists; | ||
|
|
@@ -133,7 +136,13 @@ public S3EventsHoodieIncrSource( | |
| this.srcPath = getStringWithAltKeys(props, HOODIE_SRC_BASE_PATH); | ||
| this.numInstantsPerFetch = getIntWithAltKeys(props, NUM_INSTANTS_PER_FETCH); | ||
| this.checkIfFileExists = getBooleanWithAltKeys(props, ENABLE_EXISTS_CHECK); | ||
| this.fileFormat = getStringWithAltKeys(props, SOURCE_FILE_FORMAT, true); | ||
|
|
||
| // This is to ensure backward compatibility where we were using the | ||
| // config SOURCE_FILE_FORMAT for file format in previous versions. | ||
| this.fileFormat = Strings.isNullOrEmpty(getStringWithAltKeys(props, DATAFILE_FORMAT, EMPTY_STRING)) | ||
| ? getStringWithAltKeys(props, SOURCE_FILE_FORMAT, true) | ||
| : getStringWithAltKeys(props, DATAFILE_FORMAT, EMPTY_STRING); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for last one you can ignore the last arg. default value will not be picked. |
||
|
|
||
| this.missingCheckpointStrategy = getMissingCheckpointStrategy(props); | ||
| this.queryRunner = queryRunner; | ||
| this.cloudDataFetcher = cloudDataFetcher; | ||
|
|
||
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.
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.
StringUtils already contains EMPTY_STRING