From 8426e450b8227545269460c16933f85547209e14 Mon Sep 17 00:00:00 2001 From: Andreea Paduraru <40387422+andreeapad@users.noreply.github.com> Date: Thu, 4 Mar 2021 13:37:31 +0000 Subject: [PATCH] Fix metastore tunnel creation when hive configuration properties are not set (#210) --- CHANGELOG.md | 4 ++++ .../client/tunnelling/TunnelingMetaStoreClientFactory.java | 2 ++ .../tunnelling/TunnelingMetaStoreClientFactoryTest.java | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc8d3215..98e617afb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.9.1] - TBD +### Fixed +* Null pointer exception when creating a metastore tunnel by adding a check for null `configuration-properties`. + ## [3.9.0] - 2021-02-26 ### Added * Support for setting Hive metastore filter hooks which can be configured per federated metastore. See the [README](https://github.com/HotelsDotCom/waggle-dance#federation) for more information. diff --git a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactory.java b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactory.java index 27ee10941..d2db8ad73 100644 --- a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactory.java +++ b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactory.java @@ -78,7 +78,9 @@ public CloseableThriftHiveMetastoreIface newInstance( Map properties = new HashMap<>(); properties.put(ConfVars.METASTOREURIS.varname, uri); + if (configurationProperties != null) { properties.putAll(configurationProperties); + } HiveConfFactory confFactory = new HiveConfFactory(Collections.emptyList(), properties); HiveConf localHiveConf = localHiveConfFactory.newInstance(localHost, localPort, confFactory.newInstance()); diff --git a/waggle-dance-core/src/test/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactoryTest.java b/waggle-dance-core/src/test/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactoryTest.java index 3612e1a39..dee61f1d4 100644 --- a/waggle-dance-core/src/test/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactoryTest.java +++ b/waggle-dance-core/src/test/java/com/hotels/bdp/waggledance/client/tunnelling/TunnelingMetaStoreClientFactoryTest.java @@ -103,6 +103,12 @@ public void newInstance() { assertThat(tunnelable, is(hiveMetaStoreClientSupplier)); } + @Test + public void newInstanceNullConfigurationProperties() { + tunnelingMetaStoreClientFactory.newInstance(METASTORE_URI, metastoreTunnel, NAME, RECONNECTION_RETRIES, + CONNECTION_TIMEOUT, null); + } + @Test public void newInstanceMultipleUris() { String metastoreUris = METASTORE_URI + ",thrift://metastore-host2:43";