OpenMetadata
OpenMetadata copied to clipboard
Parquet list columns reach auto classification as numpy arrays and are never classified
Affected module
Ingestion Framework
Describe the bug
For parquet files, pyarrow's to_pandas() returns each cell of a list column as a numpy array, and a list inside a struct as an array inside the struct's dict. DatalakeSampler._fetch_rows and StorageSampler.fetch_sample_data pass these cells on unchanged. The SQLAlchemy sampler already converts numpy arrays to lists (_process_array_value); the pandas-based samplers don't.
This has two effects:
- Auto classification never classifies a list column.
convert_to_strinmetadata/pii/algorithms/preprocessing.pyreturnsNonefor a numpy array, so alist<string>column of email addresses gets no PII tag. - The sample data upload stores the array's repr.
_sanitize_sample_data_valuefalls back tostr(value), so the cell is stored as['[email protected]' '[email protected]']instead of a list.
To Reproduce
import io
import pyarrow as pa
import pyarrow.parquet as pq
from metadata.pii.algorithms.preprocessing import preprocess_values
buf = io.BytesIO()
pq.write_table(pa.table({"emails": [["[email protected]", "[email protected]"], ["[email protected]"]]}), buf)
buf.seek(0)
df = pq.ParquetFile(buf).read().to_pandas()
rows = df.dropna().values.tolist() # as in DatalakeSampler._fetch_rows
type(rows[0][0]) # numpy.ndarray
preprocess_values([row[0] for row in rows]) # []
preprocess_values([list(row[0]) for row in rows]) # ['[email protected]', '[email protected]', '[email protected]']
Expected behavior
List cells reach auto classification and the sample data upload as lists, as they do for SQLAlchemy sources.
Python version
3.12
OpenMetadata version
main (f3b006af)
OpenMetadata Ingestion package version
main (f3b006af)
Pre-submission checklist
- [x] I searched for duplicate issues.
- [x] I removed credentials, hostnames, emails, and other sensitive data from logs and config.