ArticleslgStudy

computer science

Sawzall (programming language)

Sawzall (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Sawzall (programming language) rather than just read about it. In short: Sawzall is a procedural domain-specific programming language, used by Google to process large numbers of individual log records. Sawzall was first described in 2003, and the szl runtime was open-sourced in August 2010.

Key takeaways

  • Sawzall (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Sawzall (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Sawzall (programming language) from memory before moving on to harder problems.

Reference excerpt

Sawzall is a procedural domain-specific programming language, used by Google to process large numbers of individual log records. Sawzall was first described in 2003, and the szl runtime was open-sourced in August 2010. However, since the MapReduce table aggregators have not been released, the open-sourced runtime is not useful for large-scale data analysis of multiple log files off the shelf. Sawzall has been replaced by Lingo (logs in Go) for most purposes within Google.

Motivation Google's server logs are stored as large collections of records (Protocol Buffers) that are partitioned over many disks within GFS. In order to perform calculations involving the logs, engineers can write MapReduce programs in C++ or Java. MapReduce programs need to be compiled and may be more verbose than necessary, so writing a program to analyze the logs can be time-consuming. To make it easier to write quick scripts, Rob Pike et al. developed the Sawzall language. A Sawzall script runs within the Map phase of a MapReduce and "emits" values to tables. Then the Reduce phase (which the script writer does not have to be concerned about) aggregates the tables from multiple runs into a single set of tables. Currently, only the language runtime (which runs a Sawzall script once over a single input) has been open-sourced; the supporting program built on MapReduce has not been released.

Features 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 This complete Sawzall program will read the input and produce three results: the number of records, the sum of the values, and the sum of the squares of the values.

count: table sum of int; total: table sum of float; sum_of_squares: table sum of float; x: float = input; emit count <- 1; emit total <- x; emit sum_of_squares <- x * x;

See also Pig – similar tool and language for use with Apache Hadoop Sawmill (software)

References

Further reading S. Ghemawat, H. Gobioff, S.-T. Leung, The Google file system, in: 19th ACM Symposium on Operating Systems Principles, Proceedings, 17 ACM Press, 2003, pp. 29–43.

External links Google Code Archive - Long-term storage for Google Code Project Hosting. MapReduce

Worked examples

Example 1 — a first encounter with Sawzall (programming language)

Start with the simplest possible case. Write down what Sawzall (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Sawzall (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Sawzall (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Sawzall (programming language)

In research
Sawzall (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Sawzall (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Sawzall (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Domain-specific programming languages, Google software, Procedural programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for Sawzall (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Sawzall (programming language)” →

How to study Sawzall (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Sawzall (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Sawzall (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Sawzall (programming language) in simple terms?

Sawzall is a procedural domain-specific programming language, used by Google to process large numbers of individual log records. Sawzall was first described in 2003, and the szl runtime was open-sourced in August 2010.

Why does Sawzall (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Sawzall (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Sawzall (programming language).

Tags

  • Domain-specific programming languages
  • Google software
  • Procedural programming languages
  • Programming languages created in 2003
  • Software using the Apache license

Keep exploring