Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window start backtick during MV creation #1823

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would there be other similar functions like window.start?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this is the only unique aggregation with this special char on UI

<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
Loading