From 904c15cd760508553d5b8986fa23ff7ae11caf52 Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Mon, 6 May 2024 12:50:46 -0700 Subject: [PATCH] fix window start backtick issue (#1823) Signed-off-by: Shenoy Pratik (cherry picked from commit c7ee338cd882f0787e1537bc3924901682df085f) (cherry picked from commit 0632d4ace27ee1fd090a0145f2efd1e0f309c24d) --- .../materialized_view/column_expression.tsx | 61 ++++++++++--------- .../visual_editors/query_builder.tsx | 2 +- test/accelerations.ts | 2 +- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/materialized_view/column_expression.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/materialized_view/column_expression.tsx index 3da5f84db8..3550dfeda5 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/materialized_view/column_expression.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/materialized_view/column_expression.tsx @@ -115,34 +115,39 @@ export const ColumnExpression = ({ /> - - - ({ - label: x.fieldName, - })), - ]} - selectedOptions={[ - { - label: currentColumnExpressionValue.functionParam, - }, - ]} - onChange={(fieldOption) => - updateColumnExpressionValue( - { ...currentColumnExpressionValue, functionParam: fieldOption[0].label }, - index - ) - } - isClearable={false} - /> - - + {currentColumnExpressionValue.functionName !== 'window.start' && ( + + + ({ + label: x.fieldName, + })), + ]} + selectedOptions={[ + { + label: currentColumnExpressionValue.functionParam, + }, + ]} + onChange={(fieldOption) => + updateColumnExpressionValue( + { + ...currentColumnExpressionValue, + functionParam: fieldOption[0].label, + }, + index + ) + } + isClearable={false} + /> + + + )} diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/query_builder.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/query_builder.tsx index b206267950..68acf21317 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/query_builder.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/visual_editors/query_builder.tsx @@ -148,7 +148,7 @@ const buildMaterializedViewColumns = (columnsValues: MaterializedViewColumn[]) = ` ${ column.functionName !== 'window.start' ? `${column.functionName}(${buildMaterializedViewColumnName(column.functionParam!)})` - : `\`${column.functionName}\`` + : `${column.functionName}` }${column.fieldAlias ? ` AS \`${column.fieldAlias}\`` : ``}` ) .join(', \n'); diff --git a/test/accelerations.ts b/test/accelerations.ts index 3eb1439688..4521a7c7f1 100644 --- a/test/accelerations.ts +++ b/test/accelerations.ts @@ -411,7 +411,7 @@ AS SELECT count(*) AS \`counter1\`, sum(\`field2\`), avg(\`field3\`) AS \`average\`, - \`window.start\` AS \`start\` + window.start AS \`start\` FROM datasource.database.table GROUP BY TUMBLE (\`timestamp\`, '1 minute') WITH (