Fix broken sampler for re-indexing (#10196)

* Fix broken sampler for re-indexer

When re-indexing a Druid datasource, the web-console would generate an
invalid inputFormat since the type is not specified.

* code review
This commit is contained in:
Suneet Saldanha 2020-08-11 19:22:26 -07:00 committed by GitHub
parent c72f96a4ba
commit 6baea0b4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,7 +108,9 @@ export function applyCache(sampleSpec: SampleSpec, cacheRows: CacheRows) {
if (!cacheRows) return sampleSpec;
// In order to prevent potential data loss null columns should be kept by the sampler and shown in the ingestion flow
sampleSpec = deepSet(sampleSpec, 'spec.ioConfig.inputFormat.keepNullColumns', true);
if (deepGet(sampleSpec, 'spec.ioConfig.inputFormat')) {
sampleSpec = deepSet(sampleSpec, 'spec.ioConfig.inputFormat.keepNullColumns', true);
}
// If this is already an inline spec there is nothing to do
if (deepGet(sampleSpec, 'spec.ioConfig.inputSource.type') === 'inline') return sampleSpec;
@ -202,7 +204,9 @@ function makeSamplerIoConfig(
ioConfig = deepSet(ioConfig, 'useEarliestSequenceNumber', sampleStrategy === 'start');
}
// In order to prevent potential data loss null columns should be kept by the sampler and shown in the ingestion flow
ioConfig = deepSet(ioConfig, 'inputFormat.keepNullColumns', true);
if (ioConfig.inputFormat) {
ioConfig = deepSet(ioConfig, 'inputFormat.keepNullColumns', true);
}
return ioConfig;
}