cmu-db / bustub

The BusTub Relational Database Management System (Educational)
https://15445.courses.cs.cmu.edu
MIT License
4.12k stars 1.81k forks source link

feat: support reading form csv file #550

Closed infdahai closed 1 year ago

infdahai commented 1 year ago

issue: #404

status: (don't need to review, still be coding)

material impl ref: duckdb, risinglight, copy syntax specification: copy statement

expected behavior:

copy a from 'b.csv';

task:

  1. add physical copy file plan [x] get bind_type and create file copy plan.(file path,file format)
  2. add copy file executor. [x] csv file: read file based on path and get columns.
  3. from csv to table [x]
  4. add copy command[x].
infdahai commented 1 year ago

duckdb sql just supports copy a from b.csv; and the table a is a table with determinate types in catalog stage. Because we don't know the types in csv file except for specifying the test csv format in bustub, such as (bigint, bigint, bigint).

so we can only use 'create table' and then 'copy from' to do this task.