Skip to content
master
Switch branches/tags
Code

Latest commit

--
Change by ZetaSQL Team <no-reply@google.com>:
SAFE.REGEXP_* functions now return NULL instead of throwing an error if the regex fails to parse
--
Change by ZetaSQL Team <no-reply@google.com>:
Add collation_list to ResolvedAggregateScanBase
--
Change by ZetaSQL Team <no-reply@google.com>:
Rename TOKENSET type stub to TOKENLIST since the tokens are ordered.
--
Change by ZetaSQL Team <no-reply@google.com>:
Resolve alter actions for adding primary keys.
--
Change by ZetaSQL Team <no-reply@google.com>:
Deal with NULL value in FilterField function.
--
Change by ZetaSQL Team <no-reply@google.com>:
Clean up code.
--
Change by Matthew Brown <matthewbr@google.com>:
Remove 'BaseSavedState' abstract type from local_service implemenation
--
Change by ZetaSQL Team <no-reply@google.com>:
Rename TOKENSET type stub to TOKENLIST since the tokens are ordered.
--
Change by ZetaSQL Team <no-reply@google.com>:
Include whether a primary key is enforced in its debug string.
--
Change by ZetaSQL Team <no-reply@google.com>:
Rename TOKENSET type stub to TOKENLIST since the tokens are ordered.
--
Change by ZetaSQL Team <no-reply@google.com>:
execute_query: Remove dead code in test
--
Change by Matthew Brown <matthewbr@google.com>:
local_service: Remove old descriptor pool support
--
Change by ZetaSQL Team <no-reply@google.com>:
Add basic compliance test framework for scripting
--
Change by ZetaSQL Team <no-reply@google.com>:
Update documentation for JSON_EXTRACT_SCALAR and JSON_VALUE. The second
--
Change by Matthew Brown <matthewbr@google.com>:
Update resolved_ast.md
--
Change by ZetaSQL Team <no-reply@google.com>:
Add date/datetime/time/timestamp parsing with format string in CAST() to the reference implementation.
--
Change by ZetaSQL Team <no-reply@google.com>:
Fix indent of the extra code definitions the same way we do comments.
--
Change by ZetaSQL Team <no-reply@google.com>:
Rename Options class
--
Change by ZetaSQL Team <no-reply@google.com>:
Support empty array as a default argument value.
--
Change by ZetaSQL Team <no-reply@google.com>:
Add SCALAR_RESOLVED_COLLATION type to ResolvedAST. Also add the field resolved_collation to ResolvedOrderByItem.
--
Change by ZetaSQL Team <no-reply@google.com>:
Fix for extra space in front of field comments in resolved_ast.md.
--
Change by ZetaSQL Team <no-reply@google.com>:
Add large floating point CAST tests
--
Change by ZetaSQL Team <no-reply@google.com>:
rename AnnotationKind::COLLATION to kCollation
--
Change by Matthew Brown <matthewbr@google.com>:
Support PreparedExpression with new pools (java)
--
Change by ZetaSQL Team <no-reply@google.com>:
Add `wide_number_mode` argument to PARSE_JSON.
--
Change by ZetaSQL Team <no-reply@google.com>:
Create class NumericalToStringFormatter.
--
Change by ZetaSQL Team <no-reply@google.com>:
Add ARRAY_INCLUDES and ARRAY_INCLUDES_ANY function signatures.
--
Change by ZetaSQL Team <no-reply@google.com>:
Internal change
  (And 33 more changes)

GitOrigin-RevId: aa983ee15a4caaed420408e3e9597219445ce984
Change-Id: Ibb4baa76285ca4ed44fdc3a699be9012431f24a6
dd88318

Git stats

Files

Permalink
Failed to load latest commit information.

ZetaSQL - Analyzer Framework for SQL

ZetaSQL defines a language (grammar, types, data model, and semantics) as well as a parser and analyzer. It is not itself a database or query engine. Instead it is intended to be used by multiple engines wanting to provide consistent behavior for all semantic analysis, name resolution, type checking, implicit casting, etc. Specific query engines may not implement all features in the ZetaSQL language and may give errors if specific features are not supported. For example, engine A may not support any updates and engine B may not support analytic functions.

ZetaSQL Language Guide

ZetaSQL ResolvedAST API

Status of Project and Roadmap

This codebase is being open sourced in multiple phases:

  1. Parser and Analyzer Complete
    • Initial release includes only a subset of tests
  2. Reference Implementation In Progress
    • Base capability Complete
    • Function library In Progress
  3. Compliance Tests Complete
    • includes framework for validating compliance of arbitrary engines
  4. Misc tooling
    • Improved Formatter In Progress

Multiplatform support is planned for the following platforms:

  • Linux (Ubuntu 1804 is our reference platform, but others may work).
  • MacOS (Experimental)
  • Windows (version TDB)

Until all this code is released, we cannot provide any guarantees of API stability and cannot accept contributions. We will also be releasing more documentation over time, particular related to developing engines with this framework. Documentation on the language itself is fairly complete.

Flags

ZetaSQL uses the Abseil Flags library to handle commandline flags. Unless otherwise documented, all flags are for debugging purposes only and may change, stop working or be removed at any time.

How to Build

ZetaSQL uses bazel for building and dependency resolution. After installing bazel (we maintain support for 1.0, but other versions may work), simply run:

bazel build ...

How to add as a Dependency in bazel

See the (WORKSPACE) file, as it is a little unusual.

With docker

TODO: Add docker build script.

Example Usage

A very basic command line tool is available to run simple queries with the reference implementation: bazel run //zetasql/tools/execute_query:execute_query -- "select 1 + 1;"

The reference implementation is not yet completely released and currently supports only a subset of functions and types.

Differential Privacy

For questions, documentation and examples of ZetaSQLs implementation of Differential Privacy, please check out (https://github.com/google/differential-privacy).

Versions

ZetaSQL makes no guarantees regarding compatibility between releases. Breaking changes may be made at any time. Our releases are numbered based on the date of the commit the release is cut from. The number format is YYYY.MM.n, where YYYY is the year, MM is the two digit month, and n is a sequence number within the time period.

License

Apache License 2.0

Support Disclaimer

This is not an officially supported Google product.