From 41a0f5f233ff6ca4e56941dedc7a69258c32613e Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Sun, 13 Oct 2024 20:49:07 +0200 Subject: [PATCH] Use int64 instead of float64 --- quesma/kibana/dates.go | 2 +- quesma/queryparser/pancake_aggregation_parser_buckets.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quesma/kibana/dates.go b/quesma/kibana/dates.go index 2bfe1df94..787622799 100644 --- a/quesma/kibana/dates.go +++ b/quesma/kibana/dates.go @@ -69,7 +69,7 @@ func (dm DateManager) ParseMissingInDateHistogram(missing any) (unixTimestamp in // (https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html) func (dm DateManager) ParseRange(Range any) (timestampExpr model.Expr, parsingSucceeded bool) { if timestamp, success := dm.parseStrictDateOptionalTimeOrEpochMillis(Range); success { - return model.NewFunction("toDateTime64", model.NewLiteral(float64(timestamp)/1000), model.NewLiteral(3)), true + return model.NewFunction("fromUnixTimestamp64Milli", model.NewLiteral(timestamp)), true } return nil, false } diff --git a/quesma/queryparser/pancake_aggregation_parser_buckets.go b/quesma/queryparser/pancake_aggregation_parser_buckets.go index 0cecf5a7a..9830b499c 100644 --- a/quesma/queryparser/pancake_aggregation_parser_buckets.go +++ b/quesma/queryparser/pancake_aggregation_parser_buckets.go @@ -84,7 +84,7 @@ func (cw *ClickhouseQueryTranslator) pancakeTryBucketAggregation(aggregation *pa dateManager := kibana.NewDateManager() if unixTimestamp, parsingOk := dateManager.ParseMissingInDateHistogram(missing); parsingOk { field = model.NewFunction("COALESCE", field, - model.NewFunction("toDateTime64", model.NewLiteral(float64(unixTimestamp)/1000)), model.NewLiteral(3)) + model.NewFunction("fromUnixTimestamp64Milli", model.NewLiteral(unixTimestamp))) weAddedMissing = true } else { logger.ErrorWithCtx(cw.Ctx).Msgf("unknown format of missing in date_histogram: %v. Skipping it.", missing)