Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Add override for data which doesn't contain a time field #147504

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions x-pack/plugins/data_visualizer/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const MAX_FILE_SIZE_BYTES = 104857600; // 100MB
export const ABSOLUTE_MAX_FILE_SIZE_BYTES = 1073741274; // 1GB
export const FILE_SIZE_DISPLAY_FORMAT = '0,0.[0] b';

export const NO_TIME_FORMAT = 'null';

// Value to use in the Elasticsearch index mapping meta data to identify the
// index as having been created by the File Data Visualizer.
export const INDEX_META_DATA_CREATED_BY = 'file-data-visualizer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { isEqual } from 'lodash';
import type { AnalysisResult, InputOverrides } from '@kbn/file-upload-plugin/common';
import { MB, FILE_FORMATS } from '../../../../../common/constants';
import { MB, FILE_FORMATS, NO_TIME_FORMAT } from '../../../../../common/constants';

export const DEFAULT_LINES_TO_SAMPLE = 1000;
const UPLOAD_SIZE_MB = 5;
Expand Down Expand Up @@ -117,10 +117,15 @@ export function createUrlOverrides(overrides: InputOverrides, originalSettings:
}

export function processResults({ results, overrides }: AnalysisResult) {
const timestampFormat =
results.java_timestamp_formats !== undefined && results.java_timestamp_formats.length
? results.java_timestamp_formats[0]
: undefined;
let timestampFormat;
if (
(overrides && overrides.timestamp_format === NO_TIME_FORMAT) ||
results.java_timestamp_formats === undefined
) {
timestampFormat = NO_TIME_FORMAT;
} else if (results.java_timestamp_formats.length) {
timestampFormat = results.java_timestamp_formats[0];
}

const linesToSample =
overrides !== undefined && overrides.lines_to_sample !== undefined
Expand Down
Loading