mirror of https://github.com/apache/druid.git
grab warnings from correct key + test (#12977)
This commit is contained in:
parent
e476e75462
commit
acb09ff18b
|
@ -123,6 +123,7 @@ export const EXECUTION_INGEST_COMPLETE = Execution.fromTaskPayloadAndReport(
|
|||
|
||||
{
|
||||
multiStageQuery: {
|
||||
type: 'multiStageQuery',
|
||||
taskId: 'query-32ced762-7679-4a25-9220-3915c5976961',
|
||||
payload: {
|
||||
status: { status: 'SUCCESS', startTime: '2022-08-22T20:12:51.391Z', durationMs: 25097 },
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -211,14 +211,14 @@ export class Execution {
|
|||
static fromTaskPayloadAndReport(
|
||||
taskPayload: { payload: any; task: string },
|
||||
taskReport: {
|
||||
multiStageQuery: { payload: any; taskId: string };
|
||||
multiStageQuery: { type: string; payload: any; taskId: string };
|
||||
error?: any;
|
||||
},
|
||||
): Execution {
|
||||
// Must have status set for a valid report
|
||||
const id = deepGet(taskReport, 'multiStageQuery.taskId');
|
||||
const status = deepGet(taskReport, 'multiStageQuery.payload.status.status');
|
||||
const warnings = deepGet(taskReport, 'multiStageQuery.payload.status.warningReports');
|
||||
const warnings = deepGet(taskReport, 'multiStageQuery.payload.status.warnings');
|
||||
|
||||
if (typeof id !== 'string' || !Execution.validTaskStatus(status)) {
|
||||
throw new Error('Invalid payload');
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import { EXECUTION_INGEST_ERROR } from '../../../druid-models/execution/execution-ingest-error.mock';
|
||||
|
||||
import { ExecutionDetailsPane } from './execution-details-pane';
|
||||
|
||||
describe('ExecutionDetailsPane', () => {
|
||||
it('matches snapshot no init tab', () => {
|
||||
const comp = shallow(
|
||||
<ExecutionDetailsPane execution={EXECUTION_INGEST_ERROR} goToIngestion={() => {}} />,
|
||||
);
|
||||
|
||||
expect(comp).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('matches snapshot with init tab', () => {
|
||||
const comp = shallow(
|
||||
<ExecutionDetailsPane
|
||||
execution={EXECUTION_INGEST_ERROR}
|
||||
initTab="warnings"
|
||||
goToIngestion={() => {}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(comp).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -8,23 +8,17 @@ exports[`ExecutionErrorPane matches snapshot 1`] = `
|
|||
<p
|
||||
className="error-message-text"
|
||||
>
|
||||
UnknownError:
|
||||
java.lang.RuntimeException: java.lang.RuntimeException: Error occured while trying to read uri: https://static.imply.io/example-data/kttm-v2/kttm-v2-2019-08-25.json.gz_
|
||||
|
||||
<a
|
||||
onClick={[Function]}
|
||||
>
|
||||
(Stack trace)
|
||||
</a>
|
||||
TooManyWarnings:
|
||||
Too many warnings of type CannotParseExternalData generated (max = 10)
|
||||
</p>
|
||||
<div>
|
||||
Failed task ID:
|
||||
<Memo(ClickToCopy)
|
||||
text="query-0cf1a40a-aaef-4d17-bda4-5afa7edf07e7-worker0"
|
||||
text="query-c6bffa9d-43c4-45a0-95f8-0c8c453655fb"
|
||||
/>
|
||||
(on host:
|
||||
<Memo(ClickToCopy)
|
||||
text="localhost:8101"
|
||||
text="localhost"
|
||||
/>
|
||||
)
|
||||
</div>
|
||||
|
|
|
@ -353,7 +353,7 @@ export const HelperQuery = React.memo(function HelperQuery(props: HelperQueryPro
|
|||
) : execution.isSuccessfulInsert() ? (
|
||||
<IngestSuccessPane
|
||||
execution={execution}
|
||||
onDetails={() => onDetails(statsTaskId!)}
|
||||
onDetails={onDetails}
|
||||
onQueryTab={onQueryTab}
|
||||
/>
|
||||
) : execution.error ? (
|
||||
|
|
|
@ -21,12 +21,13 @@ import React from 'react';
|
|||
|
||||
import { Execution, WorkbenchQuery } from '../../../druid-models';
|
||||
import { formatDuration, pluralIfNeeded } from '../../../utils';
|
||||
import { ExecutionDetailsTab } from '../execution-details-pane/execution-details-pane';
|
||||
|
||||
import './ingest-success-pane.scss';
|
||||
|
||||
export interface IngestSuccessPaneProps {
|
||||
execution: Execution;
|
||||
onDetails(): void;
|
||||
onDetails(id: string, initTab?: ExecutionDetailsTab): void;
|
||||
onQueryTab?(newQuery: WorkbenchQuery, tabName?: string): void;
|
||||
}
|
||||
|
||||
|
@ -54,12 +55,20 @@ export const IngestSuccessPane = React.memo(function IngestSuccessPane(
|
|||
return (
|
||||
<div className="ingest-success-pane">
|
||||
<p>
|
||||
{`${rows < 0 ? 'Data' : pluralIfNeeded(rows, 'row')} inserted into '${datasource}'.` +
|
||||
(warnings > 0 ? ` ${pluralIfNeeded(warnings, 'warning')} generated.` : '')}
|
||||
{`${rows < 0 ? 'Data' : pluralIfNeeded(rows, 'row')} inserted into '${datasource}'.`}
|
||||
{warnings > 0 && (
|
||||
<>
|
||||
{' '}
|
||||
<span className="action" onClick={() => onDetails(execution.id, 'warnings')}>
|
||||
{pluralIfNeeded(warnings, 'warning')}
|
||||
</span>{' '}
|
||||
recorded.
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{duration ? `Insert query took ${formatDuration(duration)}. ` : `Insert query completed. `}
|
||||
<span className="action" onClick={onDetails}>
|
||||
<span className="action" onClick={() => onDetails(execution.id)}>
|
||||
Show details
|
||||
</span>
|
||||
</p>
|
||||
|
|
|
@ -403,7 +403,7 @@ export const QueryTab = React.memo(function QueryTab(props: QueryTabProps) {
|
|||
) : execution.isSuccessfulInsert() ? (
|
||||
<IngestSuccessPane
|
||||
execution={execution}
|
||||
onDetails={() => onDetails(statsTaskId!)}
|
||||
onDetails={onDetails}
|
||||
onQueryTab={onQueryTab}
|
||||
/>
|
||||
) : execution.error ? (
|
||||
|
|
Loading…
Reference in New Issue