Skip to main content
QUICK REVIEW

[Paper Review] The SQL++ Query Language: Configurable, Unifying and Semi-structured

Kian Win Ong, Yannis Papakonstantinou|arXiv (Cornell University)|May 14, 2014
Advanced Database Systems and QueriesComputer Science25 citations
TL;DR

This paper introduces SQL++, a unified, configurable query language that extends SQL to natively support semi-structured data like JSON while maintaining full backward compatibility. By removing key semantic restrictions of SQL and introducing minimal, targeted extensions—such as variable binding to attribute-value pairs and array indices—SQL++ achieves full composability and expressive power akin to OQL and XQuery, with formal mappings to existing NoSQL query languages via configuration options.

ABSTRACT

NoSQL databases support semi-structured data, typically modeled as JSON. They also provide limited (but expanding) query languages. Their idiomatic, non-SQL language constructs, the many variations, and the lack of formal semantics inhibit deep understanding of the query languages, and also impede progress towards clean, powerful, declarative query languages. This paper specifies the syntax and semantics of SQL++, which is applicable to both JSON native stores and SQL databases. The SQL++ semi-structured data model is a superset of both JSON and the SQL data model. SQL++ offers powerful computational capabilities for processing semi-structured data akin to prior non-relational query languages, notably OQL and XQuery. Yet, SQL++ is SQL backwards compatible and is generalized towards JSON by introducing only a small number of query language extensions to SQL. Recognizing that a query language standard is probably premature for the fast evolving area of NoSQL databases, SQL++ includes configuration options that formally itemize the semantics variations that language designers may choose from. The options often pertain to the treatment of semi-structuredness (missing attributes, heterogeneous types, etc), where more than one sensible approaches are possible. SQL++ is unifying: By appropriate choices of configuration options, the SQL++ semantics can morph into the semantics of existing semi-structured database query languages. The extensive experimental validation shows how SQL and four semi-structured database query languages (MongoDB, Cassandra CQL, Couchbase N1QL and AsterixDB AQL) are formally described by appropriate settings of the configuration options. Early adoption signs of SQL++ are positive: Version 4 of Couchbase's N1QL is explained as syntactic sugar over SQL++. AsterixDB will soon support the full SQL++ and Apache Drill is in the process of aligning with SQL++.

Motivation & Objective

  • To address the lack of formal, unified semantics in modern NoSQL query languages, which hinders deep understanding and interoperability.
  • To design a query language that supports semi-structured data (e.g., JSON) without sacrificing SQL compatibility or requiring schema constraints.
  • To provide a formal, extensible framework that can describe the semantics of diverse query languages (e.g., MongoDB, N1QL, AQL) through configuration options.
  • To enable seamless integration of SQL and NoSQL capabilities by generalizing SQL’s semantics to support nested, heterogeneous, and bag-based data structures.
  • To serve as a unifying target language for middleware and database systems, reducing the need for developers to learn multiple query language variants.

Proposed method

  • Define a SQL++ data model that is a superset of both JSON and the SQL relational model, supporting arrays, bags, and enriched atomic values.
  • Extend SQL by removing key semantic restrictions: FROM variables bind to any JSON element (not just tuples), subqueries are fully composable, and grouping constructs are directly usable in nested queries.
  • Introduce new binding constructs allowing FROM variables to range over attribute names/values and array indices/elements, enabling schema-agnostic data inspection.
  • Formalize SQL++ semantics using a staged approach: define a core SQL++ language, then define configuration options that parameterize behavior variations (e.g., null vs. missing handling).
  • Use configuration options to formally map SQL++ to existing query languages (e.g., MongoDB, N1QL, AQL, Cassandra CQL), showing that SQL++ can morph into their semantics via parameter settings.
  • Validate the approach through extensive experimental analysis, demonstrating how SQL++ captures the capabilities of four major NoSQL query languages and supports advanced features like general outer joins and nested subqueries.

Experimental results

Research questions

  • RQ1How can a query language unify the capabilities of SQL and modern NoSQL query languages while preserving backward compatibility?
  • RQ2What minimal semantic extensions to SQL are required to support full composability and semi-structured data processing?
  • RQ3How can configuration options formally capture the semantic differences between existing NoSQL query languages (e.g., handling of missing attributes, nulls, and grouping behavior)?
  • RQ4To what extent can SQL++ express the full expressive power of prior full-fledged semi-structured query languages like OQL and XQuery?
  • RQ5Can SQL++ serve as a common target language for multiple database systems, abstracting away syntactic and semantic differences across NoSQL query languages?

Key findings

  • SQL++ successfully generalizes SQL by removing semantic restrictions—such as requiring schema or homogeneous data—while retaining full SQL compatibility.
  • The language supports full composability: subqueries can appear anywhere, including in the SELECT clause, enabling nested and heterogeneous result construction.
  • Configuration options allow SQL++ to formally describe the semantics of four major NoSQL query languages (MongoDB, Cassandra CQL, Couchbase N1QL, AsterixDB AQL) through parameterized settings.
  • SQL++ supports advanced features absent in many NoSQL systems, such as LEFT CORRELATE, OUTER FLATTEN, and general outer joins, which are not natively supported in any of the evaluated systems.
  • The language enables seamless handling of heterogeneous and nested data through variable binding to attribute-value pairs and array indices, without requiring UDFs or custom functions.
  • Early adoption signals are strong: Couchbase N1QL version 4 is described as syntactic sugar over SQL++, and Apache Drill is aligning with SQL++, indicating real-world viability and standardization potential.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.