-
Notifications
You must be signed in to change notification settings - Fork 413
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
Unable to append to delta table without datafusion feature #2204
Comments
I cannot get this to reproduce inside of our integration tests but can easily reproduce it outside of them 🙃 |
@rtyler The example code is still producing the same error as before with: deltalake = { git = "https://github.com/delta-io/delta-rs.git", rev="81593e9" } Has this been fixed on another branch? Due to the recent timestamp changes, the empty array of timestamps in my example should now be created using: let ts: ArrayRef = Arc::new(
TimestampMicrosecondBuilder::new()
.with_timezone("UTC")
.finish(),
); |
507c3a3 added a way to accomplish writing to a delta table without enabling the datafusion feature. The idea is to create a table with the final reader and writer versions. No implicit features are defined in that case. This means the Invariants feature that requires let mut table = CreateBuilder::new()
.with_location("memory:")
.with_columns(schema)
.with_configuration_property(deltalake::DeltaConfigKey::MinReaderVersion, Some("3"))
.with_configuration_property(deltalake::DeltaConfigKey::MinWriterVersion, Some("7"))
.into_future()
.await?; Complete example: use std::{future::IntoFuture, sync::Arc};
use deltalake::{
arrow::array::{ArrayRef, Float64Builder, RecordBatch, TimestampMicrosecondBuilder},
kernel::{DataType, PrimitiveType, StructField},
operations::create::CreateBuilder,
writer::{DeltaWriter, RecordBatchWriter},
DeltaConfigKey, DeltaTableError,
};
#[tokio::main]
async fn main() -> Result<(), DeltaTableError> {
let schema = vec![
StructField::new(
"ts".to_string(),
DataType::Primitive(PrimitiveType::Timestamp),
false,
),
StructField::new(
"value".to_string(),
DataType::Primitive(PrimitiveType::Double),
false,
),
];
let mut table = CreateBuilder::new()
.with_location("memory:")
.with_columns(schema)
.with_configuration_property(DeltaConfigKey::MinReaderVersion, Some("3"))
.with_configuration_property(DeltaConfigKey::MinWriterVersion, Some("7"))
.into_future()
.await?;
let ts: ArrayRef = Arc::new(
TimestampMicrosecondBuilder::new()
.finish()
.with_timezone("UTC"),
);
let value: ArrayRef = Arc::new(Float64Builder::new().finish());
let batch = RecordBatch::try_from_iter(vec![("ts", ts), ("value", value)]).unwrap();
let mut writer = RecordBatchWriter::for_table(&table)?;
writer.write(batch.clone()).await?;
writer.flush_and_commit(&mut table).await?;
Ok(())
} cc @kallydev |
Environment
Delta-rs version:
0.17
Binding:
rust
Environment:
Bug
What happened:
First, create a Delta table in rust and write a
RecordBatch
to it.Then, open the exact same table and try to write again.
This fails with:
What you expected to happen:
Adding new record batches to the table I just created and already wrote to is possible.
How to reproduce it:
Given
Cargo.toml
:Run
src/main.rs
to write an empty record batch twice:More details:
The reproduction case passes with
features = ["datafusion"]
.I would expect that I can perform the basic operation of adding a new record batch to the table without needing to pull in datafusion. This was possible in 0.16.
The text was updated successfully, but these errors were encountered: