Some interesting features include: • A Sawzall script has a single input (a log record) and can output only by emitting to tables. The script can have no other side-effects. • A script can define any number of output tables. Table types include: • collection saves every value emitted • sum saves the sum of every emitted value • maximum(n) saves only the highest n values on a given weight. • In addition, there are several statistical table types that give inexact results. The higher the parameter n, the more accurate the estimates are. • sample(n) gives a random sample of n values from all the emitted values • quantile(n) calculates a cumulative probability distribution of the given numbers. • top(n) gives n values that are probably the most frequent of the emitted values. • unique(n) estimates the number of unique values emitted. Sawzall's design favors efficiency and engine simplicity over power: • Sawzall is statically typed, and the engine compiles the script to
x86 before running it. • Sawzall supports the
compound data types lists, maps, and structs. However, there are no references or pointers. All assignments and function arguments create copies. This means that
recursive data structures and cycles are impossible. • Like C, functions can modify
global variables and
local variables but are not closures. ==Sawzall code==