-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: refactor builtins package #60547
Copy link
Copy link
Open
Labels
A-sql-builtinsSQL built-in functions and semantics thereof.SQL built-in functions and semantics thereof.C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Description
This is an extension of #60507, the reason we have an InternalExecutor interface in sql/sem/tree/eval.go is for use in the builtins package.
Comment from tree/eval.go
// InternalExecutor gives access to an executor to be used for running
// "internal" statements. It may seem bizarre that "expression evaluation" may
// need to run a statement, and yet many builtin functions do it.
// Note that the executor will be "session-bound" - it will inherit session
// variables from a parent session.
This highlights a larger problem that the builtins package is not structured very well. We have both the syntax/function definition as well as some of the business logic inside the builtins package, specifically builtins.go and pg_builtins.go.
Ideally we should split the logic into a separate package and have the builtins package handle plumbing / delegating the logic downstream.
Right now builtins does too much while being in the sem package
cc @ajwerner
Jira issue: CRDB-3179
Epic CRDB-60948
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-builtinsSQL built-in functions and semantics thereof.SQL built-in functions and semantics thereof.C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)