You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by cw...@apache.org on 2019/09/06 10:15:45 UTC

[incubator-druid] branch 0.16.0-incubating updated: Web console: fix datasource name auto detection (#8479) (#8480)

This is an automated email from the ASF dual-hosted git repository.

cwylie pushed a commit to branch 0.16.0-incubating
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/0.16.0-incubating by this push:
     new 2557bd0  Web console: fix datasource name auto detection (#8479) (#8480)
2557bd0 is described below

commit 2557bd086319b936517528bcb35805cdefccb450
Author: Clint Wylie <cw...@apache.org>
AuthorDate: Fri Sep 6 03:15:32 2019 -0700

    Web console: fix datasource name auto detection (#8479) (#8480)
    
    * fix datasource name guessing
    
    * fix comment
---
 web-console/src/utils/ingestion-spec.tsx | 11 +++++------
 web-console/src/utils/sampler.ts         |  8 ++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/web-console/src/utils/ingestion-spec.tsx b/web-console/src/utils/ingestion-spec.tsx
index 27f88b0..aa04bf3 100644
--- a/web-console/src/utils/ingestion-spec.tsx
+++ b/web-console/src/utils/ingestion-spec.tsx
@@ -1456,16 +1456,15 @@ function basenameFromFilename(filename: string): string | undefined {
 }
 
 export function fillDataSourceNameIfNeeded(spec: IngestionSpec): IngestionSpec {
-  // Do not overwrite if the spec already has a name
-  if (deepGet(spec, 'dataSchema.dataSource')) return spec;
-  const ioConfig = deepGet(spec, 'ioConfig');
-  if (!ioConfig) return spec;
-  const possibleName = guessDataSourceName(ioConfig);
+  const possibleName = guessDataSourceName(spec);
   if (!possibleName) return spec;
   return deepSet(spec, 'dataSchema.dataSource', possibleName);
 }
 
-export function guessDataSourceName(ioConfig: IoConfig): string | undefined {
+export function guessDataSourceName(spec: IngestionSpec): string | undefined {
+  const ioConfig = deepGet(spec, 'ioConfig');
+  if (!ioConfig) return;
+
   switch (ioConfig.type) {
     case 'index':
     case 'index_parallel':
diff --git a/web-console/src/utils/sampler.ts b/web-console/src/utils/sampler.ts
index 7f7e9f1..0798655 100644
--- a/web-console/src/utils/sampler.ts
+++ b/web-console/src/utils/sampler.ts
@@ -36,7 +36,7 @@ import {
 } from './ingestion-spec';
 import { deepGet, deepSet, whitelistKeys } from './object-change';
 
-const MS_IN_HALF_HOUR = 30 * 60 * 1000;
+const MS_IN_HOUR = 60 * 60 * 1000;
 
 const SAMPLER_URL = `/druid/indexer/v1/sampler`;
 const BASE_SAMPLER_CONFIG: SamplerConfig = {
@@ -199,8 +199,8 @@ export async function scopeDownIngestSegmentFirehoseIntervalIfNeeded(
   const end = new Date(intervalParts[1]);
   if (isNaN(end.valueOf())) throw new Error(`could not decode interval end`);
 
-  // Less than or equal to 1/2 hour so there is no need to adjust intervals
-  if (Math.abs(end.valueOf() - start.valueOf()) <= MS_IN_HALF_HOUR) return ioConfig;
+  // Less than or equal to 1 hour so there is no need to adjust intervals
+  if (Math.abs(end.valueOf() - start.valueOf()) <= MS_IN_HOUR) return ioConfig;
 
   const dataSourceMetadataResponse = await queryDruidRune({
     queryType: 'dataSourceMetadata',
@@ -218,7 +218,7 @@ export async function scopeDownIngestSegmentFirehoseIntervalIfNeeded(
   if (maxIngestedEventTime < start) return ioConfig;
 
   const newEnd = maxIngestedEventTime < end ? maxIngestedEventTime : end;
-  const newStart = new Date(newEnd.valueOf() - MS_IN_HALF_HOUR); // Set start to 1/2hr ago
+  const newStart = new Date(newEnd.valueOf() - MS_IN_HOUR); // Set start to 1 hour ago
 
   return deepSet(
     ioConfig,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org