-
Notifications
You must be signed in to change notification settings - Fork 116
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
feat: Duration
Field
& FieldType
support
#1374
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
# Conflicts: # dozer-orchestrator/src/pipeline/sinks.rs
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Can you summarize:
And I remember we determined to use pub struct DozerDuration(pub std::time::Duration, pub TimeUnit); |
2 tasks
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
fn convert_duration_to_object(d: &DozerDuration) -> Value {
let mut m = Map::new();
m.insert("value".to_string(), Value::from(d.0.as_nanos().to_string())); // as_nanos() will give out u128 value which has to be represented in string as there is no support for 128 primitive value yet
m.insert("time_unit".to_string(), Value::from(d.1.to_string()));
Value::Object(m)
}
fn map_duration_to_prost_coord_map(d: DozerDuration) -> Value {
Value {
value: Some(value::Value::DurationValue(DurationType {
value: d.0.as_nanos().to_string(),
time_unit: d.1.to_string(),
})),
}
}
FieldType::Duration => DataType::Duration(TimeUnit::Nanosecond),
FieldType::Duration => {
let mut builder = arrow::array::DurationNanosecondArray::builder(count);
for field in fields {
match field {
Field::Duration(value) => builder.append_value(value.0.as_nanos().as_i64()),
Field::Null => builder.append_null(),
_ => panic!("Unexpected field type"),
}
}
Arc::new(builder.finish())
}
GrpcTypes::value::Value::DurationValue(d) => {
let duration_type_desc = descriptor.duration_field.message.clone();
let value_field_desc = &descriptor.duration_field.value;
let time_unit_field_desc = &descriptor.duration_field.time_unit;
let mut duration = DynamicMessage::new(duration_type_desc);
duration.set_field(value_field_desc, prost_reflect::Value::String(d.value));
duration.set_field(
time_unit_field_desc,
prost_reflect::Value::String(d.time_unit),
);
Value::Message(duration)
} |
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
mediuminvader
approved these changes
Apr 6, 2023
Signed-off-by: Chloe Kim <chloeminkyung@gmail.com>
v3g42
approved these changes
Apr 6, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Duration
on separate PR (e.g.INTERVAL '1 MINUTE'
,DURATION '1 MINUTE'
,"6/04/2023 10:00" + 30 MINUTES
)Field
implementationFieldType
implementation