Skip to content

Commit

Permalink
update arrow (#2729)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Feb 22, 2022
1 parent 0e1d524 commit 7c99c24
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 38 deletions.
2 changes: 1 addition & 1 deletion polars/polars-arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Arrow interfaces for Polars DataFrame library"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrow = { package = "arrow2", git = "https://github.com/jorgecarleitao/arrow2", rev = "3bb4144ad6ba10ff74219a88b1a79a34ced21631", default-features = false }
arrow = { package = "arrow2", git = "https://github.com/jorgecarleitao/arrow2", rev = "22bf173ec297fbc2ce156bd482cb410b7769073d", default-features = false }
# arrow = { package = "arrow2", git = "https://github.com/ritchie46/arrow2", branch = "no_null_propagate_comp", default-features = false }
# arrow = { package = "arrow2", version = "0.9", default-features = false, features = ["compute_concatenate"] }
hashbrown = "0.12"
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ unsafe_unwrap = "^0.1.0"
package = "arrow2"
git = "https://github.com/jorgecarleitao/arrow2"
# git = "https://github.com/ritchie46/arrow2"
rev = "3bb4144ad6ba10ff74219a88b1a79a34ced21631"
rev = "22bf173ec297fbc2ce156bd482cb410b7769073d"
# branch = "no_null_propagate_comp"
# version = "0.9"
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private = []
[dependencies]
ahash = "0.7"
anyhow = "1.0"
arrow = { package = "arrow2", git = "https://github.com/jorgecarleitao/arrow2", rev = "3bb4144ad6ba10ff74219a88b1a79a34ced21631", default-features = false }
arrow = { package = "arrow2", git = "https://github.com/jorgecarleitao/arrow2", rev = "22bf173ec297fbc2ce156bd482cb410b7769073d", default-features = false }
# arrow = { package = "arrow2", git = "https://github.com/ritchie46/arrow2", branch = "no_null_propagate_comp", default-features = false }
# arrow = { package = "arrow2", version = "0.9", default-features = false }
csv-core = { version = "0.1.10", optional = true }
Expand Down
20 changes: 10 additions & 10 deletions py-polars/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion py-polars/src/arrow_interop/to_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn array_to_rust(obj: &PyAny) -> PyResult<ArrayRef> {
Some(validity.into()),
))
} else {
ffi::import_array_from_c(array, &field).map_err(PyPolarsEr::from)?
ffi::import_array_from_c(array, field.data_type).map_err(PyPolarsEr::from)?
};
Ok(array.into())
}
Expand Down
32 changes: 8 additions & 24 deletions py-polars/tests/io/test_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,24 @@ def compressions() -> List[str]:

def test_from_to_buffer(df: pl.DataFrame, compressions: List[str]) -> None:
for compression in compressions:
if compression == "uncompressed":
buf = io.BytesIO()
df.to_ipc(buf, compression=compression) # type: ignore
buf.seek(0)
read_df = pl.read_ipc(buf)
assert df.frame_equal(read_df)
else:
# Error with ipc compression
# Windows: OSError
# Linux: ValueError
with pytest.raises(Exception):
buf = io.BytesIO()
df.to_ipc(buf, compression=compression) # type: ignore
buf.seek(0)
_ = pl.read_ipc(buf)
buf = io.BytesIO()
df.to_ipc(buf, compression=compression) # type: ignore
buf.seek(0)
read_df = pl.read_ipc(buf)
assert df.frame_equal(read_df)


def test_from_to_file(
io_test_dir: str, df: pl.DataFrame, compressions: List[str]
) -> None:
f = os.path.join(io_test_dir, "small.ipc")

for compression in compressions:
if compression == "uncompressed":
# does not yet work on windows because we hold an mmap?
if os.name != "nt":
for compression in compressions:
df.to_ipc(f, compression=compression) # type: ignore
df_read = pl.read_ipc(str(f))
assert df.frame_equal(df_read)
else:
# Error with ipc compression
# Windows: OSError
# Linux: ValueError
with pytest.raises(Exception):
df.to_ipc(f, compression=compression) # type: ignore
_ = pl.read_ipc(str(f))


def test_select_columns() -> None:
Expand Down

0 comments on commit 7c99c24

Please sign in to comment.