suneet-s commented on a change in pull request #10496:
URL: https://github.com/apache/druid/pull/10496#discussion_r502162405
##########
File path: web-console/src/utils/druid-query.ts
##########
@@ -92,12 +97,55 @@ export class DruidError extends Error {
return;
}
+ static getSuggestion(errorMessage: string): QuerySuggestion | undefined {
+ // == is used instead of =
+ if (errorMessage.includes('Encountered "= =" at')) {
+ return {
+ label: `Replace == with =`,
+ fn: str => {
+ if (!str.includes('==')) return;
+ return str.replace(/==/g, '=');
+ },
+ };
+ }
+
+ // Incorrect quoting on table
+ const mq = errorMessage.match(/Column '([^']+)' not found in any table/);
+ if (mq) {
+ const literalString = mq[1];
+ return {
+ label: `Replace "${literalString}" with '${literalString}'`,
+ fn: str => {
+ if (!str.includes(`"${literalString}"`)) return;
+ return str.replace(`"${literalString}"`, `'${literalString}'`);
+ },
+ };
+ }
+
+ // , before FROM
+ const mc = errorMessage.match(/Encountered "(FROM)" at/i);
Review comment:
what does `mq` and `mc` stand for?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]