Skip to content
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

[GOBBLIN-1906] Add null-check to JobConfigurationUtils.putStateIntoConfiguration to avoid IllegalArgumentException #3770

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import org.apache.gobblin.configuration.State;
import org.apache.gobblin.state.ConstructState;
import org.apache.gobblin.util.JobConfigurationUtils;

/**
* A wrapper for ORC-core writer without dependency on Hive SerDe library.
Expand Down Expand Up @@ -117,9 +118,7 @@ public GobblinBaseOrcWriter(FsDataWriterBuilder<S, D> builder, State properties)
// Create file-writer
this.writerConfig = new Configuration();
// Populate job Configurations into Conf as well so that configurations related to ORC writer can be tuned easily.
for (Object key : properties.getProperties().keySet()) {
this.writerConfig.set((String) key, properties.getProp((String) key));
}
JobConfigurationUtils.putStateIntoConfiguration(properties, this.writerConfig);
OrcFile.WriterOptions options = OrcFile.writerOptions(properties.getProperties(), this.writerConfig);
options.setSchema(typeDescription);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ protected void runWorkUnits(List<WorkUnit> workUnits) throws Exception {

prepareHadoopJob(workUnits);
if (this.shouldPersistWorkUnitsThenCancel) {
LOG.info("Cancelling job after persisting workunits beneath: " + this.jobInputPath);
// NOTE: `warn` level is hack for including path among automatic troubleshooter 'issues'
LOG.warn("Cancelling job after persisting workunits beneath: " + this.jobInputPath);
Comment on lines +319 to +320
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this trivial change is unrelated

jobState.setState(JobState.RunningState.CANCELLED);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ public static void putConfigurationIntoProperties(Configuration configuration, P
*/
public static void putStateIntoConfiguration(State state, Configuration configuration) {
for (String key : state.getPropertyNames()) {
configuration.set(key, state.getProp(key));
String value = state.getProp(key);
if (value != null) { // ignore `null`, to prevent `IllegalArgumentException` from `Configuration::set`
configuration.set(key, value);
}
}
}

Expand Down
Loading