Skip to content

Bug: getDatasets() / datasets() and getArrType() segfault on valid Parquet files #8

Description

@ShreyasKhandekar

Description

Calling getDatasets(), the datasets() iterator, or getArrType() on a valid Parquet file causes a segmentation fault. The crash appears to originate from c_getDatasetNames and corrupts memory, which can also cause secondary segfaults during program teardown.

Steps to Reproduce

  1. Create a valid Parquet file using writeColumn:
use Parquet;

var Arr: [1..100] int = 42;
writeColumn(filename="data.parquet", colName="values", Arr=Arr);
  1. Attempt to iterate over dataset names in that file:
for name in datasets("data.parquet") do
  writeln(name);
  1. The program segfaults.

Alternatively, calling getArrType("data.parquet", "values") also segfaults.

Expected Behavior

datasets() should yield the column names in the file (e.g., "values"). getArrType() should return the corresponding ArrowTypes enum value.

Actual Behavior

Segmentation fault. The memory corruption from these calls can also cause crashes in unrelated code that runs afterward.

Environment

  • Chapel 2.8.0+
  • Apache Arrow / Parquet C++ 19.0.1
  • macOS (ARM64) — also likely reproducible on Linux

Notes

  • getNumCols() and getAllTypes() work correctly on the same files.
  • readColumn() and writeColumn() work correctly.
  • The issue appears to be in the C interop layer — specifically how the result buffer from c_getDatasetNames is handled (the string.createAdoptingBuffer call on a C-allocated c_ptr(uint(8))).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions