This is an automated email from the ASF dual-hosted git repository.
cwylie 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 d12f557492f fix ingest datasource detection falling over on paren
(#15339)
d12f557492f is described below
commit d12f557492f48e4c42668d68f7ceccc07577ed21
Author: Vadim Ogievetsky <[email protected]>
AuthorDate: Wed Nov 8 13:32:27 2023 -0800
fix ingest datasource detection falling over on paren (#15339)
---
.../src/druid-models/workbench-query/workbench-query.spec.ts | 12 ++++++++++++
.../src/druid-models/workbench-query/workbench-query.ts | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git
a/web-console/src/druid-models/workbench-query/workbench-query.spec.ts
b/web-console/src/druid-models/workbench-query/workbench-query.spec.ts
index 78ac3e8f1e7..36c108d7e5f 100644
--- a/web-console/src/druid-models/workbench-query/workbench-query.spec.ts
+++ b/web-console/src/druid-models/workbench-query/workbench-query.spec.ts
@@ -487,6 +487,18 @@ describe('WorkbenchQuery', () => {
expect(workbenchQuery.changeEngine('sql-native').getIngestDatasource()).toBeUndefined();
});
+ it('works with INSERT (unparsable with paren)', () => {
+ const sql = sane`
+ -- Some comment
+ INSERT into trips2
+ (SELECT TIME_PARSE(pickup_datetime) AS __time,
+ `;
+
+ const workbenchQuery = WorkbenchQuery.blank().changeQueryString(sql);
+ expect(workbenchQuery.getIngestDatasource()).toEqual('trips2');
+
expect(workbenchQuery.changeEngine('sql-native').getIngestDatasource()).toBeUndefined();
+ });
+
it('works with REPLACE', () => {
const sql = sane`
REPLACE INTO trips2 OVERWRITE ALL
diff --git a/web-console/src/druid-models/workbench-query/workbench-query.ts
b/web-console/src/druid-models/workbench-query/workbench-query.ts
index 621e5028f4b..0c7775e515f 100644
--- a/web-console/src/druid-models/workbench-query/workbench-query.ts
+++ b/web-console/src/druid-models/workbench-query/workbench-query.ts
@@ -226,7 +226,7 @@ export class WorkbenchQuery {
const queryStartingWithInsertOrReplace =
queryFragment.substring(matchInsertReplaceIndex);
- const matchEnd =
queryStartingWithInsertOrReplace.match(/\b(?:SELECT|WITH)\b|$/i);
+ const matchEnd =
queryStartingWithInsertOrReplace.match(/\(|\b(?:SELECT|WITH)\b|$/i);
const fragmentQuery = SqlQuery.maybeParse(
queryStartingWithInsertOrReplace.substring(0, matchEnd?.index) + '
SELECT * FROM t',
);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]