Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COPY FROM] Error: Binder exception: Cannot copy into <myname> table with type REL_GROUP. #4824

Open
sapalli2989 opened this issue Jan 31, 2025 · 1 comment

Comments

@sapalli2989
Copy link
Contributor

Example

user.csv

id,name
ef2b4363-66ab-4a2f-af59-f7f6cd80f250,Adam
8082bb02-7c30-4a06-8600-885df4fc0eab,Karissa

post.csv

id,content
055f6041-8bab-4ce6-a201-b85dab43442a,content1
b510506a-1208-4c2a-a916-f83b483b0249,content2

likes.csv

ef2b4363-66ab-4a2f-af59-f7f6cd80f250,055f6041-8bab-4ce6-a201-b85dab43442a
ef2b4363-66ab-4a2f-af59-f7f6cd80f250,8082bb02-7c30-4a06-8600-885df4fc0eab
CREATE NODE TABLE User (id UUID PRIMARY KEY, name STRING);
CREATE NODE TABLE Post (id UUID PRIMARY KEY, content STRING);
CREATE REL TABLE GROUP likes(FROM User TO User, FROM User TO Post);

COPY User FROM "user.csv" (header=true);
COPY Post FROM "post.csv" (header=true);

COPY likes FROM "likes.csv";
// Error: Binder exception: Cannot copy into likes table with type REL_GROUP.

Question

Is there a solution planned to allow REL GROUP (or more in general rel unions, as REL GROUP is deprecated) + COPY FROM imports?

Proposal

Two ideas:

  • The actual rel union type can be derived by following FROM/TO id constituents, assuming node IDs are unambiguous amongst rel unions (e.g. with UUID).
  • Allow a discriminator column for rel unions. likes.csv example, with discriminators for FROM/TO appended:
ef2b4363-66ab-4a2f-af59-f7f6cd80f250,055f6041-8bab-4ce6-a201-b85dab43442a,User,Post
ef2b4363-66ab-4a2f-af59-f7f6cd80f250,8082bb02-7c30-4a06-8600-885df4fc0eab,User,User

Related: #3627

Kuzu 0.7.1

@andyfengHKU
Copy link
Contributor

Hi @sapalli2989,

Actually we already support COPY into a REL GROUP in master through

COPY likes FROM "likes_user_post.csv" (from = 'User', to = 'Post');
COPY likes FROM "likes_user_user.csv" (from = 'User', to = 'User');

This approach is assuming your input file is still organized per FROM/TO pair.

This will be available in our v0.8 which is planned next week.

We do have a plan as suggested in the second idea to add FROM&TO column in the input file as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants