Skip to content

Commit

Permalink
fix window start backtick issue (opensearch-project#1823) (opensearch…
Browse files Browse the repository at this point in the history
…-project#1824)

(cherry picked from commit c7ee338cd882f0787e1537bc3924901682df085f)
(cherry picked from commit 0632d4a)

Signed-off-by: Shenoy Pratik <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 5618343 commit bf0d141
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,34 +115,39 @@ export const ColumnExpression = ({
/>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFormRow label="Aggregation field">
<EuiComboBox
singleSelection={{ asPlainText: true }}
options={[
{
label: '*',
disabled: currentColumnExpressionValue.functionName !== 'count',
},
...accelerationFormData.dataTableFields.map((x) => ({
label: x.fieldName,
})),
]}
selectedOptions={[
{
label: currentColumnExpressionValue.functionParam,
},
]}
onChange={(fieldOption) =>
updateColumnExpressionValue(
{ ...currentColumnExpressionValue, functionParam: fieldOption[0].label },
index
)
}
isClearable={false}
/>
</EuiFormRow>
</EuiFlexItem>
{currentColumnExpressionValue.functionName !== 'window.start' && (
<EuiFlexItem grow={false}>
<EuiFormRow label="Aggregation field">
<EuiComboBox
singleSelection={{ asPlainText: true }}
options={[
{
label: '*',
disabled: currentColumnExpressionValue.functionName !== 'count',
},
...accelerationFormData.dataTableFields.map((x) => ({
label: x.fieldName,
})),
]}
selectedOptions={[
{
label: currentColumnExpressionValue.functionParam,
},
]}
onChange={(fieldOption) =>
updateColumnExpressionValue(
{
...currentColumnExpressionValue,
functionParam: fieldOption[0].label,
},
index
)
}
isClearable={false}
/>
</EuiFormRow>
</EuiFlexItem>
)}
</EuiFlexGroup>
</>
</EuiPopover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/accelerations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit bf0d141

Please sign in to comment.