This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 7ca6841 In SegmentCreationJob, fix the issue where ControllerRestApi
is used when _pushLocations is not set (#3837)
7ca6841 is described below
commit 7ca6841add8dea6cd6bdb5ca982108cf57bc9718
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Thu Feb 14 16:08:05 2019 -0800
In SegmentCreationJob, fix the issue where ControllerRestApi is used when
_pushLocations is not set (#3837)
When extending SegmentCreationJob class, the ControllerRestApi can be
constructed without _pushLocations
Change getTableConfig() and getSchema() so that they work without setting
_pushLocations
---
.../pinot/hadoop/job/SegmentCreationJob.java | 23 ++++++++++------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git
a/pinot-hadoop/src/main/java/org/apache/pinot/hadoop/job/SegmentCreationJob.java
b/pinot-hadoop/src/main/java/org/apache/pinot/hadoop/job/SegmentCreationJob.java
index f077197..e055e3a 100644
---
a/pinot-hadoop/src/main/java/org/apache/pinot/hadoop/job/SegmentCreationJob.java
+++
b/pinot-hadoop/src/main/java/org/apache/pinot/hadoop/job/SegmentCreationJob.java
@@ -211,24 +211,20 @@ public class SegmentCreationJob extends BaseSegmentJob {
@Nullable
protected TableConfig getTableConfig()
throws IOException {
- if (_pushLocations != null) {
- try (ControllerRestApi controllerRestApi = getControllerRestApi()) {
- return controllerRestApi.getTableConfig();
- }
- } else {
- return null;
+ try (ControllerRestApi controllerRestApi = getControllerRestApi()) {
+ return controllerRestApi != null ? controllerRestApi.getTableConfig() :
null;
}
}
protected Schema getSchema()
throws IOException {
- if (_pushLocations != null) {
- try (ControllerRestApi controllerRestApi = getControllerRestApi()) {
+ try (ControllerRestApi controllerRestApi = getControllerRestApi()) {
+ if (controllerRestApi != null) {
return controllerRestApi.getSchema();
- }
- } else {
- try (InputStream inputStream = _fileSystem.open(_schemaFile)) {
- return Schema.fromInputSteam(inputStream);
+ } else {
+ try (InputStream inputStream = _fileSystem.open(_schemaFile)) {
+ return Schema.fromInputSteam(inputStream);
+ }
}
}
}
@@ -236,8 +232,9 @@ public class SegmentCreationJob extends BaseSegmentJob {
/**
* Can be overridden to provide custom controller Rest API.
*/
+ @Nullable
protected ControllerRestApi getControllerRestApi() {
- return new DefaultControllerRestApi(_pushLocations, _rawTableName);
+ return _pushLocations != null ? new
DefaultControllerRestApi(_pushLocations, _rawTableName) : null;
}
protected void validateTableConfig(TableConfig tableConfig) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]