Fall greetings and news from the SQL team

Friends of CockroachDB,

hear, hear, the SQL front-end of CockroachDB has been cleaned up and properly layered.

Summary of the changes:

  • content from sql/parser has been migrated to new packages:
    • sql/coltypes for (storable) column types
    • sql/sem/types for datum (in-memory) types
    • sql/sem/tree for AST/IR nodes, type checking and normalization
    • sql/sem/builtins for the SQL built-in function definitions
    • sql/sem/transforms for the public API of the AST predicate/transform visitors
    • sql/sem/tests for tests that need to break circular dependencies (e.g. type check tests -> parser -> tree)
  • sql.go is now auto-generated - no more merge conflicts on grammar changes!

API changes of notes:

Before After
parser.Type types.T
parser.TypeInt types.Int
parser.ColumnType coltypes.T
parser.IntColType coltypes.TInt
parser.intColTypeInt coltypes.Int
parser.NewDInt tree.NewDInt
parser.Parse parser.Parse (unchanged)

Overview of the new file layout: