From f8f951ee1527ccf611c0f706517852384148db23 Mon Sep 17 00:00:00 2001 From: Zhang Lizhi Date: Thu, 21 Nov 2024 01:18:36 +0800 Subject: [PATCH] Fix null (#3258) --- .../relational/snowflake/SnowflakeSink.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-snowflake/src/main/java/org/finos/legend/engine/persistence/components/relational/snowflake/SnowflakeSink.java b/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-snowflake/src/main/java/org/finos/legend/engine/persistence/components/relational/snowflake/SnowflakeSink.java index 03be1c88281..4c6ae90f8b0 100644 --- a/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-snowflake/src/main/java/org/finos/legend/engine/persistence/components/relational/snowflake/SnowflakeSink.java +++ b/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-snowflake/src/main/java/org/finos/legend/engine/persistence/components/relational/snowflake/SnowflakeSink.java @@ -620,10 +620,26 @@ private void appendLoadQueryStats(Executor executo switch ((String) queryStats.get(QueryStatsLogicalPlanUtils.OPERATOR_TYPE_ALIAS)) { case QueryStatsLogicalPlanUtils.EXTERNAL_SCAN_STAGE: - stats.put(StatisticName.INPUT_FILES_BYTES_SCANNED, queryStats.get(QueryStatsLogicalPlanUtils.EXTERNAL_BYTES_SCANNED_ALIAS)); + Object externalScan = queryStats.get(QueryStatsLogicalPlanUtils.EXTERNAL_BYTES_SCANNED_ALIAS); + if (externalScan != null) + { + stats.put(StatisticName.INPUT_FILES_BYTES_SCANNED, externalScan); + } + else + { + stats.put(StatisticName.INPUT_FILES_BYTES_SCANNED, 0); + } break; case QueryStatsLogicalPlanUtils.INSERT_STAGE: - stats.put(StatisticName.INCOMING_RECORD_COUNT, queryStats.get(QueryStatsLogicalPlanUtils.INPUT_ROWS_ALIAS)); + Object insert = queryStats.get(QueryStatsLogicalPlanUtils.INPUT_ROWS_ALIAS); + if (insert != null) + { + stats.put(StatisticName.INCOMING_RECORD_COUNT, insert); + } + else + { + stats.put(StatisticName.INCOMING_RECORD_COUNT, 0); + } break; } });