Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2034773.2034815acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Making standard ML a practical database programming language

Published: 19 September 2011 Publication History

Abstract

Integrating a database query language into a programming language is becoming increasingly important in recently emerging high-level cloud computing and other applications, where efficient and sophisticated data manipulation is required during computation. This paper reports on seamless integration of SQL into SML# - an extension of Standard ML. In the integrated language, the type system always infers a principal type for any type consistent SQL expression. This makes SQL queries first-class citizens, which can be freely combined with any other language constructs definable in Standard ML. For a program involving SQL queries, the compiler separates SQL queries and delegates their evaluation to a database server, e.g. PostgreSQL or MySQL in the currently implemented version.
The type system of our language is largely based on Machiavelli, which demonstrates that ML with record polymorphism can represent type structure of SQL. In order to develop a practical language, however, a number of technical challenges have to be overcome, including static enforcement of server connection consistency, proper treatment of overloaded SQL primitives, query compilation, and runtime connection management. This paper describes the necessary extensions to the type system and compilation, and reports on the details of its implementation.

Supplementary Material

MP4 File (_talk4.mp4)

References

[1]
M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically-typed language. ACM Trans. Program. Lang. Syst., 13(2):207--268, 1991.
[2]
A. Albano, G. Ghelli, and R. Orsini. Fibonacci: a programming language for object databases. The VLDB Journal, 4(3):403--444, 1995.
[3]
J. Annevelink. Database programming languages: a functional approach. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 318--327, 1991.
[4]
M.P. Atkinson and O.P. Buneman. Types and persistence in database programming languages. ACM Computing Surveys, 1987.
[5]
S. Blanas, J. M. Patel, V. Ercegovac, J. Rao, E. J. Shekita, and Y. Tian. A comparison of join algorithms for log processing in mapreduce. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 975--986, 2010. ACM.
[6]
P. Buneman, S. Naqvi, V. Tannen, and L. Wong. Principles of programming with complex objects and collection types. Theor. Comput. Sci., 149(1):3--48, 1995.
[7]
A. Chlipala. Ur: statically-typed metaprogramming with type-level record computation. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 122--133, 2010.
[8]
E. F. Codd. A relational model for large shared databank. Communications of the ACM, 13(6):377--387, 1970.
[9]
E. Cooper. The script-writer's dream: How to write great SQL in your own language, and be sure it will succeed. In Proceedings of the International Symposium on Database Programming Languages, pages 36--51, Springer-Verlag, 2009.
[10]
E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: web programming without tiers. In Proceedings of the International Conference on Formal Methods for Components and Objects, pages 266--296, Springer-Verlag, 2007.
[11]
G. Copeland and D. Maier. Making smalltalk a database system. In Proceedings of the ACM SIGMOD International Conferenceon Management of Data, pages 316--325, 1984.
[12]
J. Dean and S. Ghemawat. Mapreduce: simplified data processing on large clusters. Commun. ACM, 51(1):107--113, 2008.
[13]
A. Eisenberg and J. Melton. SQLJ part 0, now known as SQL/OLB (object-language bindings). SIGMOD Rec., 27(4):94--100, 1998.
[14]
J. Gil and K. Lenz. Simple and safe SQL queries with C++ templates. Science of Computer Programming, 75(7):573--595, 2010.
[15]
G. Giorgidze, T. Grust, T. Schreiber, and J. Weijers. Haskell boards the Ferry: Database-supported program execution for Haskell. In Proceedings of the 22nd international symposium on Implementation and Application of Functional Languages, to appear.
[16]
T. Grust, M. Mayr, J. Rittinger, and T. Schreiber. FERRY: database-supported program execution. In Proceedings of the SIGMOD International Conference on Management of Data, pages 1063--1066, 2009.
[17]
C. V. Hall, K. Hammond, S. L. Peyton Jones, and P. L. Wadler. Type classes in haskell. ACM Trans. Program. Lang. Syst., 18(2):109--138, 1996.
[18]
P. Hudak. Building domain-specific embedded languages. ACM Comput. Surv., page 196, 1996.
[19]
D. Leijen and E. Meijer. Domain specific embedded compilers. In Proceedings of the 2nd USENIX Conference on Domain Specific Languages, pages 109--122, 1999.
[20]
Y. Leontiev, M. T. Özsu, and D. Szafron. On type systems for object-oriented database programming languages. ACM Comput. Surv., 34(4):409--449, 2002.
[21]
D. Maier. Why database languages are a bad idea. In F. Bancilhon and P. Buneman, editors, Proceedings of the International Workshop on Database Programming Languages, Addison-Wesley, 1989.
[22]
E. Meijer, B. Beckman, and G. Bierman. LINQ: Reconciling object, relations and XML in the .NET framework. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 706--706, 2006.
[23]
R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML. The MIT Press, revised edition, 1997.
[24]
J.C. Mitchell and G.D. Plotkin. Abstract types have existential type. ACM Trans. Program. Lang. Syst., 10(3):470--502, 1988.
[25]
R. Morrison, F. Brown, R. Connor, Q. Cutts, A. Dearle, G. Kirby, and D. Munro. Napier88 reference manual. Technical report, University of St. Andrews, 1996.
[26]
H-D. Nguyen and A. Ohori. Compiling ml polymporphism with explicit layout bitmap. In Proceedings of the ACM Conference on Principles andPractice of Declarative Programming, pages 237--248, 2006.
[27]
A. Ohori. A polymorphic record calculus and its compilation. ACM Trans. Program. Lang. Syst., 17(6):844--895, 1995. A preliminary summary appeared at ACM POPL, 1992 under the title "A compilation method for ML-style polymorphic record calculi".
[28]
A. Ohori and P. Buneman. Type inference in a database programming language. In Proceedings of the ACM Conference on LISP and Functional Programming, pages 174--183, 1988.
[29]
A. Ohori, P. Buneman, and V. Breazu-Tannen. Database programming in Machiavelli - a polymorphic language with static type inference. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 46--57, 1989.
[30]
D. Remy. Typechecking records and variants in a natural extension of ML. In Proceedings of the ACM Symposium on Principles of Programming Languages, pages 242--249, 1989.
[31]
SML#. http://www.riec.tohoku.ac.jp/smlsharp/.
[32]
J. Bussche, D. Van Gucht, and S. Vansummeren. A crash course on database queries. In Proceedings of the ACM SIGMOD-SIGACT-SIGART Symposiumon Principles of Database Systems, pages 143--154, 2007.
[33]
Limsoon Wong. Kleisli, a functional query system. J. Funct. Program., 10(1):19--56, 2000.
[34]
C. Lécluse and P. Richard. The O2 database programming language. In Proceedings of the International Conference on Very Large Data Bases, pages 423--432, Morgan Kaufmann Publishers Inc, 1989.

