Skip to content

XiangpengHao/build-your-own-s3-select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The source code of my blog: Build your own S3-Select in 400 lines of Rust.

You may also want to checkout LiquidCache, a more feature-rich version of this project.

Clone and install Rust

git clone https://github.com/XiangpengHao/build-your-own-s3-select.git

cd build-your-own-s3-select

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Run the server

cargo run --bin server

Run the client

cargo run --bin client

You should see the following output. Note the SQL to pushdown only contains filters and projection, i.e., no DISTINCT or GROUP BY.

SQL to run: 
-------
SELECT DISTINCT "city" FROM "aws-edge-locations" WHERE "country" = 'United States'
-------

SQL to pushdown: 
-------
SELECT "aws-edge-locations"."city" FROM "aws-edge-locations" WHERE ("aws-edge-locations"."country" = 'United States')
-------

+----------------+
| city           |
+----------------+
| Boston         |
| Chicago        |
| Portland       |
| New York       |
| Newark         |
| Detroit        |
...

Lines of code

Note that we have more than 50 lines of imports.

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Rust                    2          484          431            1           52