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

Add struct literal support #1462

Merged
merged 1 commit into from
Apr 20, 2023
Merged

Add struct literal support #1462

merged 1 commit into from
Apr 20, 2023

Conversation

acquamarin
Copy link
Collaborator

@acquamarin acquamarin commented Apr 12, 2023

Add struct literal support. Example: return {weight: 5, height: 20} will return a struct with '{weight: 5, height: 20}'

@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Patch coverage: 86.51% and project coverage change: -0.03 ⚠️

Comparison is base (6def875) 92.16% compared to head (8dc4439) 92.14%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1462      +/-   ##
==========================================
- Coverage   92.16%   92.14%   -0.03%     
==========================================
  Files         669      670       +1     
  Lines       23676    23806     +130     
==========================================
+ Hits        21821    21936     +115     
- Misses       1855     1870      +15     
Impacted Files Coverage Δ
src/common/arrow/arrow_row_batch.cpp 56.53% <0.00%> (ø)
src/include/common/types/value.h 100.00% <ø> (ø)
src/include/function/built_in_vector_operations.h 100.00% <ø> (ø)
src/include/function/function_definition.h 100.00% <ø> (ø)
src/include/function/list/vector_list_operations.h 97.36% <ø> (ø)
src/include/parser/transformer.h 100.00% <ø> (ø)
src/include/processor/processor_task.h 100.00% <ø> (ø)
src/common/types/types.cpp 81.62% <45.16%> (+0.47%) ⬆️
src/include/common/types/types.h 92.85% <85.71%> (+17.85%) ⬆️
src/function/vector_list_operation.cpp 94.35% <88.88%> (+0.17%) ⬆️
... and 14 more

... and 25 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@andyfengHKU andyfengHKU left a comment

Choose a reason for hiding this comment

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

This PR is fine but we should against discuss something, specifically struct access and using child vector for list

src/antlr4/Cypher.g4 Outdated Show resolved Hide resolved
src/include/common/types/types.h Outdated Show resolved Hide resolved
src/common/types/types.cpp Outdated Show resolved Hide resolved
src/include/parser/expression/parsed_expression.h Outdated Show resolved Hide resolved
test/binder/binder_error_test.cpp Show resolved Hide resolved
src/function/vector_list_operation.cpp Show resolved Hide resolved
src/function/vector_struct_operations.cpp Outdated Show resolved Hide resolved
std::make_unique<ParsedFunctionExpression>(common::STRUCT_PACK_FUNC_NAME, ctx.getText());
for (auto& structField : ctx.oC_StructField()) {
auto structExpr = transformExpression(*structField->oC_Expression());
structExpr->setAlias(transformSymbolicName(*structField->oC_SymbolicName()));
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably need to discuss how to access a field from a struct. That part is currently missing and might be tricky to do.

src/processor/operator/table_scan/base_table_scan.cpp Outdated Show resolved Hide resolved
copyNonNullDataWithSameType(resultVector.dataType, srcData,
resultVector.getData() + pos * resultVector.getNumBytesPerValue(),
resultVector.getOverflowBuffer());
if (resultVector.dataType.typeID == STRUCT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

now that you are changing this. I think we should discuss how LIST can be done in a similar fashion. ideally this copyInto and copyFrom should be handled with

switch typeID
recursive types:
   ...
non recursive types:
   ...

@ray6080 should think about this as well.

src/common/types/types.cpp Outdated Show resolved Hide resolved
src/processor/processor_task.cpp Show resolved Hide resolved
@acquamarin acquamarin merged commit 9bbaba9 into master Apr 20, 2023
@acquamarin acquamarin deleted the struct-processing branch April 20, 2023 19:45
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.

2 participants