Cited By

View all
  • (2020)Reorganizing queries with groupingProceedings of the 19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3425898.3426960(50-62)Online publication date: 16-Nov-2020
  • (2018)Language-Integrated QueriesCompanion Proceedings of the The Web Conference 201810.1145/3184558.3185973(711-719)Online publication date: 23-Apr-2018
  • (2017)A Typeful Integration of SQL into CurryElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.234.8234(104-119)Online publication date: 1-Jan-2017
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
September 2011
470 pages
ISBN:9781450308656
DOI:10.1145/2034773
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 46, Issue 9
    ICFP '11
    September 2011
    456 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2034574
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 September 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. interoperability
  2. polymorphism
  3. sml#
  4. sql
  5. type system

Qualifiers

  • Research-article

Conference

ICFP '11
Sponsor:

Acceptance Rates

ICFP '11 Paper Acceptance Rate 33 of 92 submissions, 36%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)9
  • Downloads (Last 6 weeks)0
Reflects downloads up to 25 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2020)Reorganizing queries with groupingProceedings of the 19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3425898.3426960(50-62)Online publication date: 16-Nov-2020
  • (2018)Language-Integrated QueriesCompanion Proceedings of the The Web Conference 201810.1145/3184558.3185973(711-719)Online publication date: 23-Apr-2018
  • (2017)A Typeful Integration of SQL into CurryElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.234.8234(104-119)Online publication date: 1-Jan-2017
  • (2017)A program optimization for automatic database result cachingACM SIGPLAN Notices10.1145/3093333.300989152:1(271-284)Online publication date: 1-Jan-2017
  • (2017)A program optimization for automatic database result cachingProceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages10.1145/3009837.3009891(271-284)Online publication date: 1-Jan-2017
  • (2017)Sound and Efficient Language-Integrated QueryProgramming Languages and Systems10.1007/978-3-319-71237-6_18(364-383)Online publication date: 19-Nov-2017
  • (2016)A Type Safe Access to Key-value Stores from Functional LanguagesJournal of Information Processing10.2197/ipsjjip.24.14124:1(141-151)Online publication date: 2016
  • (2016)Language-integrated provenanceProceedings of the 18th International Symposium on Principles and Practice of Declarative Programming10.1145/2967973.2968604(214-227)Online publication date: 5-Sep-2016
  • (2016)Finally, safely-extensible and efficient language-integrated queryProceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/2847538.2847542(37-48)Online publication date: 11-Jan-2016
  • (2014)SML# in industryACM SIGPLAN Notices10.1145/2692915.262816449:9(167-173)Online publication date: 19-Aug-2014
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media