How Query Engines Work
How Query Engines Work
$19.99
Minimum price
$29.99
Suggested price
How Query Engines Work

This book is 90% complete

Last updated on 2020-05-09

About the Book

Andy Grove has worked on numerous projects that required custom query engines or integrations with existing query engines and this book provides an approachable introduction to the topic.

The book walks through every step of building a SQL query engine in Kotlin with full source code available in a companion github repository. Most of the book is programming language agnostic and Kotlin was chosen for the code examples due to its conciseness and readability. The concepts should be easily translatable to other programming languages.

Andy is a PMC member of Apache Arrow where he donated the initial Rust implementation and also donated the DataFusion query engine.

  • Share this book

  • Feedback

    You must own a copy of this Book to access the forums

    Email the Author(s)

About the Author

Andy Grove
Andy Grove

Andy Grove is a PMC member of Apache Arrow where he donated the initial Rust implementation and also donated the DataFusion query engine.

Table of Contents

  • Acknowledgments
  • Introduction
    • Book Status
    • Feedback
  • 1 What Is a Query Engine?
    • 1.1 Why Are Query Engines Popular?
    • 1.2 What This Book Covers
    • 1.3 Source Code
    • 1.4 Why Kotlin?
  • 2 Ballista
    • 2.1 Overview
    • 2.2 Resources
    • 2.3 Disclaimers
  • 3 Apache Arrow
    • 3.1 Compute Kernels
    • 3.2 Query Engines
    • 3.3 Inter-Process Communication (IPC)
    • 3.4 Arrow Flight Protocol
    • 3.5 Arrow Memory Model
  • 4 Choosing a Type System
    • 4.1 Row-Based or Columnar?
    • 4.2 Interoperability
    • 4.3 Ballista Type System
  • 5 Data Sources
    • 5.1 Data Source Interface
    • 5.2 Data Source Examples
  • 6 Logical Plans & Expressions
    • 6.1 Printing Logical Plans
    • 6.2 Serialization
    • 6.3 Logical Expressions
    • 6.4 Column Expressions
    • 6.5 Literal Expressions
    • 6.6 Binary Expressions
    • 6.7 Comparison Expressions
    • 6.8 Boolean Expressions
    • 6.9 Math Expressions
    • 6.10 Aggregate Expressions
    • 6.11 Logical Plans
    • 6.12 Scan
    • 6.13 Projection
    • 6.14 Selection
    • 6.15 Aggregate
  • 7 Building Logical Plans
    • 7.1 Building Logical Plans The Hard Way
    • 7.2 Building Logical Plans using DataFrames
  • 8 Physical Plans & Expressions
    • 8.1 Physical Expressions
    • 8.2 Column Expressions
    • 8.3 Literal Expressions
    • 8.4 Binary Expressions
    • 8.5 Comparison Expressions
    • 8.6 Math Expressions
    • 8.7 Aggregate Expressions
    • 8.8 Physical Plans
    • 8.9 Scan
    • 8.10 Projection
    • 8.11 Selection
    • 8.12 Hash Aggregate
  • 9 Query Optimizations
    • 9.1 Rule-Based Optimizations
    • 9.2 Projection Push-Down
    • 9.3 Cost-Based Optimizations
  • 10 Query Execution
    • 10.1 Apache Spark Example
    • 10.2 Ballista Examples
    • 10.3 Removing The Query Optimizer
  • 11 SQL Support
    • 11.1 Tokenizer
    • 11.2 Pratt Parser
    • 11.3 Parsing SQL Expressions
    • 11.4 Parsing a SELECT statement
    • 11.5 SQL Query Planner
    • 11.6 Translating SQL Expressions
    • 11.7 Planning SELECT
    • 11.8 Planning for Aggregate Queries
  • 12 Parallel Query Execution
    • 12.1 Combining Results
    • 12.2 Smarter Partitioning
    • 12.3 Partition Keys
  • 13 Distributed Query Execution
    • 13.1 Distributed Resource Scheduling
    • 13.2 Kubernetes Overview
    • 13.3 Serializing a Query Plan
    • 13.4 Serializing Data
    • 13.5 Choosing a Protocol
    • 13.6 Streaming
    • 13.7 Custom Code
    • 13.8 Distributed Query Planning
    • 13.9 Caching Intermediate Results
    • 13.10 Materialized Views
    • 13.11 Stability
  • 14 Testing
    • 14.1 Unit Testing
    • 14.2 Integration Testing
    • 14.3 Fuzzing
  • 15 Benchmarks
    • 15.1 Measuring Performance
    • 15.2 Measuring Scalability
    • 15.3 Concurrency
    • 15.4 Automation
    • 15.5 Comparing Benchmarks
    • 15.6 Publishing Benchmark Results
  • Further Resources
    • Open Source Projects
    • YouTube
    • Sample Data

Authors have earned$9,108,966writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub