Skip to content

function read_parquet(*,as_data_frame=TRUE) fails when embedded nuls present.  #26314

@asfimport

Description

@asfimport

For the following code snippet

// code placeholder
library(arrow)

download.file('https://github.com/akashshah59/embedded_nul_parquet/raw/main/CC-MAIN-20200702045758-20200702075758-00007.parquet','sample.parquet')

read_parquet(file = 'sample.parquet',as_data_frame = TRUE)

I get -

 

Error in Table__to_dataframe(x, use_threads = option_use_threads()) : embedded nul in string: '\0 at \0'

 

So, I thought, what if I could read the file as binaries and replace the embedded nul character \0 myself.

 

parquet <- read_parquet(file = 'sample.parquet',as_data_frame = FALSEraw <- write_to_raw(parquet,format = "file")
print(raw)

 

In this case, I get an indecipherable stream of characters and nuls, which makes it very difficult to remove '00' characters that are problematic in the stream.

 

[1] 41 52 52 4f 57 31 00 00 ff ff ff ff d0 02 00 00 10 00 00 00 00 00 0a 00 0c 00 06 00 
[29] 05 00 08 00 0a 00 00 00 00 01 04 00 0c 00 00 00 08 00 08 00 00 00 04 00 08 00 00 00 
[57] 04 00 00 00 0d 00 00 00 70 02 00 00 38 02 00 00 10 02 00 00 d0 01 00 00 a4 01 00 00 
[85] 74 01 00 00 34 01 00 00 04 01 00 00 cc 00 00 00 9c 00 00 00 64 00 00 00 34 00 00 00 
[113] 04 00 00 00 d4 fd ff ff 00 00 01 05 14 00 00 00 0c 00 00 00 04 00 00 00 00 00 00 00 
[141] c4 fd ff ff 0a 00 00 00 77 61 72 63 5f 6c 61 6e 67 73 00 00 00 fe ff ff 00 00 01 05 
[169] 14 00 00 00 0c 00 00 00 04 00 00 00 00 00 00 00 f0 fd ff ff 0b 00 00 00 6c 61 6e 67 
[197] 5f 64 65 74 65 63 74 00 2c fe ff ff 00 00 01 03 18 00 00 00 0c 00 00 00 04 00

 
Is there a way to handle this while reading Apache parquet?

Reporter: Akash Shah
Assignee: Neal Richardson / @nealrichardson

Related issues:

Note: This issue was originally created as ARROW-10324. Please see the migration documentation for further details.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions