mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 16:07:10 +00:00
feat: resolved conflicts
This commit is contained in:
parent
74824e7853
commit
98f4e840cd
@ -624,6 +624,11 @@ func (b *traceOperatorCTEBuilder) buildTimeSeriesQuery(selectFromCTE string) (*q
|
|||||||
|
|
||||||
combinedArgs := append(allGroupByArgs, allAggChArgs...)
|
combinedArgs := append(allGroupByArgs, allAggChArgs...)
|
||||||
|
|
||||||
|
// Add HAVING clause if specified
|
||||||
|
if err := b.addHavingClause(sb); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
sql, args := sb.BuildWithFlavor(sqlbuilder.ClickHouse, combinedArgs...)
|
sql, args := sb.BuildWithFlavor(sqlbuilder.ClickHouse, combinedArgs...)
|
||||||
return &qbtypes.Statement{
|
return &qbtypes.Statement{
|
||||||
Query: sql,
|
Query: sql,
|
||||||
@ -717,6 +722,11 @@ func (b *traceOperatorCTEBuilder) buildTraceQuery(selectFromCTE string) (*qbtype
|
|||||||
sb.GroupBy(groupByKeys...)
|
sb.GroupBy(groupByKeys...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add HAVING clause if specified
|
||||||
|
if err := b.addHavingClause(sb); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
orderApplied := false
|
orderApplied := false
|
||||||
for _, orderBy := range b.operator.Order {
|
for _, orderBy := range b.operator.Order {
|
||||||
switch orderBy.Key.Name {
|
switch orderBy.Key.Name {
|
||||||
@ -839,6 +849,11 @@ func (b *traceOperatorCTEBuilder) buildScalarQuery(selectFromCTE string) (*qbtyp
|
|||||||
|
|
||||||
combinedArgs := append(allGroupByArgs, allAggChArgs...)
|
combinedArgs := append(allGroupByArgs, allAggChArgs...)
|
||||||
|
|
||||||
|
// Add HAVING clause if specified
|
||||||
|
if err := b.addHavingClause(sb); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
sql, args := sb.BuildWithFlavor(sqlbuilder.ClickHouse, combinedArgs...)
|
sql, args := sb.BuildWithFlavor(sqlbuilder.ClickHouse, combinedArgs...)
|
||||||
return &qbtypes.Statement{
|
return &qbtypes.Statement{
|
||||||
Query: sql,
|
Query: sql,
|
||||||
@ -846,6 +861,16 @@ func (b *traceOperatorCTEBuilder) buildScalarQuery(selectFromCTE string) (*qbtyp
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *traceOperatorCTEBuilder) addHavingClause(sb *sqlbuilder.SelectBuilder) error {
|
||||||
|
if b.operator.Having != nil && b.operator.Having.Expression != "" {
|
||||||
|
havingExpr := b.operator.Having.Expression
|
||||||
|
if strings.TrimSpace(havingExpr) != "" {
|
||||||
|
sb.Having(havingExpr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (b *traceOperatorCTEBuilder) addCTE(name, sql string, args []any, dependsOn []string) {
|
func (b *traceOperatorCTEBuilder) addCTE(name, sql string, args []any, dependsOn []string) {
|
||||||
b.ctes = append(b.ctes, cteNode{
|
b.ctes = append(b.ctes, cteNode{
|
||||||
name: name,
|
name: name,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user