This is an automated email from the ASF dual-hosted git repository.
vogievetsky pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 3f2ba2fc22e Add ARRAY query parameter support in workbench view
(#18586)
3f2ba2fc22e is described below
commit 3f2ba2fc22ecf37bf5c33ec59c67db175ccf0bd4
Author: Antoine Boyer <[email protected]>
AuthorDate: Wed Oct 29 16:53:16 2025 -0700
Add ARRAY query parameter support in workbench view (#18586)
* Add ARRAY query parameter supprot in workbench view
* Update druid-query-toolkit to 1.2.1
* Update licenses
* Update axios license
* prettify
* update test snapshot
---
licenses.yaml | 12 +-
licenses/bin/dayjs.MIT | 21 +
web-console/package-lock.json | 15 +-
web-console/package.json | 2 +-
.../query-parameters-dialog.spec.tsx.snap | 516 +++++++++++++++++++++
.../query-parameters-dialog.spec.tsx | 17 +
.../query-parameters-dialog.tsx | 34 +-
7 files changed, 606 insertions(+), 11 deletions(-)
diff --git a/licenses.yaml b/licenses.yaml
index ceef1f36c25..b873d729b23 100644
--- a/licenses.yaml
+++ b/licenses.yaml
@@ -5784,6 +5784,16 @@ license_file_path: licenses/bin/date-fns.MIT
---
+name: "dayjs"
+license_category: binary
+module: web-console
+license_name: MIT License
+copyright: iamkun
+version: 1.11.15
+license_file_path: licenses/bin/dayjs.MIT
+
+---
+
name: "delayed-stream"
license_category: binary
module: web-console
@@ -5838,7 +5848,7 @@ license_category: binary
module: web-console
license_name: Apache License version 2.0
copyright: Imply Data
-version: 1.2.0
+version: 1.2.1
---
diff --git a/licenses/bin/dayjs.MIT b/licenses/bin/dayjs.MIT
new file mode 100644
index 00000000000..caf9315493c
--- /dev/null
+++ b/licenses/bin/dayjs.MIT
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018-present, iamkun
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/web-console/package-lock.json b/web-console/package-lock.json
index 16f1050c677..07c2b194740 100644
--- a/web-console/package-lock.json
+++ b/web-console/package-lock.json
@@ -31,7 +31,7 @@
"d3-time-format": "^4.1.0",
"date-fns": "^2.28.0",
"dayjs": "^1.11.15",
- "druid-query-toolkit": "^1.2.0",
+ "druid-query-toolkit": "^1.2.1",
"echarts": "^5.5.1",
"file-saver": "^2.0.5",
"hjson": "^3.2.2",
@@ -7290,9 +7290,9 @@
}
},
"node_modules/druid-query-toolkit": {
- "version": "1.2.0",
- "resolved":
"https://registry.npmjs.org/druid-query-toolkit/-/druid-query-toolkit-1.2.0.tgz",
- "integrity":
"sha512-MMcr1012UZSbOG+O3bI1BxxGQOHM1sVwPWYGgbQlfnBCQovjcLDAxkzWUGY/nn1c3B+Yrblcp3oMRl/S0HpiDQ==",
+ "version": "1.2.1",
+ "resolved":
"https://registry.npmjs.org/druid-query-toolkit/-/druid-query-toolkit-1.2.1.tgz",
+ "integrity":
"sha512-vg+r0J0cbK934QhqNaHs/Zs0nXYZSv//ZnLor71OCsP73ya60SBaN3nW3DuR+TxUGMIgZpSIgGQbG03eP7vfwA==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.5.2"
@@ -8871,6 +8871,7 @@
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity":
"sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
@@ -23710,9 +23711,9 @@
}
},
"druid-query-toolkit": {
- "version": "1.2.0",
- "resolved":
"https://registry.npmjs.org/druid-query-toolkit/-/druid-query-toolkit-1.2.0.tgz",
- "integrity":
"sha512-MMcr1012UZSbOG+O3bI1BxxGQOHM1sVwPWYGgbQlfnBCQovjcLDAxkzWUGY/nn1c3B+Yrblcp3oMRl/S0HpiDQ==",
+ "version": "1.2.1",
+ "resolved":
"https://registry.npmjs.org/druid-query-toolkit/-/druid-query-toolkit-1.2.1.tgz",
+ "integrity":
"sha512-vg+r0J0cbK934QhqNaHs/Zs0nXYZSv//ZnLor71OCsP73ya60SBaN3nW3DuR+TxUGMIgZpSIgGQbG03eP7vfwA==",
"requires": {
"tslib": "^2.5.2"
}
diff --git a/web-console/package.json b/web-console/package.json
index b97764e1840..d8261ee0829 100644
--- a/web-console/package.json
+++ b/web-console/package.json
@@ -73,7 +73,7 @@
"d3-time-format": "^4.1.0",
"date-fns": "^2.28.0",
"dayjs": "^1.11.15",
- "druid-query-toolkit": "^1.2.0",
+ "druid-query-toolkit": "^1.2.1",
"echarts": "^5.5.1",
"file-saver": "^2.0.5",
"hjson": "^3.2.2",
diff --git
a/web-console/src/views/workbench-view/query-parameters-dialog/__snapshots__/query-parameters-dialog.spec.tsx.snap
b/web-console/src/views/workbench-view/query-parameters-dialog/__snapshots__/query-parameters-dialog.spec.tsx.snap
index 576751c66f1..84a8ef44991 100644
---
a/web-console/src/views/workbench-view/query-parameters-dialog/__snapshots__/query-parameters-dialog.spec.tsx.snap
+++
b/web-console/src/views/workbench-view/query-parameters-dialog/__snapshots__/query-parameters-dialog.spec.tsx.snap
@@ -1,5 +1,373 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`QueryParametersDialog handles ARRAY type parameters correctly 1`] = `
+<Blueprint5.Dialog
+ canOutsideClickClose={true}
+ className="query-parameters-dialog"
+ isOpen={true}
+ onClose={[Function]}
+ title="Dynamic query parameters"
+>
+ <div
+ className="bp5-dialog-body"
+ >
+ <p>
+ Druid SQL supports dynamic parameters using question mark
+ <ForwardRef>
+ ?
+ </ForwardRef>
+ syntax, where parameters are bound positionally to ? placeholders at
execution time.
+ </p>
+ <Blueprint5.FormGroup
+ label="Parameter in position 1"
+ >
+ <Blueprint5.ControlGroup
+ fill={true}
+ >
+ <Blueprint5.Popover
+ boundary="clippingParents"
+ captureDismiss={false}
+ content={
+ <Blueprint5.Menu>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="VARCHAR"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="TIMESTAMP"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="BIGINT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="DOUBLE"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="FLOAT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="tick"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
+ </Blueprint5.Menu>
+ }
+ defaultIsOpen={false}
+ disabled={false}
+ fill={false}
+ hasBackdrop={false}
+ hoverCloseDelay={300}
+ hoverOpenDelay={150}
+ inheritDarkTheme={true}
+ interactionKind="click"
+ matchTargetWidth={false}
+ minimal={true}
+ openOnTargetFocus={true}
+ position="bottom-left"
+ positioningStrategy="absolute"
+ shouldReturnFocusOnClose={false}
+ targetTagName="span"
+ transitionDuration={300}
+ usePortal={true}
+ >
+ <Blueprint5.Button
+ rightIcon="caret-down"
+ text="ARRAY"
+ />
+ </Blueprint5.Popover>
+ <Blueprint5.InputGroup
+ fill={true}
+ onChange={[Function]}
+ placeholder="[-25.7, null, 36.85]"
+ value="[1,2,3]"
+ />
+ <Blueprint5.Button
+ icon="trash"
+ onClick={[Function]}
+ />
+ </Blueprint5.ControlGroup>
+ </Blueprint5.FormGroup>
+ <Blueprint5.FormGroup
+ label="Parameter in position 2"
+ >
+ <Blueprint5.ControlGroup
+ fill={true}
+ >
+ <Blueprint5.Popover
+ boundary="clippingParents"
+ captureDismiss={false}
+ content={
+ <Blueprint5.Menu>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="VARCHAR"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="TIMESTAMP"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="BIGINT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="DOUBLE"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="FLOAT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="tick"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
+ </Blueprint5.Menu>
+ }
+ defaultIsOpen={false}
+ disabled={false}
+ fill={false}
+ hasBackdrop={false}
+ hoverCloseDelay={300}
+ hoverOpenDelay={150}
+ inheritDarkTheme={true}
+ interactionKind="click"
+ matchTargetWidth={false}
+ minimal={true}
+ openOnTargetFocus={true}
+ position="bottom-left"
+ positioningStrategy="absolute"
+ shouldReturnFocusOnClose={false}
+ targetTagName="span"
+ transitionDuration={300}
+ usePortal={true}
+ >
+ <Blueprint5.Button
+ rightIcon="caret-down"
+ text="ARRAY"
+ />
+ </Blueprint5.Popover>
+ <Blueprint5.InputGroup
+ fill={true}
+ onChange={[Function]}
+ placeholder="[-25.7, null, 36.85]"
+ value="["a","b",null]"
+ />
+ <Blueprint5.Button
+ icon="trash"
+ onClick={[Function]}
+ />
+ </Blueprint5.ControlGroup>
+ </Blueprint5.FormGroup>
+ <Blueprint5.FormGroup
+ label="Parameter in position 3"
+ >
+ <Blueprint5.ControlGroup
+ fill={true}
+ >
+ <Blueprint5.Popover
+ boundary="clippingParents"
+ captureDismiss={false}
+ content={
+ <Blueprint5.Menu>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="VARCHAR"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="TIMESTAMP"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="BIGINT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="DOUBLE"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="FLOAT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="tick"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
+ </Blueprint5.Menu>
+ }
+ defaultIsOpen={false}
+ disabled={false}
+ fill={false}
+ hasBackdrop={false}
+ hoverCloseDelay={300}
+ hoverOpenDelay={150}
+ inheritDarkTheme={true}
+ interactionKind="click"
+ matchTargetWidth={false}
+ minimal={true}
+ openOnTargetFocus={true}
+ position="bottom-left"
+ positioningStrategy="absolute"
+ shouldReturnFocusOnClose={false}
+ targetTagName="span"
+ transitionDuration={300}
+ usePortal={true}
+ >
+ <Blueprint5.Button
+ rightIcon="caret-down"
+ text="ARRAY"
+ />
+ </Blueprint5.Popover>
+ <Blueprint5.InputGroup
+ fill={true}
+ onChange={[Function]}
+ placeholder="[-25.7, null, 36.85]"
+ value="[]"
+ />
+ <Blueprint5.Button
+ icon="trash"
+ onClick={[Function]}
+ />
+ </Blueprint5.ControlGroup>
+ </Blueprint5.FormGroup>
+ <Blueprint5.Button
+ icon="plus"
+ onClick={[Function]}
+ text="Add parameter"
+ />
+ </div>
+ <div
+ className="bp5-dialog-footer"
+ >
+ <div
+ className="bp5-dialog-footer-actions"
+ >
+ <Blueprint5.Button
+ onClick={[Function]}
+ text="Close"
+ />
+ <Blueprint5.Button
+ intent="primary"
+ onClick={[Function]}
+ text="Save"
+ />
+ </div>
+ </div>
+</Blueprint5.Dialog>
+`;
+
exports[`QueryParametersDialog matches snapshot 1`] = `
<Blueprint5.Dialog
canOutsideClickClose={true}
@@ -79,6 +447,16 @@ exports[`QueryParametersDialog matches snapshot 1`] = `
shouldDismissPopover={true}
text="FLOAT"
/>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
</Blueprint5.Menu>
}
defaultIsOpen={false}
@@ -177,6 +555,16 @@ exports[`QueryParametersDialog matches snapshot 1`] = `
shouldDismissPopover={true}
text="FLOAT"
/>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
</Blueprint5.Menu>
}
defaultIsOpen={false}
@@ -275,6 +663,16 @@ exports[`QueryParametersDialog matches snapshot 1`] = `
shouldDismissPopover={true}
text="FLOAT"
/>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
</Blueprint5.Menu>
}
defaultIsOpen={false}
@@ -373,6 +771,16 @@ exports[`QueryParametersDialog matches snapshot 1`] = `
shouldDismissPopover={true}
text="FLOAT"
/>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
</Blueprint5.Menu>
}
defaultIsOpen={false}
@@ -410,6 +818,114 @@ exports[`QueryParametersDialog matches snapshot 1`] = `
/>
</Blueprint5.ControlGroup>
</Blueprint5.FormGroup>
+ <Blueprint5.FormGroup
+ label="Parameter in position 5"
+ >
+ <Blueprint5.ControlGroup
+ fill={true}
+ >
+ <Blueprint5.Popover
+ boundary="clippingParents"
+ captureDismiss={false}
+ content={
+ <Blueprint5.Menu>
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="VARCHAR"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="TIMESTAMP"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="BIGINT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="DOUBLE"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="blank"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="FLOAT"
+ />
+ <Blueprint5.MenuItem
+ active={false}
+ disabled={false}
+ icon="tick"
+ multiline={false}
+ onClick={[Function]}
+ popoverProps={{}}
+ shouldDismissPopover={true}
+ text="ARRAY"
+ />
+ </Blueprint5.Menu>
+ }
+ defaultIsOpen={false}
+ disabled={false}
+ fill={false}
+ hasBackdrop={false}
+ hoverCloseDelay={300}
+ hoverOpenDelay={150}
+ inheritDarkTheme={true}
+ interactionKind="click"
+ matchTargetWidth={false}
+ minimal={true}
+ openOnTargetFocus={true}
+ position="bottom-left"
+ positioningStrategy="absolute"
+ shouldReturnFocusOnClose={false}
+ targetTagName="span"
+ transitionDuration={300}
+ usePortal={true}
+ >
+ <Blueprint5.Button
+ rightIcon="caret-down"
+ text="ARRAY"
+ />
+ </Blueprint5.Popover>
+ <Blueprint5.InputGroup
+ fill={true}
+ onChange={[Function]}
+ placeholder="[-25.7, null, 36.85]"
+ value="[-25.7,null,36.85]"
+ />
+ <Blueprint5.Button
+ icon="trash"
+ onClick={[Function]}
+ />
+ </Blueprint5.ControlGroup>
+ </Blueprint5.FormGroup>
<Blueprint5.Button
icon="plus"
onClick={[Function]}
diff --git
a/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.spec.tsx
b/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.spec.tsx
index dfd749307ad..ca563fa635c 100644
---
a/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.spec.tsx
+++
b/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.spec.tsx
@@ -29,6 +29,23 @@ describe('QueryParametersDialog', () => {
{ type: 'TIMESTAMP', value: '2022-02-02 01:02:03' },
{ type: 'BIGINT', value: 42 },
{ type: 'DOUBLE', value: 1.618 },
+ { type: 'ARRAY', value: [-25.7, null, 36.85] },
+ ]}
+ onQueryParametersChange={() => {}}
+ onClose={() => {}}
+ />,
+ );
+
+ expect(comp).toMatchSnapshot();
+ });
+
+ it('handles ARRAY type parameters correctly', () => {
+ const comp = shallow(
+ <QueryParametersDialog
+ queryParameters={[
+ { type: 'ARRAY', value: [1, 2, 3] },
+ { type: 'ARRAY', value: ['a', 'b', null] },
+ { type: 'ARRAY', value: [] },
]}
onQueryParametersChange={() => {}}
onClose={() => {}}
diff --git
a/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.tsx
b/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.tsx
index 49a9ebb587d..fc61cbe8f09 100644
---
a/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.tsx
+++
b/web-console/src/views/workbench-view/query-parameters-dialog/query-parameters-dialog.tsx
@@ -40,7 +40,26 @@ import { deepSet, oneOf, tickIcon, without } from
'../../../utils';
import './query-parameters-dialog.scss';
-const TYPES = ['VARCHAR', 'TIMESTAMP', 'BIGINT', 'DOUBLE', 'FLOAT'];
+const TYPES = ['VARCHAR', 'TIMESTAMP', 'BIGINT', 'DOUBLE', 'FLOAT', 'ARRAY'];
+
+function parseArrayValue(input: string): any[] | string {
+ try {
+ const parsed = JSON.parse(input);
+ if (Array.isArray(parsed)) {
+ return parsed;
+ }
+ return input;
+ } catch {
+ return input;
+ }
+}
+
+function formatArrayValue(value: any): string {
+ if (Array.isArray(value)) {
+ return JSON.stringify(value);
+ }
+ return value;
+}
interface QueryParametersDialogProps {
queryParameters: QueryParameter[] | undefined;
@@ -77,7 +96,11 @@ export const QueryParametersDialog = React.memo(function
QueryParametersDialog(
const { type, value } = queryParameter;
function onValueChange(v: string | number) {
- setCurrentQueryParameters(deepSet(currentQueryParameters,
`${i}.value`, v));
+ let finalValue: any = v;
+ if (type === 'ARRAY' && typeof v === 'string') {
+ finalValue = parseArrayValue(v);
+ }
+ setCurrentQueryParameters(deepSet(currentQueryParameters,
`${i}.value`, finalValue));
}
return (
@@ -112,6 +135,13 @@ export const QueryParametersDialog = React.memo(function
QueryParametersDialog(
fill
arbitraryPrecision={type !== 'BIGINT'}
/>
+ ) : type === 'ARRAY' ? (
+ <InputGroup
+ value={Array.isArray(value) ? formatArrayValue(value) :
String(value)}
+ onChange={(e: any) => onValueChange(e.target.value)}
+ placeholder="[-25.7, null, 36.85]"
+ fill
+ />
) : (
<InputGroup
value={String(value)}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]