How the code generation pipeline works
mainThe code generation pipeline (scripts 00 through 07) automates the creation of duckplyr methods by introspecting dplyr's S3 methods for data.frame.
- Extraction:
01-dplyr-methods.Rextracts the source code ofdata.framemethods fromdplyrand saves them as text files indplyr-methods/to serve as fallbacks. - Implementation:
02-duckplyr_df-methods.RgeneratesR/<verb>.Rfiles. These files contain the<verb>.duckplyr_dfS3 method, which attempts a DuckDB execution viarel_try()and falls back to the embeddeddplyrimplementation on failure. - Testing:
03-tests.Rensuresduckplyr_dfresults are equivalent to plaindplyrresults.04-dplyr-tests.Radapts existingdplyrtests forduckplyr.05-duckdb-tests.Rgenerates tests that validate the DuckDB relational API plans.
- Registration:
07-overwrite.Rgeneratesmethods_overwrite_impl()to registerduckplyrmethods as the primarydata.framemethods viavctrs::s3_register(), making the transition transparent to users.