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
- Create a valid Parquet file using
writeColumn:
use Parquet;
var Arr: [1..100] int = 42;
writeColumn(filename="data.parquet", colName="values", Arr=Arr);
- Attempt to iterate over dataset names in that file:
for name in datasets("data.parquet") do
writeln(name);
- 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))).
Description
Calling
getDatasets(), thedatasets()iterator, orgetArrType()on a valid Parquet file causes a segmentation fault. The crash appears to originate fromc_getDatasetNamesand corrupts memory, which can also cause secondary segfaults during program teardown.Steps to Reproduce
writeColumn: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 correspondingArrowTypesenum value.Actual Behavior
Segmentation fault. The memory corruption from these calls can also cause crashes in unrelated code that runs afterward.
Environment
Notes
getNumCols()andgetAllTypes()work correctly on the same files.readColumn()andwriteColumn()work correctly.c_getDatasetNamesis handled (thestring.createAdoptingBuffercall on a C-allocatedc_ptr(uint(8))).