Skip to content

Commit

Permalink
remove unnecessary instance variable
Browse files Browse the repository at this point in the history
  • Loading branch information
maeken committed Mar 1, 2024
1 parent 6241505 commit dd8d24a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/java/org/embulk/output/SnowflakeOutputPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import org.embulk.util.config.ConfigDefault;

public class SnowflakeOutputPlugin extends AbstractJdbcOutputPlugin {
private StageIdentifier stageIdentifier;

public interface SnowflakePluginTask extends PluginTask {
@Config("driver_path")
@ConfigDefault("null")
Expand Down Expand Up @@ -139,21 +137,21 @@ public ConfigDiff transaction(
ConfigSource config, Schema schema, int taskCount, OutputPlugin.Control control) {
PluginTask task = CONFIG_MAPPER.map(config, this.getTaskClass());
SnowflakePluginTask t = (SnowflakePluginTask) task;
this.stageIdentifier = StageIdentifierHolder.getStageIdentifier(t);
StageIdentifier stageIdentifier = StageIdentifierHolder.getStageIdentifier(t);
ConfigDiff configDiff;
SnowflakeOutputConnection snowflakeCon = null;

try {
snowflakeCon = (SnowflakeOutputConnection) getConnector(task, true).connect(true);
snowflakeCon.runCreateStage(this.stageIdentifier);
snowflakeCon.runCreateStage(stageIdentifier);
configDiff = super.transaction(config, schema, taskCount, control);
if (t.getDeleteStage()) {
snowflakeCon.runDropStage(this.stageIdentifier);
snowflakeCon.runDropStage(stageIdentifier);
}
} catch (Exception e) {
if (t.getDeleteStage() && t.getDeleteStageOnError()) {
try {
snowflakeCon.runDropStage(this.stageIdentifier);
snowflakeCon.runDropStage(stageIdentifier);
} catch (SQLException ex) {
throw new RuntimeException(ex);
}
Expand Down Expand Up @@ -185,11 +183,10 @@ protected BatchInsert newBatchInsert(PluginTask task, Optional<MergeConfig> merg
"Snowflake output plugin doesn't support 'merge_direct' mode.");
}
SnowflakePluginTask pluginTask = (SnowflakePluginTask) task;
this.stageIdentifier = StageIdentifierHolder.getStageIdentifier(pluginTask);

return new SnowflakeCopyBatchInsert(
getConnector(task, true),
this.stageIdentifier,
StageIdentifierHolder.getStageIdentifier(pluginTask),
false,
pluginTask.getMaxUploadRetries(),
pluginTask.getEmtpyFieldAsNull());
Expand Down

0 comments on commit dd8d24a

Please sign in to comment.