Zed Language
website·Indexed 33 days ago
https://zed.brimdata.ioA query language for search, analytics, and transformation. The documentation covers the Zed data model, type conventions, and a comprehensive reference of operators, functions, and aggregate functions. It also includes guides for the zq command-line tool, which uses the Zed language for pipeline-style search and analytics.
What's inside Zed
- Zed is a 'super-structured' data model that unifies the relational data model (SQL tables) and the document model (JSON). Unlike traditional tabular models that require a single composite schema for all values, or semi-structured models that require traversing data to discover structure, Zed uses a granular type system where each value expresses its own type. This allows Zed to represent both relational tables and hierarchical documents within a single model, making it a superset of formats such as JSON, BSON, Ion, Avro, ORC, Parquet, CSV, JSON Schema, and XML.
Overview of the Zed Lake Storage Format
v1.6.0The Zed lake storage format is an open specification for organizing eclectic data based on a super-structured type system rather than relational tables. It allows for a universal data representation where relations, schemas, Parquet, Avro, JSON, CSV, and XML are treated as subsets of the Zed type system. All data and metadata in a Zed lake conform to the Zed data model; for example, search indexes are implemented as ZNG files with embedded B-Tree structures.Overview of the Zed Project and Data Model
Zed is a data system based on a "super-structured" data model that allows messy JSON data to be treated with the precision of relational tables while maintaining the flexibility of JSON. The system is built on composable building blocks and self-describing data structures, eliminating the need for external schema registries (like Protobuf) or auxiliary databases (like Hive metastore).Overview of zq command-line tool
v1.7.0zqis a command-line tool that uses the Zed language for pipeline-style search and analytics. It can query data from local files, HTTP/HTTPS URLs, and S3 storage. It is designed to blend the functionality of tools likejq,awk, andgrepwith the database capabilities ofsqliteandduckdb. The tool is most performant when using the Zed-native ZNG format.Overview of zq command-line tool
v1.5.0zqis a command-line tool for processing data in diverse input formats using the Zed language. It allows for pipeline-style search and analytics, blending the approach of tools likejq,awk, andgrepwith embedded databases likesqliteandduckdb. It can query files, HTTP/HTTPS URLs, and S3 storage. The tool is most performant when using the Zed-native ZNG format.Overview of data shaping in Zed
v1.10.0Shaping is the process of cleaning up disparate data sources to fit a well-defined set of schemas. In Zed, this involves converting leaf field types, adding or removing fields, and reordering fields to unify data into a consistent structure.Overview of zq command-line tool
v1.16.0zqis a command-line tool for processing data in diverse input formats using the Zed language. It allows for search, analytics, and transformations via a pipeline-style approach. It can query data from local files, HTTP/HTTPS URLs, S3 storage, or standard input (-). It is optimized for the Zed-native ZNG format.Overview of Zed record operators
v1.11.0Zed provides several operators specifically designed for sequences of records (structured logs or events):
cut: Extract subsets of record fields into new records.drop: Remove specific fields from record values.fuse: Coerce all input values into a single merged type (uniform schema).put: Add or modify fields of records.rename: Change the name of record fields.
Overview of Zed client libraries
Zed provides client libraries for a limited number of languages, allowing developers to manipulate Zed data and interact with a Zed service through its remote API. The project aims to expand support for a broader range of languages and welcomes open-source contributions for new library development.Overview of Zed built-in dataflow operators
v1.10.0Dataflow operators in Zed process a sequence of input values to create an output sequence and serve as the primary components of a dataflow pipeline. In addition to built-in operators, Zed supports user-defined operators.
Commonly used built-in operators include:
assert: Evaluate an assertioncombine: Combine parallel paths into a single outputcut: Extract subsets of record fields into new recordsdrop: Drop fields from record valuesfile: Source data from a filefork: Copy values to parallel pathsfrom: Source data from pools, files, or URIsfuse: Coerce all input values into a merged typeget: Source data from a URIhead: Copy leading values of input sequencejoin: Combine data from two inputs using a join predicateload: Add and commit data to a poolmerge: Combine parallel paths into a single, ordered outputover: Traverse nested values as a lateral querypass: Copy input values to outputput: Add or modify fields of recordsrename: Change the name of record fieldssample: Select one value of each shapesearch: Select values based on a search expressionsort: Sort valuessummarize: Perform aggregationsswitch: Route values based on casestail: Copy trailing values of input sequenceuniq: Deduplicate adjacent valueswhere: Select values based on a Boolean expressionyield: Emit values from expressions
Overview of zq command-line tool
v1.6.0zqis a command-line tool that uses the Zed language for pipeline-style search and analytics. It can query data from local files, HTTP/HTTPS URLs, or S3 storage. It is designed to blend the functionality of tools likejq,awk, andgrepwith the embedded database capabilities ofsqliteandduckdb. It is most performant when using the Zed-native ZNG format.Overview of the ZJSON format
v1.10.0ZJSON is a JSON-based protocol used to serialize Zed data without losing type information or precision (e.g., preventing int64 or timestamp precision loss in JavaScript). A ZJSON stream consists of a sequence of JSON objects, where each object represents a Zed value with the following structure:
{ "type": <type>, "value": <value> }ZJSON files are formatted as newline delimited JSON (NDJSON).