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 COPY TO statement #1716

Merged
merged 4 commits into from
Aug 3, 2023
Merged

Support COPY TO statement #1716

merged 4 commits into from
Aug 3, 2023

Conversation

rfdavid
Copy link
Collaborator

@rfdavid rfdavid commented Jun 23, 2023

This PR introduces the command COPY ([QUERY]) TO [file].
The command above will execute the passed query and store the results into the defined file. In this PR, it only supports .csv extension, so .parquet files will be supported in a separated one.

Example:

COPY (MATCH (p:person) RETURN id(p), p.ID, p.fName, p.gender, p.isStudent, p.height) TO "person.csv";

COPY (MATCH (a)<-[:knows|:studyAt]-(b:person) RETURN DISTINCT b.fName) to 'names.csv';

Related to #1692

@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Patch coverage: 89.45% and project coverage change: -0.04% ⚠️

Comparison is base (0317cef) 89.53% compared to head (218a608) 89.49%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1716      +/-   ##
==========================================
- Coverage   89.53%   89.49%   -0.04%     
==========================================
  Files         827      834       +7     
  Lines       30310    30482     +172     
==========================================
+ Hits        27138    27281     +143     
- Misses       3172     3201      +29     
Files Changed Coverage Δ
src/include/binder/binder.h 100.00% <ø> (ø)
src/include/common/copier_config/copier_config.h 100.00% <ø> (ø)
src/include/common/statement_type.h 100.00% <ø> (ø)
src/include/optimizer/factorization_rewriter.h 100.00% <ø> (ø)
src/include/parser/transformer.h 100.00% <ø> (ø)
...ical_plan/logical_operator/base_logical_operator.h 100.00% <ø> (ø)
src/include/processor/mapper/plan_mapper.h 100.00% <ø> (ø)
src/include/processor/operator/physical_operator.h 100.00% <ø> (ø)
src/planner/operator/base_logical_operator.cpp 73.23% <0.00%> (-1.05%) ⬇️
src/processor/operator/physical_operator.cpp 65.17% <0.00%> (-0.59%) ⬇️
... and 24 more

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/include/common/copier_config/copier_config.h Outdated Show resolved Hide resolved
src/parser/transformer.cpp Outdated Show resolved Hide resolved
src/planner/operator/logical_copy_to.cpp Outdated Show resolved Hide resolved
src/planner/operator/logical_copy_to.cpp Outdated Show resolved Hide resolved
src/binder/bind/bind_copy.cpp Outdated Show resolved Hide resolved
src/planner/planner.cpp Outdated Show resolved Hide resolved
src/include/processor/operator/copy_to/copy_to.h Outdated Show resolved Hide resolved
src/processor/mapper/map_ddl.cpp Outdated Show resolved Hide resolved
src/binder/bind/bind_copy.cpp Outdated Show resolved Hide resolved
src/planner/planner.cpp Outdated Show resolved Hide resolved
@rfdavid rfdavid force-pushed the copy_to branch 4 times, most recently from 7d9dc88 to f065099 Compare July 12, 2023 18:18
src/processor/processor.cpp Outdated Show resolved Hide resolved
src/antlr4/Cypher.g4 Outdated Show resolved Hide resolved
src/include/binder/copy/bound_copy.h Outdated Show resolved Hide resolved
src/common/copier_config/copier_config.cpp Outdated Show resolved Hide resolved
src/binder/bind/bind_copy.cpp Outdated Show resolved Hide resolved
src/include/parser/copy.h Outdated Show resolved Hide resolved
src/planner/planner.cpp Outdated Show resolved Hide resolved
src/processor/mapper/plan_mapper.cpp Outdated Show resolved Hide resolved
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.

Up to planning looks good to me. Good job.

src/binder/bind/bind_copy.cpp Outdated Show resolved Hide resolved
src/include/parser/copy.h Outdated Show resolved Hide resolved
src/include/parser/copy.h Outdated Show resolved Hide resolved
src/include/binder/copy/bound_copy.h Outdated Show resolved Hide resolved
src/include/common/copier_config/copier_config.h Outdated Show resolved Hide resolved
src/include/processor/mapper/plan_mapper.h Outdated Show resolved Hide resolved
src/planner/planner.cpp Outdated Show resolved Hide resolved
src/processor/mapper/plan_mapper.cpp Outdated Show resolved Hide resolved
@rfdavid rfdavid force-pushed the copy_to branch 6 times, most recently from acd94db to fbdfe2a Compare July 27, 2023 19:40
@rfdavid rfdavid force-pushed the copy_to branch 2 times, most recently from 8e015b1 to efda387 Compare August 1, 2023 16:01
@rfdavid rfdavid marked this pull request as ready for review August 1, 2023 16:11
src/processor/operator/copy_to/copy_to.cpp Outdated Show resolved Hide resolved
src/antlr4/Cypher.g4 Outdated Show resolved Hide resolved
src/common/type_utils.cpp Outdated Show resolved Hide resolved
src/include/planner/planner.h Outdated Show resolved Hide resolved
src/include/processor/operator/copy_to/csv_file_writer.h Outdated Show resolved Hide resolved
src/processor/operator/copy_to/csv_file_writer.cpp Outdated Show resolved Hide resolved
src/include/processor/operator/copy_to/csv_file_writer.h Outdated Show resolved Hide resolved
src/include/processor/operator/copy_to/csv_file_writer.h Outdated Show resolved Hide resolved
src/processor/operator/copy_to/csv_file_writer.cpp Outdated Show resolved Hide resolved
src/processor/operator/copy_to/csv_file_writer.cpp Outdated Show resolved Hide resolved
src/include/binder/copy/bound_copy_to.h Outdated Show resolved Hide resolved
src/include/binder/copy/bound_copy_to.h Outdated Show resolved Hide resolved
@rfdavid rfdavid force-pushed the copy_to branch 4 times, most recently from cee196a to 71a3e39 Compare August 3, 2023 11:52
Copy link
Contributor

@ray6080 ray6080 left a comment

Choose a reason for hiding this comment

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

LGTM!

src/include/processor/operator/copy_to/csv_file_writer.h Outdated Show resolved Hide resolved
src/processor/operator/copy_to/csv_file_writer.cpp Outdated Show resolved Hide resolved
@rfdavid rfdavid merged commit bb4f187 into kuzudb:master Aug 3, 2023
10 checks passed
@rfdavid rfdavid deleted the copy_to branch August 3, 2023 16:50
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.

None yet

3 participants