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

arroyo-sql: make sure delta lake timestamps are microsecond grain. #411

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion arroyo-sql/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,31 @@ impl ConnectorTable {
fn from_options(
name: &str,
connector: &str,
fields: Vec<FieldSpec>,
mut fields: Vec<FieldSpec>,
options: &mut HashMap<String, String>,
) -> Result<Self> {
// TODO: a more principled way of letting connectors dictate types to use
if "delta" == connector {
fields = fields
.into_iter()
.map(|field_spec| match &field_spec {
FieldSpec::StructField(struct_field) => match struct_field.data_type {
TypeDef::DataType(DataType::Timestamp(_, None), nullable) => {
let mut coerced = struct_field.clone();
coerced.data_type = TypeDef::DataType(
DataType::Timestamp(arrow_schema::TimeUnit::Microsecond, None),
nullable,
);
FieldSpec::StructField(coerced)
}
_ => field_spec,
},
FieldSpec::VirtualField { .. } => {
unreachable!("delta lake is only a sink, can't have virtual fields")
}
})
.collect();
}
let connector = connector_for_type(connector)
.ok_or_else(|| anyhow!("Unknown connector '{}'", connector))?;

Expand Down