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

Polars error when reading test parquet file #13

Open
SteampunkIslande opened this issue Mar 29, 2024 · 1 comment
Open

Polars error when reading test parquet file #13

SteampunkIslande opened this issue Mar 29, 2024 · 1 comment

Comments

@SteampunkIslande
Copy link
Collaborator

Trying to read using polars the test parquet file from this repository, I get this error:

import pyvcf2parquet as pv
pv.convert_vcf("tests/data/test.vcf","test.parquet")
import polars as pl
pl.scan_parquet("test.parquet").head().collect()
---------------------------------------------------------------------------
ComputeError                              Traceback (most recent call last)
Cell In[4], line 1
----> 1 pl.scan_parquet("test.parquet").head().collect()

File /media/charles/SANDISK/TousLesVCF_PPI/touslesppi/venv/lib/python3.10/site-packages/polars/lazyframe/frame.py:1943, in LazyFrame.collect(self, type_coercion, predicate_pushdown, projection_pushdown, simplify_expression, slice_pushdown, comm_subplan_elim, comm_subexpr_elim, no_optimization, streaming, background, _eager)
   1940 if background:
   1941     return InProcessQuery(ldf.collect_concurrently())
-> 1943 return wrap_df(ldf.collect())

ComputeError: Deserializing type Utf8 from parquet

But within the same IPython session, I was able to read that same test.parquet:

import duckdb as db
In [8]: db.sql("""SELECT * FROM test.parquet""").pl()
Out[8]: 
shape: (4, 29)
┌────────────┬──────────┬────────────┬───────────┬───┬────────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┐
│ chromosomepositionidentifierreference ┆ … ┆ format_second_Format_Aformat_second_Format_Rformat_second_Format_Gformat_second_Format_u │
│ ------------       ┆   ┆ ------------                    │
│ stri32list[str]  ┆ str       ┆   ┆ strlist[str]              ┆ list[i32]              ┆ list[i32]              │
╞════════════╪══════════╪════════════╪═══════════╪═══╪════════════════════════╪════════════════════════╪════════════════════════╪════════════════════════╡
│ chr1100      ┆ []         ┆ A         ┆ … ┆ testA                  ┆ ["r", "a"]             ┆ [1, 2, 3]              ┆ [0, 2, … 1]            │
│ chr1200      ┆ []         ┆ C         ┆ … ┆ testB1                 ┆ ["R", "a"]             ┆ [1, 2, 3]              ┆ [0, 2, … 6]            │
│ chr1200      ┆ []         ┆ C         ┆ … ┆ testB2                 ┆ ["R", "b"]             ┆ [1, 4, 6]              ┆ [0, 2, … 6]            │
│ chr2300      ┆ []         ┆ G         ┆ … ┆ testA                  ┆ ["R", "A"]             ┆ [1, 2, 3]              ┆ [0, 2, … 6]            │
└────────────┴──────────┴────────────┴───────────┴───┴────────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┘
@SteampunkIslande
Copy link
Collaborator Author

Also, found out that the column causing this problem was a FixedSizeList of Utf8.
Weirdly enough, by looking at what I understood from polars source code, this case should be handled properly.
Maybe going from arrow2 to arrow-rs would solve the problem?

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

No branches or pull requests

1 participant