GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.28k stars 307 forks source link

The data type of the timestamp saved by InfluxDB line protocol API should be TimestampNanosecond #3738

Closed nicecui closed 6 months ago

nicecui commented 6 months ago

What type of bug is this?

Incorrect result

What subsystems are affected?

Frontend

Minimal reproduce step

In order to preserve the time information of the timestamp, we should use nano seconds as the default precision. But greptime use milliseconds now. For example, I save timestamp data with ns precision:

curl 'http://localhost:4000/v1/influxdb/api/v2/write?db=public&precision=ns' \
    -d 'census,location=klamath,scientist=anderson bees=23 1566086400000000000
census,location=portland,scientist=mullen ants=30 1566086400000000000
census,location=klamath,scientist=anderson bees=28 1566086760000000000
census,location=portland,scientist=mullen ants=32 1566086760000000000'

What did you expect to see?

The data type of the ts column in thecensus table schema should be TimestampNanosecond.

DESC census;
+-----------+----------------------+------+------+---------+---------------+
| Column    | Type                 | Key  | Null | Default | Semantic Type |
+-----------+----------------------+------+------+---------+---------------+
...
| ts        | TimestampNanosecond | PRI  | NO   |         | TIMESTAMP     |
...
+-----------+----------------------+------+------+---------+---------------+

What did you see instead?

TimestampMillisecond is used as the ts type.

+-----------+----------------------+------+------+---------+---------------+
| Column    | Type                 | Key  | Null | Default | Semantic Type |
+-----------+----------------------+------+------+---------+---------------+
...
| ts        | TimestampMillisecond | PRI  | NO   |         | TIMESTAMP     |
...
+-----------+----------------------+------+------+---------+---------------+

What operating system did you use?

Mac

What version of GreptimeDB did you use?

0.7.2

Relevant log output and stack trace

No response

tisonkun commented 6 months ago

@fengjiachun is this issue resolved by your previous PR? If so, please link the PR here and we can close this issue.

fengjiachun commented 6 months ago

@fengjiachun is this issue resolved by your previous PR? If so, please link the PR here and we can close this issue.

Yes, this issue has been resolved in #3794. I will now close it.