query

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &charm.Spec{
	Name:        "query",
	Usage:       "query [ options ] [ zed-query ] file [ file ... ]",
	Short:       "apply Zed queries to data files or streams",
	HiddenFlags: "cpuprofile,memprofile,pathregexp",
	Long: `
"zed query" is a command for searching and analyzing data using the Zed language
(including the experimental SQL subset embedded in the Zed language).
If you have installed the shortcuts, "zq" is a shortcut for the "zed query" command.

"zed query" applies boolean logic
to filter each input value, optionally computes analytics and transformations,
and writes its output to one or more files or standard output.

"zed query" must be run with at least one input file specified.  Input files can
be file system paths; "-" for standard input; or HTTP, HTTPS, or S3 URLs.
Output is sent to standard output unless a -o or -d argument is provided, in
which case output is sent to the indicated file comforming to the type implied
by the extension (unless -f explicitly indicates the output type).

Supported input formats include CSV, JSON, NDJSON, Parquet,
ZSON, ZNG, ZST, and Zeek TSV.  Supported output formats include
all the input formats along with text and tabular formats.

For most formats, the input file format is inferred from the data.  If multiple files are
specified, each file format is determined independently so you can mix and
match input types.  If multiple files are concatenated into a stream and
presented as standard input, the files must all be of the same type as the
beginning of stream will determine the format.

The output format is binary ZNG by default, but can be overridden with -f.

After the options, a Zed "query" string may be specified as a
single argument conforming to the Zed language syntax;
i.e., it should be quoted as a single string in the shell.

If the first argument is a path to a valid file rather than a Zed query,
then the Zed query is assumed to be "*", i.e., match and output all
of the input.  If the first argument is both a valid Zed query
and an existing file, then the file overrides.

The Zed query text may include files using -I, which is particularly
convenient when a large, complex query spans multiple lines.  In this case,
these Zed files are concatenated together along with the command-line Zed query text
in the order appearing on the command-line.

See the Zed source repository for more information:

https://github.com/brimdata/zed
`,
	New: New,
}

Functions

func New

func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error)

func ParseSourcesAndInputs

func ParseSourcesAndInputs(paths, includes Includes) ([]string, ast.Proc, error)

func PrintStats

func PrintStats(stats zbuf.ScannerStats)

Types

type Command

type Command struct {
	*root.Command
	// contains filtered or unexported fields
}

func (*Command) Run

func (c *Command) Run(args []string) error

type Includes

type Includes []string

func (Includes) Read

func (i Includes) Read() ([]string, error)

func (*Includes) Set

func (i *Includes) Set(value string) error

func (Includes) String

func (i Includes) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL