You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fj...@apache.org on 2019/06/07 15:32:46 UTC
[incubator-druid] branch master updated: Web console: Normalize
ingestion spec type (#7847)
This is an automated email from the ASF dual-hosted git repository.
fjy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new 061b465 Web console: Normalize ingestion spec type (#7847)
061b465 is described below
commit 061b465d3408e1111694f821419f6c426642d45e
Author: Vadim Ogievetsky <va...@gmail.com>
AuthorDate: Fri Jun 7 08:32:40 2019 -0700
Web console: Normalize ingestion spec type (#7847)
* Normalize ingestion spec types
* also normalize on direct spec change
---
web-console/src/utils/ingestion-spec.tsx | 13 ++++++++++++
web-console/src/utils/sampler.ts | 3 +--
.../src/views/load-data-view/load-data-view.tsx | 23 +++++++++++++++-------
3 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/web-console/src/utils/ingestion-spec.tsx b/web-console/src/utils/ingestion-spec.tsx
index 355dc39..1328a37 100644
--- a/web-console/src/utils/ingestion-spec.tsx
+++ b/web-console/src/utils/ingestion-spec.tsx
@@ -147,6 +147,19 @@ export function changeParallel(spec: IngestionSpec, parallel: boolean): Ingestio
return newSpec;
}
+/**
+ * Make sure that the types are set in the root, ioConfig, and tuningConfig
+ * @param spec
+ */
+export function normalizeSpecType(spec: IngestionSpec) {
+ const specType = getSpecType(spec);
+ if (!specType) return spec;
+ if (!deepGet(spec, 'type')) spec = deepSet(spec, 'type', specType);
+ if (!deepGet(spec, 'ioConfig.type')) spec = deepSet(spec, 'ioConfig.type', specType);
+ if (!deepGet(spec, 'tuningConfig.type')) spec = deepSet(spec, 'tuningConfig.type', specType);
+ return spec;
+}
+
const PARSE_SPEC_FORM_FIELDS: Field<ParseSpec>[] = [
{
name: 'format',
diff --git a/web-console/src/utils/sampler.ts b/web-console/src/utils/sampler.ts
index cff22b9..c20109a 100644
--- a/web-console/src/utils/sampler.ts
+++ b/web-console/src/utils/sampler.ts
@@ -29,8 +29,7 @@ import {
ParseSpec,
Transform, TransformSpec
} from './ingestion-spec';
-import { deepGet, deepSet, shallowCopy, whitelistKeys } from './object-change';
-import { QueryState } from './query-state';
+import { deepGet, deepSet, whitelistKeys } from './object-change';
const SAMPLER_URL = `/druid/indexer/v1/sampler`;
const BASE_SAMPLER_CONFIG: SamplerConfig = {
diff --git a/web-console/src/views/load-data-view/load-data-view.tsx b/web-console/src/views/load-data-view/load-data-view.tsx
index 299e451..39f6b7f 100644
--- a/web-console/src/views/load-data-view/load-data-view.tsx
+++ b/web-console/src/views/load-data-view/load-data-view.tsx
@@ -86,7 +86,7 @@ import {
issueWithIoConfig,
issueWithParser,
joinFilter,
- MetricSpec,
+ MetricSpec, normalizeSpecType,
Parser,
ParseSpec,
parseSpecHasFlatten,
@@ -284,9 +284,14 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
if (this.props.initTaskId) {
this.updateStage('loading');
this.getTaskJson();
+
} else if (this.props.initSupervisorId) {
this.updateStage('loading');
- this.getSupervisorJson(); } else this.updateStage('connect');
+ this.getSupervisorJson();
+
+ } else {
+ this.updateStage('connect');
+ }
}
@@ -2349,9 +2354,11 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
// ==================================================================
private getSupervisorJson = async (): Promise<void> => {
+ const { initSupervisorId } = this.props;
+
try {
- const resp = await axios.get(`/druid/indexer/v1/supervisor/${this.props.initSupervisorId}`);
- this.updateSpec(resp.data);
+ const resp = await axios.get(`/druid/indexer/v1/supervisor/${initSupervisorId}`);
+ this.updateSpec(normalizeSpecType(resp.data));
this.updateStage('json-spec');
} catch (e) {
AppToaster.show({
@@ -2362,9 +2369,11 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
}
private getTaskJson = async (): Promise<void> => {
+ const { initTaskId } = this.props;
+
try {
- const resp = await axios.get(`/druid/indexer/v1/task/${this.props.initTaskId}`);
- this.updateSpec(resp.data.payload.spec);
+ const resp = await axios.get(`/druid/indexer/v1/task/${initTaskId}`);
+ this.updateSpec(normalizeSpecType(resp.data.payload.spec));
this.updateStage('json-spec');
} catch (e) {
AppToaster.show({
@@ -2388,7 +2397,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
value={spec}
onChange={(s) => {
if (!s) return;
- this.updateSpec(s);
+ this.updateSpec(normalizeSpecType(s));
}}
height="100%"
/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org