common/clickhousedb: disable experimental analyzer, only when using FILL

This commit is contained in:
Vincent Bernat
2024-04-19 19:51:44 +02:00
parent 12967c8ab6
commit 889f82eb85
3 changed files with 8 additions and 3 deletions

View File

@@ -55,9 +55,6 @@ func New(r *reporter.Reporter, config Configuration, dependencies Dependencies)
MaxOpenConns: config.MaxOpenConns,
MaxIdleConns: config.MaxOpenConns/2 + 1,
ConnMaxLifetime: time.Hour,
Settings: clickhouse.Settings{
"allow_experimental_analyzer": 0,
},
ClientInfo: clickhouse.ClientInfo{
Products: []struct {
Name string

View File

@@ -10,6 +10,7 @@ import (
"strings"
"time"
"github.com/ClickHouse/clickhouse-go/v2"
"github.com/gin-gonic/gin"
"golang.org/x/exp/slices"
@@ -249,6 +250,9 @@ func (c *Component) graphLineHandlerFunc(gc *gin.Context) {
Xps float64 `ch:"xps"`
Dimensions []string `ch:"dimensions"`
}{}
ctx = clickhouse.Context(ctx, clickhouse.WithSettings(clickhouse.Settings{
"allow_experimental_analyzer": 0,
}))
if err := c.d.ClickHouseDB.Conn.Select(ctx, &results, sqlQuery); err != nil {
c.r.Err(err).Str("query", sqlQuery).Msg("unable to query database")
gc.JSON(http.StatusInternalServerError, gin.H{"message": "Unable to query database."})

View File

@@ -10,6 +10,7 @@ import (
"strings"
"time"
"github.com/ClickHouse/clickhouse-go/v2"
"github.com/gin-gonic/gin"
"akvorado/common/schema"
@@ -242,6 +243,9 @@ ORDER BY Time WITH FILL
Time time.Time `json:"t"`
Gbps float64 `json:"gbps"`
}{}
ctx = clickhouse.Context(ctx, clickhouse.WithSettings(clickhouse.Settings{
"allow_experimental_analyzer": 0,
}))
err := c.d.ClickHouseDB.Conn.Select(ctx, &results, strings.TrimSpace(query))
if err != nil {
c.r.Err(err).Msg("unable to query database")