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

Potential misuse of timestamp (without time zone) #13448

Open
xiangjinwu opened this issue Nov 16, 2023 · 1 comment
Open

Potential misuse of timestamp (without time zone) #13448

xiangjinwu opened this issue Nov 16, 2023 · 1 comment

Comments

@xiangjinwu
Copy link
Contributor

xiangjinwu commented Nov 16, 2023

timestamptz represents an absolute point in time, while timestamp represents a watch reading including a date and time depending on local law with unpredictable changes.

let try_get_date_time = |epoch: u64| {
if epoch == 0 {
return None;
}
let time_millis = Epoch::from(epoch).as_unix_millis();
Timestamp::with_secs_nsecs(
(time_millis / 1000) as i64,
(time_millis % 1000 * 1_000_000) as u32,
)
.map(ScalarImpl::Timestamp)
.ok()
};

&Field {
name: "last_edit_time".to_string(),
data_type: DataType::Timestamp,
sub_fields: vec![],
type_name: "".to_string(),
},

let rows = page
.into_iter()
.map(|split| {
(
Op::Insert,
OwnedRow::new(vec![
Some(ScalarImpl::Utf8(split.name.into_boxed_str())),
Some(ScalarImpl::Timestamp(split.timestamp)),
Some(ScalarImpl::Int64(split.size)),
]),
)
})
.collect::<Vec<_>>();
StreamChunk::from_rows(
&rows,
&[DataType::Varchar, DataType::Timestamp, DataType::Int64],
)

@xiangjinwu
Copy link
Contributor Author

xiangjinwu commented Nov 30, 2023

About usage in s3 source: #13414 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant