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

Support unwind array #3402

Merged
merged 4 commits into from
Apr 29, 2024
Merged

Support unwind array #3402

merged 4 commits into from
Apr 29, 2024

Conversation

acquamarin
Copy link
Collaborator

This PR supports unwinding an array.
Closes #3401

@@ -179,3 +179,46 @@ Aida|Alice|Bob|Dan
{_ID: 0:5, _LABEL: person, ID: 8, fName: Farooq, gender: 2, isStudent: True, isWorker: False, age: 25, eyeSight: 4.500000, birthdate: 1980-10-26, registerTime: 1972-07-31 13:22:30.678559, lastJobDuration: 00:18:00.024, workedHours: [3,4,5,6,7], usedNames: [Fesdwe], courseScoresPerTerm: [[8]], grades: [80,78,34,83], height: 1.510000, u: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a16}
{_ID: 0:6, _LABEL: person, ID: 9, fName: Greg, gender: 2, isStudent: False, isWorker: False, age: 40, eyeSight: 4.900000, birthdate: 1980-10-26, registerTime: 1976-12-23 04:41:42, lastJobDuration: 10 years 5 months 13:00:00.000024, workedHours: [1], usedNames: [Grad], courseScoresPerTerm: [[10]], grades: [43,83,67,43], height: 1.600000, u: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17}
{_ID: 0:7, _LABEL: person, ID: 10, fName: Hubert Blaine Wolfeschlegelsteinhausenbergerdorff, gender: 2, isStudent: False, isWorker: True, age: 83, eyeSight: 4.900000, birthdate: 1990-11-27, registerTime: 2023-02-21 13:25:30, lastJobDuration: 3 years 2 days 13:02:00, workedHours: [10,11,12,3,4,5,6,7], usedNames: [Ad,De,Hi,Kye,Orlan], courseScoresPerTerm: [[7],[10],[6,7]], grades: [77,64,100,54], height: 1.323000, u: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18}

-LOG unwindArrayOfInt
-STATEMENT MATCH (a:person) UNWIND a.grades as x RETURN x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did u try to run this in debug mode. I think will trigger an assertion.

@@ -21,7 +21,8 @@ std::unique_ptr<BoundReadingClause> Binder::bindUnwindClause(const ReadingClause
auto aliasName = unwindClause.getAlias();
std::shared_ptr<Expression> alias;
if (!skipDataTypeValidation(*boundExpression)) {
ExpressionUtil::validateDataType(*boundExpression, LogicalTypeID::LIST);
ExpressionUtil::validateDataType(*boundExpression,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why this will work. Technically it shouldn't because unwind operator assuming input will always be a LIST. I think you should cast to LIST if input is an array.

@acquamarin acquamarin merged commit eab016d into master Apr 29, 2024
17 checks passed
@acquamarin acquamarin deleted the support-array-unwind branch April 29, 2024 16:13
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

Successfully merging this pull request may close these issues.

Allow UNWIND for ARRAY data type
2 participants