Skip to content

Commit

Permalink
Use int64 instead of float64
Browse files Browse the repository at this point in the history
  • Loading branch information
jakozaur committed Oct 13, 2024
1 parent 6fdebc5 commit 41a0f5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion quesma/kibana/dates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion quesma/queryparser/pancake_aggregation_parser_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41a0f5f

Please sign in to comment.