TY - GEN
T1 - Finally, safely-extensible and efficient language-integrated query
AU - Suzuki, Kenichi
AU - Kiselyov, Oleg
AU - Kameyama, Yukiyoshi
N1 - Copyright:
Copyright 2016 Elsevier B.V., All rights reserved.
PY - 2016/1/11
Y1 - 2016/1/11
N2 - Language-integrated query is an embedding of database queries into a host language to code queries at a higher level than the all-to-common concatenation of strings of SQL fragments. The eventually produced SQL is ensured to be well-formed and welltyped, and hence free from the embarrassing (security) problems. Language-integrated query takes advantage of the host language's functional and modular abstractions to compose and reuse queries and build query libraries. Furthermore, language-integrated query systems like T-LINQ generate efficient SQL, by applying a number of program transformations to the embedded query. Alas, the set of transformation rules is not designed to be extensible. We demonstrate a new technique of integrating database queries into a typed functional programming language, so to write welltyped, composable queries and execute them efficiently on any SQL back-end as well as on an in-memory noSQL store. A distinct feature of our framework is that both the query language as well as the transformation rules needed to generate efficient SQL are safely user-extensible, to account for many variations in the SQL backends, as well for domain-specific knowledge. The transformation rules are guaranteed to be type-preserving and hygienic by their very construction. They can be built from separately developed and reusable parts and arbitrarily composed into optimization pipelines. With this technique we have embedded into OCaml a relational query language that supports a very large subset of SQL including grouping and aggregation. Its types cover the complete set of intricate SQL behaviors.
AB - Language-integrated query is an embedding of database queries into a host language to code queries at a higher level than the all-to-common concatenation of strings of SQL fragments. The eventually produced SQL is ensured to be well-formed and welltyped, and hence free from the embarrassing (security) problems. Language-integrated query takes advantage of the host language's functional and modular abstractions to compose and reuse queries and build query libraries. Furthermore, language-integrated query systems like T-LINQ generate efficient SQL, by applying a number of program transformations to the embedded query. Alas, the set of transformation rules is not designed to be extensible. We demonstrate a new technique of integrating database queries into a typed functional programming language, so to write welltyped, composable queries and execute them efficiently on any SQL back-end as well as on an in-memory noSQL store. A distinct feature of our framework is that both the query language as well as the transformation rules needed to generate efficient SQL are safely user-extensible, to account for many variations in the SQL backends, as well for domain-specific knowledge. The transformation rules are guaranteed to be type-preserving and hygienic by their very construction. They can be built from separately developed and reusable parts and arbitrarily composed into optimization pipelines. With this technique we have embedded into OCaml a relational query language that supports a very large subset of SQL including grouping and aggregation. Its types cover the complete set of intricate SQL behaviors.
KW - EDSL
KW - LINQ
KW - Language-integrated query
KW - SQL
KW - Tagless-final
UR - http://www.scopus.com/inward/record.url?scp=84966577785&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84966577785&partnerID=8YFLogxK
U2 - 10.1145/2847538.2847542
DO - 10.1145/2847538.2847542
M3 - Conference contribution
AN - SCOPUS:84966577785
T3 - PEPM 2016 - Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, co-located with POPL 2016
SP - 37
EP - 48
BT - PEPM 2016 - Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, co-located with POPL 2016
A2 - Rompf, Tiark
A2 - Erwig, Martin
PB - Association for Computing Machinery, Inc
T2 - 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2016
Y2 - 18 January 2016 through 19 January 2016
ER -