Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting hive conf which doesn't have a hivevar #39

Merged
merged 3 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Depend on `junit-jupiter` (was `junit-jupiter-api`).
- `hotels-oss-parent` version updated to `4.2.0` (was `4.1.0`).
- Upgraded version of `hive.version` to `2.3.7` (was `2.3.4`). Allows BeeJU to be used on JDK>=9.
- Add support for setting hive conf using arbitrary string as conf key

## [3.0.1] - 2019-09-27
### Changed
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/hotels/beeju/core/BeejuCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ void setHiveVar(HiveConf.ConfVars variable, String value) {
conf.setVar(variable, value);
}

void setHiveConf(String variable, String value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so this allows one to set arbitrary String values in the HiveConf as opposed to only the ones that Hive itself exposes via HiveConf.ConfVars. It looks like a reasonable addition to me and I can see how this could be useful. Could you please add a simple unit test for this along the lines of https://github.com/HotelsDotCom/beeju/blob/master/src/test/java/com/hotels/beeju/core/BeejuCoreTest.java#L75?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I made the changes.

conf.set(variable, value);
}

void setHiveIntVar(HiveConf.ConfVars variable, int value) {
conf.setIntVar(variable, value);
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/hotels/beeju/core/BeejuCoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public void setHiveVar() {
assertThat(defaultCore.conf().getVar(HiveConf.ConfVars.METASTORECONNECTURLKEY), is("test"));
}

@Test
public void setHiveConf() {
defaultCore.setHiveConf("my.custom.key", "test");
assertThat(defaultCore.conf().get("my.custom.key"), is("test"));
}

@Test
public void setHiveIntVar() {
defaultCore.setHiveIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT, 00000);
Expand Down