-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Skip empty files for local, hdfs, and cloud input sources #9450
Conversation
@@ -40,6 +42,7 @@ | |||
public class MaxSizeSplitHintSpec implements SplitHintSpec | |||
{ | |||
public static final String TYPE = "maxSize"; | |||
private static final Logger LOG = new Logger(MaxSizeSplitHintSpec.class); |
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.
Unused?
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.
Oops. Removed.
@@ -21,6 +21,7 @@ | |||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; | |||
import nl.jqno.equalsverifier.EqualsVerifier; | |||
import org.apache.commons.compress.utils.Lists; |
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.
Should this be the one from guava instead? (same for MaxSizeSplitHintSpecTest
)
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.
Oops. Fixed.
prepareNextRequest(); | ||
fetchNextBatch(); |
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.
This branch is not covered by unit tests
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.
Added a test.
@@ -98,11 +99,19 @@ public void testGetFileIteratorWithBothBaseDirAndDuplicateFilesIteratingFilesOnl | |||
File baseDir = temporaryFolder.newFolder(); | |||
List<File> filesInBaseDir = new ArrayList<>(); | |||
for (int i = 0; i < 10; i++) { | |||
filesInBaseDir.add(File.createTempFile("local-input-source", ".data", baseDir)); | |||
final File file = File.createTempFile("local-input-source", ".data", baseDir); | |||
try (FileWriter writer = new FileWriter(file)) { |
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.
The forbidden apis checks is flagging this: java.io.FileWriter [Uses default charset]
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.
Fixed.
@@ -19,6 +19,7 @@ | |||
|
|||
package org.apache.druid.storage.azure; | |||
|
|||
import com.google.api.client.util.Lists; |
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.
You'll need to update the pom to add this dependency:
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<scope>test</scope>
</dependency>
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.
Ah, this was a mistake. I'm not sure why the Intellij keeps adding a wrong one. Fixed it now.
* Skip empty files for local, hdfs, and cloud input sources * split hint spec doc * doc for skipping empty files * fix typo; adjust tests * unnecessary fluent iterable * address comments * fix test * use the right lists * fix test * fix test
Description
This PR modifies the input sources to skip empty files except for the HTTP input source. This PR additionally fixes the two bugs:
This PR has: