optgen/

directory
v0.0.0-...-e065498 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: Apache-2.0

README

Optgen

Optgen is a small setup for generating analyzer code from templates derived from cockroachdb's optgen.

Usage:

$ go install ./optgen/cmd/optgen
$ go generate ./...

The bulk of analyzer logic is normalization rules, join ordering transforms, and execution specific code. Analyzer expressions are mostly boilerplate, and specific normalization rules and join transforms only need types, fields, and literal values to manipulate logical query plans.

Leaning into templates and this harness can reduce code footprint and standardize optimizer nodes when the opportunities arise.

If we end up using more of cockroach DB's optimizer, they codegen their expressions, normalization rules, exploration rules, and execution code stem from this general setup.

Generators

AggGen: sql package unary aggregate expression definitions.

FrameGen: plan package nodes that implement sql.WindowFrame.

FrameFactoryGen: parse package function NewFrame that coverts ast.Frameinto a sql.WindowFrame definitions from plan.

FramerGen: sql package sql.WindowFramer implementations and NewFramer function that converts a plan.WindowFrame into sql.WindowFramer implementations.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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