Mixing set and bag semantics

05/06/2019
by   Wilmer Ricciotti, et al.
0

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 normalization 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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/26/2020

Strongly-Normalizing Higher-Order Relational Queries

Language-integrated query is a powerful programming construct allowing d...
research
03/16/2022

Translating Canonical SQL to Imperative Code in Coq

SQL is by far the most widely used and implemented query language. Yet, ...
research
01/11/2021

Query Lifting: Language-integrated query for heterogeneous nested collections

Language-integrated query based on comprehension syntax is a powerful te...
research
07/28/2023

No More Nulls!

Since the inception of SQL, nulls have frustrated database users and bui...
research
08/31/2020

SparkGOR: A unified framework for genomic data analysis

Motivation: Our goal was to combine the capabilities of Spark and GOR in...
research
05/13/2020

Generating collection queries from proofs

Nested relations, built up from atomic types via tupling and set types, ...
research
04/01/2020

SPES: A Two-Stage Query Equivalence Verifier

In database-as-a-service platforms, automated verification of query equi...

Please sign up or login with your details

Forgot password? Click here to reset