mirror of https://github.com/apache/druid.git
clean up spec before reopening in data loader (#9536)
This commit is contained in:
parent
d8833316c4
commit
cdf4a26904
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { downgradeSpec, upgradeSpec } from './ingestion-spec';
|
import { cleanSpec, downgradeSpec, upgradeSpec } from './ingestion-spec';
|
||||||
|
|
||||||
describe('ingestion-spec', () => {
|
describe('ingestion-spec', () => {
|
||||||
const oldSpec = {
|
const oldSpec = {
|
||||||
|
@ -98,4 +98,26 @@ describe('ingestion-spec', () => {
|
||||||
it('round trips', () => {
|
it('round trips', () => {
|
||||||
expect(downgradeSpec(upgradeSpec(oldSpec))).toMatchObject(oldSpec);
|
expect(downgradeSpec(upgradeSpec(oldSpec))).toMatchObject(oldSpec);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('cleanSpec', () => {
|
||||||
|
expect(
|
||||||
|
cleanSpec({
|
||||||
|
type: 'index_parallel',
|
||||||
|
id: 'index_parallel_coronavirus_hamlcmea_2020-03-19T00:56:12.175Z',
|
||||||
|
groupId: 'index_parallel_coronavirus_hamlcmea_2020-03-19T00:56:12.175Z',
|
||||||
|
resource: {
|
||||||
|
availabilityGroup: 'index_parallel_coronavirus_hamlcmea_2020-03-19T00:56:12.175Z',
|
||||||
|
requiredCapacity: 1,
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
dataSchema: {},
|
||||||
|
},
|
||||||
|
} as any),
|
||||||
|
).toEqual({
|
||||||
|
type: 'index_parallel',
|
||||||
|
spec: {
|
||||||
|
dataSchema: {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -294,6 +294,17 @@ export function normalizeSpec(spec: Partial<IngestionSpec>): IngestionSpec {
|
||||||
return spec as IngestionSpec;
|
return spec as IngestionSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure that any extra junk in the spec other than 'type' and 'spec' is removed
|
||||||
|
* @param spec
|
||||||
|
*/
|
||||||
|
export function cleanSpec(spec: IngestionSpec): IngestionSpec {
|
||||||
|
return {
|
||||||
|
type: spec.type,
|
||||||
|
spec: spec.spec,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const INPUT_FORMAT_FORM_FIELDS: Field<InputFormat>[] = [
|
const INPUT_FORMAT_FORM_FIELDS: Field<InputFormat>[] = [
|
||||||
{
|
{
|
||||||
name: 'type',
|
name: 'type',
|
||||||
|
|
|
@ -71,6 +71,7 @@ import { updateSchemaWithSample } from '../../utils/druid-type';
|
||||||
import {
|
import {
|
||||||
adjustIngestionSpec,
|
adjustIngestionSpec,
|
||||||
adjustTuningConfig,
|
adjustTuningConfig,
|
||||||
|
cleanSpec,
|
||||||
DimensionMode,
|
DimensionMode,
|
||||||
DimensionSpec,
|
DimensionSpec,
|
||||||
DimensionsSpec,
|
DimensionsSpec,
|
||||||
|
@ -2951,7 +2952,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await axios.get(`/druid/indexer/v1/supervisor/${initSupervisorId}`);
|
const resp = await axios.get(`/druid/indexer/v1/supervisor/${initSupervisorId}`);
|
||||||
this.updateSpec(resp.data);
|
this.updateSpec(cleanSpec(resp.data));
|
||||||
this.setState({ continueToSpec: true });
|
this.setState({ continueToSpec: true });
|
||||||
this.updateStep('spec');
|
this.updateStep('spec');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -2967,7 +2968,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await axios.get(`/druid/indexer/v1/task/${initTaskId}`);
|
const resp = await axios.get(`/druid/indexer/v1/task/${initTaskId}`);
|
||||||
this.updateSpec(resp.data.payload);
|
this.updateSpec(cleanSpec(resp.data.payload));
|
||||||
this.setState({ continueToSpec: true });
|
this.setState({ continueToSpec: true });
|
||||||
this.updateStep('spec');
|
this.updateStep('spec');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue