From dd8d24a8100243370eae047613221cefc565ff90 Mon Sep 17 00:00:00 2001 From: maeken Date: Fri, 1 Mar 2024 01:03:50 +0000 Subject: [PATCH] remove unnecessary instance variable --- .../org/embulk/output/SnowflakeOutputPlugin.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java b/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java index e3e2363..bddc9cc 100644 --- a/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java +++ b/src/main/java/org/embulk/output/SnowflakeOutputPlugin.java @@ -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") @@ -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); } @@ -185,11 +183,10 @@ protected BatchInsert newBatchInsert(PluginTask task, Optional 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());