From be15dae4bb5130ac2c2ed7b19c7270eadd130a87 Mon Sep 17 00:00:00 2001 From: Rupal Mahajan Date: Wed, 5 Jul 2023 08:29:47 -0700 Subject: [PATCH] Address PR comment Signed-off-by: Rupal Mahajan --- .../opensearch/sql/spark/storage/SparkStorageEngine.java | 2 +- .../sql/spark/storage/SparkStorageEngineTest.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spark/src/main/java/org/opensearch/sql/spark/storage/SparkStorageEngine.java b/spark/src/main/java/org/opensearch/sql/spark/storage/SparkStorageEngine.java index 86697833a1..a5e35ecc4c 100644 --- a/spark/src/main/java/org/opensearch/sql/spark/storage/SparkStorageEngine.java +++ b/spark/src/main/java/org/opensearch/sql/spark/storage/SparkStorageEngine.java @@ -30,6 +30,6 @@ public Collection getFunctions() { @Override public Table getTable(DataSourceSchemaName dataSourceSchemaName, String tableName) { - return null; + throw new RuntimeException("Unable to get table from storage engine."); } } diff --git a/spark/src/test/java/org/opensearch/sql/spark/storage/SparkStorageEngineTest.java b/spark/src/test/java/org/opensearch/sql/spark/storage/SparkStorageEngineTest.java index 2c4f8a3567..7adcc725fa 100644 --- a/spark/src/test/java/org/opensearch/sql/spark/storage/SparkStorageEngineTest.java +++ b/spark/src/test/java/org/opensearch/sql/spark/storage/SparkStorageEngineTest.java @@ -8,6 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; @@ -40,7 +41,8 @@ public void getFunctions() { @Test public void getTable() { SparkStorageEngine engine = new SparkStorageEngine(client); - Table table = engine.getTable(new DataSourceSchemaName("spark", "default"), ""); - assertNull(table); + RuntimeException exception = assertThrows(RuntimeException.class, + () -> engine.getTable(new DataSourceSchemaName("spark", "default"), "")); + assertEquals("Unable to get table from storage engine.", exception.getMessage()); } }