From 4ae4566b3aed381328d2b2ce37db19000714a88c Mon Sep 17 00:00:00 2001 From: Tomoyuki Morita Date: Wed, 17 Jul 2024 11:50:33 -0700 Subject: [PATCH] Fix SparkExecutionEngineConfigClusterSetting deserialize issue Signed-off-by: Tomoyuki Morita --- .../SparkExecutionEngineConfigClusterSetting.java | 4 ++++ ...arkExecutionEngineConfigClusterSettingTest.java | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/async-query/src/main/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSetting.java b/async-query/src/main/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSetting.java index 5c1328bf91..1d6c561fe9 100644 --- a/async-query/src/main/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSetting.java +++ b/async-query/src/main/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSetting.java @@ -6,8 +6,10 @@ package org.opensearch.sql.spark.config; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import org.opensearch.sql.utils.SerializeUtils; /** @@ -16,6 +18,8 @@ */ @Data @Builder +@AllArgsConstructor +@NoArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) public class SparkExecutionEngineConfigClusterSetting { // optional diff --git a/async-query/src/test/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSettingTest.java b/async-query/src/test/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSettingTest.java index c6be37567d..a2c7984fc7 100644 --- a/async-query/src/test/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSettingTest.java +++ b/async-query/src/test/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigClusterSettingTest.java @@ -46,4 +46,18 @@ public void testToSparkExecutionEngineConfigWithAllFields() { assertEquals("us-west-1", config.getRegion()); assertEquals("--conf A=1", config.getSparkSubmitParameters()); } + + @Test + public void testToSparkExecutionEngineConfigWithNoFields() { + String json = "{}"; + + SparkExecutionEngineConfigClusterSetting config = + SparkExecutionEngineConfigClusterSetting.toSparkExecutionEngineConfig(json); + + assertNull(config.getApplicationId()); + assertNull(config.getExecutionRoleARN()); + assertNull(config.getRegion()); + assertNull(config.getSparkSubmitParameters()); + } + }