fix: added code rabit suggestions

This commit is contained in:
Sai Nikhil 2024-10-29 13:39:55 +05:30 committed by Bhargav
parent c357e9c784
commit faa1d94dcd
1 changed files with 8 additions and 7 deletions

View File

@ -880,11 +880,12 @@ export default defineComponent({
return data.filter((item: any) => {
if (item.expr) {
if (
(item.expr.type === "column_ref" &&
item.expr?.column?.expr?.value === fieldName || item.expr.column === fieldName) ||
(item.expr.type === "aggr_func" &&
item.expr?.args?.expr?.column?.value === fieldName)
) {
(item.expr.type === "column_ref" &&
(item.expr?.column?.expr?.value === fieldName || item.expr.column === fieldName)
) ||
(item.expr.type === "aggr_func" &&
item.expr?.args?.expr?.column?.value === fieldName)
) {
return false;
}
}
@ -939,12 +940,12 @@ export default defineComponent({
type: "expr",
});
}
const streamName = searchObj.data.stream.selectedStream[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const newQuery = parser
.sqlify(parsedSQL)
.replace(/`/g, "")
.replace(
new RegExp(`\\b${searchObj.data.stream.selectedStream[0]}\\b`, 'g'), // Wrap only standalone 'default'
new RegExp(`\\b${streamName}\\b`, 'g'), // Wrap only standalone stream name
`"${searchObj.data.stream.selectedStream[0]}"`
);
searchObj.data.query = newQuery;