Functional Pearl: A SQL to C Compiler in 500 Lines of Code

被引:0
|
作者
Rompf, Tiark [1 ]
Amin, Nada [2 ]
机构
[1] Purdue Univ, W Lafayette, IN 47907 USA
[2] Ecole Polytech Fed Lausanne, Lausanne, Switzerland
关键词
SQL; Query Compilation; Staging; Generative Programming; Futamura Projections;
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
We present the design and implementation of a SQL query processor that outperforms existing database systems and is written in just about 500 lines of Scala code -a convincing case study that high-level functional programming can handily beat C for systems-level programming where the last drop of performance matters. The key enabler is a shift in perspective towards generative programming. The core of the query engine is an interpreter for relational algebra operations, written in Scala. Using the opensource LMS Framework (Lightweight Modular Staging), we turn this interpreter into a query compiler with very low effort. To do so, we capitalize on an old and widely known result from partial evaluation known as Futamura projections, which state that a program that can specialize an interpreter to any given input program is equivalent to a compiler. In this pearl, we discuss LMS programming patterns such as mixed-stage data structures (e.g. data records with static schema and dynamic field components) and techniques to generate low-level C code, including specialized data structures and data loading primitives.
引用
收藏
页码:2 / 9
页数:8
相关论文
共 47 条
  • [31] Functional analyses of C13orf19/P38IP in prostate cell lines
    Kunze, D
    Fuessel, S
    Meye, A
    Wirth, MP
    Schmidt, U
    ONCOLOGY REPORTS, 2006, 15 (06) : 1599 - 1604
  • [32] Characterization and functional analysis of hybrid pearl gentian grouper (Epinephelus lanceolatus♂ x Epinephelus fuscoguttatus♀) complement C3 against Cryptocaryon irritans infection
    Mo, Zequan
    Jiang, Biao
    Lai, Xueli
    Wu, Huicheng
    Luo, Xiaochun
    Dan, Xueming
    Li, Yanwei
    FISH AND SHELLFISH IMMUNOLOGY REPORTS, 2021, 2
  • [33] FUNCTIONAL-ANALYSIS OF C-MYB PROTEIN IN T-LYMPHOCYTIC CELL-LINES SHOWS THAT IT TRANS-ACTIVATES THE C-MYC PROMOTER
    EVANS, JL
    MOORE, TL
    KUEHL, WM
    BENDER, T
    TING, JP
    MOLECULAR AND CELLULAR BIOLOGY, 1990, 10 (11) : 5747 - 5752
  • [34] First demonstration of low temperature (≤500°C) CMOS devices featuring functional RO and SRAM bitcells toward 3D VLSI integration
    Fenouillet-Beranger, C.
    Brunet, L.
    Batude, P.
    Brevard, L.
    Garros, X.
    Frutuoso, T. Mota
    Casse, M.
    Lugo, J.
    Lacord, J.
    Bosch, D.
    Bernard, N.
    Magalhaes-Lucas, A.
    Ribotta, M.
    Sklenard, B.
    Milesi, F.
    Kies, R.
    Romano, G.
    Acosta-Alba, P.
    Kerdiles, S.
    Tavernier, A.
    Vizioz, C.
    Besson, P.
    Gassilloud, R.
    Kanyandekwe, J.
    Cooper, D.
    Lapras, V
    Kim, W. H.
    Sasaki, Y.
    Oh, S.
    Kang, P.
    Lee, S. W.
    Na, H.
    Arcamone, J.
    Andrieu, F.
    2020 IEEE SYMPOSIUM ON VLSI TECHNOLOGY, 2020,
  • [35] FUNCTIONAL CHARACTERISTICS OF BALB-C T-CELL LINES - SUPPRESSION IN MIXED LYMPHOCYTE-RESPONSE AND CELL-MEDIATED LYSIS
    KIM, KJ
    WEINBAUM, FI
    ASOFSKY, R
    JOURNAL OF IMMUNOLOGY, 1978, 121 (06): : 2299 - 2304
  • [36] Genetic Code Expansion in Shewanella oneidensis MR-1 Allows Site-Specific Incorporation of Bioorthogonal Functional Groups into a c-Type Cytochrome
    Lockwood, Colin W. J.
    Nash, Benjamin W.
    Newton-Payne, Simone E.
    van Wonderen, Jessica H.
    Whiting, Keir P. S.
    Connolly, Abigail
    Sutton-Cook, Alexander L.
    Crook, Archie
    Aithal, Advait R.
    Edwards, Marcus J.
    Clarke, Thomas A.
    Sachdeva, Amit
    Butt, Julea N.
    ACS SYNTHETIC BIOLOGY, 2024, 13 (09): : 2833 - 2843
  • [37] THE 6-KILOBASE C-ERBB2 PROMOTER CONTAINS POSITIVE AND NEGATIVE REGULATORY ELEMENTS FUNCTIONAL IN HUMAN MAMMARY CELL-LINES
    GROOTECLAES, M
    PASLEAU, F
    DIJKMANS, H
    BERZI, P
    ALBERT, A
    WINKLERGOL, R
    CANCER RESEARCH, 1994, 54 (15) : 4193 - 4199
  • [39] Selecting Cells for Bioartificial Liver Devices and the Importance of a 3D Culture Environment: A Functional Comparison between the HepaRG and C3A Cell Lines
    van Wenum, Martien
    Adam, Aziza A. A.
    Hakvoort, Theodorus B. M.
    Hendriks, Erik J.
    Shevchenko, Valery
    van Gulik, Thomas M.
    Chamuleau, Robert A. F. M.
    Hoekstra, Ruurdtje
    INTERNATIONAL JOURNAL OF BIOLOGICAL SCIENCES, 2016, 12 (08): : 964 - 978
  • [40] Functional expression of 5-HT1A and 5-HT2C receptors in mammalian cell lines by baculovirus-mediated gene delivery
    Lou, ZW
    Zhang, YX
    Lu, Q
    Dunlop, J
    FASEB JOURNAL, 2003, 17 (05): : A1022 - A1022