Skip to content

Commit

Permalink
fix window start backtick issue (opensearch-project#1823)
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit c7ee338cd882f0787e1537bc3924901682df085f)
  • Loading branch information
ps48 authored May 6, 2024
1 parent 55841f2 commit 0632d4a
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 0632d4a

Please sign in to comment.