Skip to content

Commit

Permalink
Web console: more robust durable storage setting detection (apache#16493
Browse files Browse the repository at this point in the history
)

* more robust durable storage setting

* add test
  • Loading branch information
vogievetsky authored and ektravel committed May 29, 2024
1 parent da7de8e commit aa7f4fe
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/operations/durable-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ Depending on the size of the results you're expecting, saving the final results

By default, Druid saves the final results for queries from deep storage to task reports. Generally, this is acceptable for smaller result sets but may lead to timeouts for larger result sets.

When you run a query, include the context parameter `selectDestination` and set it to `DURABLESTORAGE`:
When you run a query, include the context parameter `selectDestination` and set it to `durableStorage`:

```json
"context":{
...
"selectDestination": "DURABLESTORAGE"
"selectDestination": "durableStorage"
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import * as JSONBig from 'json-bigint-native';
import { v4 as uuidv4 } from 'uuid';

import type { RowColumn } from '../../utils';
import { deleteKeys } from '../../utils';
import { caseInsensitiveEquals, deleteKeys } from '../../utils';
import type { DruidEngine } from '../druid-engine/druid-engine';
import { validDruidEngine } from '../druid-engine/druid-engine';
import type { LastExecution } from '../execution/execution';
Expand Down Expand Up @@ -512,7 +512,11 @@ export class WorkbenchQuery {
}

const ingestQuery = this.isIngestQuery();
if (!unlimited && !ingestQuery && queryContext.selectDestination !== 'durableStorage') {
if (
!unlimited &&
!ingestQuery &&
!caseInsensitiveEquals(queryContext.selectDestination, 'durableStorage')
) {
apiQuery.context ||= {};
apiQuery.context.sqlOuterLimit = 1001;
}
Expand Down
11 changes: 11 additions & 0 deletions web-console/src/utils/general.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import {
arrangeWithPrefixSuffix,
caseInsensitiveEquals,
formatBytes,
formatBytesCompact,
formatInteger,
Expand Down Expand Up @@ -196,4 +197,14 @@ describe('general', () => {
});
});
});

describe('caseInsensitiveEquals', () => {
it('works', () => {
expect(caseInsensitiveEquals(undefined, undefined)).toEqual(true);
expect(caseInsensitiveEquals(undefined, 'x')).toEqual(false);
expect(caseInsensitiveEquals('x', undefined)).toEqual(false);
expect(caseInsensitiveEquals('x', 'X')).toEqual(true);
expect(caseInsensitiveEquals(undefined, '')).toEqual(false);
});
});
});
4 changes: 4 additions & 0 deletions web-console/src/utils/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export function addOrUpdate<T>(xs: readonly T[], x: T, keyFn: (x: T) => string |

// ----------------------------

export function caseInsensitiveEquals(str1: string | undefined, str2: string | undefined): boolean {
return str1?.toLowerCase() === str2?.toLowerCase();
}

export function caseInsensitiveContains(testString: string, searchString: string): boolean {
if (!searchString) return true;
return testString.toLowerCase().includes(searchString.toLowerCase());
Expand Down

0 comments on commit aa7f4fe

Please sign in to comment.