codename-hub / php-parquet

PHP implementation for reading and writing Apache Parquet files/streams
Other
58 stars 8 forks source link

Issue when trying to get empty string value from parquet file #8

Closed kleve-r closed 2 years ago

kleve-r commented 2 years ago

Hi there, thank you for your library. It works fine, but I had a problem when trying to retrieve data from a file where there were empty values. The problem itself occurs in the CustomBinaryReader file in the readString function. If you add a check for length and default values, everything will work fine

  /**
   * @inheritDoc
   */
  public function readString($length)
  {
    $this->position += $length; // ?
    return $length ? fread($this->stream, $length) : '';
  }
Katalystical commented 2 years ago

@kleve-r This seems plausible. Can you please provide a parquet file reproducing the case/error, if you can share it publicly?

EDIT: I just remembered I already fixed empty string handling in an upcoming changeset, this might also fix your issue. In the meantime you may try feature/datapage-v2 and provide feedback whether this fixes it for you.

kleve-r commented 2 years ago

Hello! Thanks for the reply, unfortunately I can't share the file (I worked with private data). i tried feature / datapage-v2 and it helped me! Thank you very much for the prompt response