Skip to content

Commit

Permalink
fix ci (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Dec 21, 2023
1 parent 071c5f9 commit 9652788
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/ch/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ defimpl DBConnection.Query, for: Ch.Query do
unix = DateTime.to_unix(dt, size)
seconds = div(unix, size)
fractional = rem(unix, size)
IO.iodata_to_binary([Integer.to_string(seconds), ?., String.pad_leading(Integer.to_string(fractional), precision)])

IO.iodata_to_binary([
Integer.to_string(seconds),
?.,
String.pad_leading(Integer.to_string(fractional), precision)
])

_ ->
dt |> DateTime.to_unix(:second) |> Integer.to_string()
Expand Down
2 changes: 1 addition & 1 deletion test/ch/connection_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ defmodule Ch.ConnectionTest do
# this test case guards against a previous bug where DateTimes with a microsecond value of 0 and precision > 0 would
# get encoded as a val like "1.6095024e9" which ClickHouse would be unable to parse to a DateTime.
utc = ~U[2021-01-01 12:00:00.000000Z]
naive = DateTime.to_naive(utc)
naive = utc |> DateTime.shift_zone!(Ch.Test.clickhouse_tz(conn)) |> DateTime.to_naive()

assert Ch.query!(conn, "select {$0:DateTime64(6)} as d, toString(d)", [utc]).rows ==
[[~N[2021-01-01 12:00:00.000000], to_string(naive)]]
Expand Down

0 comments on commit 9652788

Please sign in to comment.