Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Parse string without specify time zone to local time stamp #692

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

MichaelLeeHZ
Copy link
Contributor

@MichaelLeeHZ MichaelLeeHZ commented Mar 2, 2023

Which issue does this PR close?

Closes #

Rationale for this change

I found the following query response nothing :

curl -H POST 'http://127.0.0.1:5440/sql' -H 'Content-Type: application/json' -d '{
    "query": "INSERT INTO demo(`t`, name,value, dat,`time`) VALUES(1667374200022, '\''ceresdb05'\'', 1.0, '\''9999-10-13'\'','\''-23:59:59.999'\'')"
}'

curl -H POST 'http://127.0.0.1:5000/sql' -H 'Content-Type: application/json' -d '{
    "query": "select * from demo where t > '\''2023-03-02 15:40:00'\''"
}'

Actually it should response:

{"rows":[{"tsid":7907694565448534541,"t":1677743400000,"name":"ceresdb01","value":1.0}]}

And I found the reason is , according to apache/arrow-rs#2814, function string_to_timestamp_nanos returns a UTC timestamp instead of local timestamp;

What changes are included in this PR?

  1. When no time zone is specified, parse it to local time stamp
  2. Otherwise, use string_to_timestamp_nanos to parse it to utc time stamp

Are there any user-facing changes?

How does this change test

By unit test

@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2023

Codecov Report

Merging #692 (53f768e) into main (1491f71) will increase coverage by 0.00%.
The diff coverage is 75.25%.

❗ Current head 53f768e differs from pull request most recent head 47c31b4. Consider uploading reports for the commit 47c31b4 to get more accurate results

@@           Coverage Diff           @@
##             main     #692   +/-   ##
=======================================
  Coverage   67.55%   67.55%           
=======================================
  Files         281      281           
  Lines       44301    44343   +42     
=======================================
+ Hits        29926    29955   +29     
- Misses      14375    14388   +13     
Impacted Files Coverage Δ
cluster/src/config.rs 75.00% <ø> (ø)
server/src/grpc/storage_service/mod.rs 0.00% <ø> (-45.12%) ⬇️
server/src/grpc/storage_service/write.rs 38.99% <0.00%> (-0.43%) ⬇️
sql/src/frontend.rs 0.00% <0.00%> (ø)
sql/src/planner.rs 92.38% <80.00%> (-2.25%) ⬇️
components/object_store/src/mem_cache.rs 71.04% <82.75%> (+2.60%) ⬆️
...ry_engine/src/logical_optimizer/type_conversion.rs 89.16% <83.92%> (-1.09%) ⬇️
common_util/src/partitioned_lock.rs 100.00% <100.00%> (ø)
components/skiplist/src/list.rs 98.87% <0.00%> (-0.23%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@MichaelLeeHZ MichaelLeeHZ marked this pull request as ready for review March 3, 2023 03:08
Copy link
Contributor

@jiacai2050 jiacai2050 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jiacai2050 jiacai2050 added this pull request to the merge queue Mar 6, 2023
Merged via the queue into apache:main with commit f79890b Mar 6, 2023
chunshao90 pushed a commit to chunshao90/ceresdb that referenced this pull request May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants