skip to main content
10.1145/3315507.3330202acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Mixing set and bag semantics

Published:23 June 2019Publication History

ABSTRACT

The conservativity theorem for nested relational calculus implies that query expressions can freely use nesting and unnesting, yet as long as the query result type is a flat relation, these capabilities do not lead to an increase in expressiveness over flat relational queries. Moreover, Wong showed how such queries can be translated to SQL via a constructive rewriting algorithm. While this result holds for queries over either set or multiset semantics, to the best of our knowledge, the questions of conservativity and ormalization have not been studied for queries that mix set and bag collections, or provide duplicate-elimination operations such as SQL's SELECT DISTINCT. In this paper we formalize the problem, and present partial progress: specifically, we introduce a calculus with both set and multiset collection types, along with natural mappings from sets to bags and vice versa, present a set of valid rewrite rules for normalizing such queries, and give an inductive characterization of a set of queries whose normal forms can be translated to SQL. We also consider examples that do not appear straightforward to translate to SQL, illustrating that the relative expressiveness of flat and nested queries with mixed set and multiset semantics remains an open question.

References

  1. P. Buneman, S. Naqvi, V. Tannen, and L. Wong. Principles of programming with complex objects and collection types. Theor. Comput. Sci., 149(1), 1995.Google ScholarGoogle Scholar
  2. J. Cheney, S. Lindley, and P. Wadler. Query shredding: efficient relational evaluation of queries over nested multisets. In SIGMOD, pages 1027–1038. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. Cooper. The script-writer’s dream: How to write great SQL in your own language, and be sure it will succeed. In DBPL, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: web programming without tiers. In FMCO, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. L. Fegaras and D. Maier. Optimizing object queries using an effective calculus. ACM Trans. Database Syst., 25(4):457–516, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Fehrenbach and J. Cheney. Language-integrated provenance by trace analysis. 2019. arXiv:1905.02051.Google ScholarGoogle Scholar
  7. S. K. Lellahi and V. Tannen. A calculus for collections and aggregates. In CTCS, pages 261–280, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. E. Meijer, B. Beckman, and G. M. Bierman. LINQ: reconciling object, relations and XML in the .NET framework. In SIGMOD, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J. Paredaens and D. V. Gucht. Converting nested algebra expressions into flat algebra expressions. ACM Trans. Database Syst., 17(1), 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. W. Ricciotti and J. Cheney. Mixing set and bag semantics. 2019. arXiv:1905.02069.Google ScholarGoogle Scholar
  11. A. Ulrich and T. Grust. The flatter, the better: Query compilation based on the flattening transformation. In SIGMOD, pages 1421–1426. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. L. Wong. Normal forms and conservative extension properties for query languages over collection types. J. Comput. Syst. Sci., 52(3), 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. L. Wong. Kleisli, a functional query system. J. Funct. Programming, 10(1), 2000.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Mixing set and bag semantics

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        DBPL 2019: Proceedings of the 17th ACM SIGPLAN International Symposium on Database Programming Languages
        June 2019
        84 pages
        ISBN:9781450367189
        DOI:10.1145/3315507

        Copyright © 2019 ACM

        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 the author(s) 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].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 23 June 2019

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate10of15submissions,67%

        Upcoming Conference

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader