Skip to content

fix: add delimiter parameter to load_labels_from_file and load_edges_from_file#2469

Open
mmustafasenoglu wants to merge 1 commit into
apache:masterfrom
mmustafasenoglu:fix/delimiter-parameter
Open

fix: add delimiter parameter to load_labels_from_file and load_edges_from_file#2469
mmustafasenoglu wants to merge 1 commit into
apache:masterfrom
mmustafasenoglu:fix/delimiter-parameter

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Summary

Closes #2449

Both load_labels_from_file and load_edges_from_file relied on PostgreSQL COPY's default comma delimiter, causing silent data corruption on labels and segfault on edges when using non-comma-delimited files.

This adds an optional delimiter TEXT parameter (default comma) to both functions, allowing users to specify the field separator.

Changes

  • create_copy_options() in both ag_load_labels.c and ag_load_edges.c now accepts and passes the delimiter to COPY
  • SQL function signatures updated with new delimiter parameter (default comma)
  • Regression tests added for pipe-delimited vertex and edge files

Usage

-- Pipe-delimited vertex file
SELECT load_labels_from_file('graph', 'Label', 'file.csv', true, false, '|');

-- Pipe-delimited edge file
SELECT load_edges_from_file('graph', 'Edge', 'file.csv', false, '|');

Backward Compatibility

The new parameter has a default value of comma, so all existing calls continue to work without changes.

…from_file

Closes apache#2449

Both load_labels_from_file and load_edges_from_file relied on PostgreSQL
COPY's default comma delimiter, causing silent data corruption on labels
and segfault on edges when using non-comma-delimited files.

This adds an optional 'delimiter' TEXT parameter (default ',') to both
functions, allowing users to specify the field separator:

  SELECT load_labels_from_file('graph', 'Label', 'file.csv', true, false, '|');
  SELECT load_edges_from_file('graph', 'Edge', 'file.csv', false, '|');

Changes:
- create_copy_options() now accepts and passes the delimiter to COPY
- SQL function signatures updated with new delimiter parameter
- Regression tests added for pipe-delimited vertex and edge files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant