Skip to main content
QUICK 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 Queries被引用 25
一句话总结

本文提出 SQL++,一种统一且可配置的查询语言,扩展了 SQL 以原生支持半结构化数据(如 JSON),同时保持完整的向后兼容性。通过消除 SQL 的关键语义限制,并引入最小且有针对性的扩展(如对属性-值对和数组索引的变量绑定),SQL++ 实现了类似 OQL 和 XQuery 的完整组合性与表达能力,并通过配置选项与现有 NoSQL 查询语言建立正式映射。

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

研究动机与目标

  • 解决现代 NoSQL 查询语言缺乏正式、统一语义的问题,这阻碍了深入理解与互操作性。
  • 设计一种支持半结构化数据(如 JSON)的查询语言,同时不牺牲 SQL 兼容性或强制要求模式约束。
  • 提供一个正式且可扩展的框架,可通过配置选项描述多种查询语言(如 MongoDB、N1QL、AQL)的语义。
  • 通过将 SQL 语义泛化以支持嵌套、异构及基于集合的数据结构,实现 SQL 与 NoSQL 能力的无缝集成。
  • 作为中间件和数据库系统的统一目标语言,减少开发者学习多种查询语言变体的需求。

提出的方法

  • 定义一个 SQL++ 数据模型,该模型是 JSON 和 SQL 关系模型的超集,支持数组、集合以及增强的原子值。
  • 通过移除 SQL 的关键语义限制来扩展 SQL:FROM 变量可绑定到任意 JSON 元素(而不仅限于元组),子查询完全可组合,分组结构可直接用于嵌套查询。
  • 引入新的绑定结构,使 FROM 变量可遍历属性名称/值及数组索引/元素,从而实现无模式的数据检查。
  • 采用分阶段方法形式化 SQL++ 语义:先定义核心 SQL++ 语言,再通过配置选项参数化行为差异(如空值与缺失值的处理)。
  • 利用配置选项正式映射 SQL++ 到现有查询语言(如 MongoDB、N1QL、AQL、Cassandra CQL),表明 SQL++ 可通过参数设置转化为它们的语义。
  • 通过广泛的实验分析验证该方法,证明 SQL++ 能够捕捉四种主流 NoSQL 查询语言的功能,并支持高级特性,如通用外连接和嵌套子查询。

实验结果

研究问题

  • RQ1如何设计一种查询语言,统一 SQL 与现代 NoSQL 查询语言的能力,同时保持向后兼容性?
  • RQ2为实现完整组合性与半结构化数据处理,对 SQL 所需的最小语义扩展是什么?
  • RQ3如何通过配置选项正式捕捉现有 NoSQL 查询语言之间的语义差异(如缺失属性、空值及分组行为的处理)?
  • RQ4SQL++ 在多大程度上能够表达 OQL 和 XQuery 等完整半结构化查询语言的全部表达能力?
  • RQ5SQL++ 是否可作为多个数据库系统的通用目标语言,抽象出 NoSQL 查询语言之间的语法与语义差异?

主要发现

  • SQL++ 通过消除语义限制(如要求模式或同质数据)成功泛化了 SQL,同时保持了完整的 SQL 兼容性。
  • 该语言支持完整组合性:子查询可出现在任意位置,包括 SELECT 子句中,从而支持嵌套和异构结果的构建。
  • 通过参数化设置,配置选项使 SQL++ 能够正式描述四种主流 NoSQL 查询语言(MongoDB、Cassandra CQL、Couchbase N1QL、AsterixDB AQL)的语义。
  • SQL++ 支持许多 NoSQL 系统中缺失的高级特性,如 LEFT CORRELATE、OUTER FLATTEN 和通用外连接,这些在所评估的系统中均无原生支持。
  • 通过将变量绑定到属性-值对和数组索引,该语言实现了对异构和嵌套数据的无缝处理,无需用户自定义函数或 UDF。
  • 早期采用迹象强烈:Couchbase N1QL 版本 4 被描述为 SQL++ 的语法糖,Apache Drill 正在与 SQL++ 对齐,表明其具备实际可行性与标准化潜力。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。