refactor: turn Dialect into a per-driver interface#9149
Open
NamanMahor wants to merge 3 commits intomainfrom
Open
refactor: turn Dialect into a per-driver interface#9149NamanMahor wants to merge 3 commits intomainfrom
Dialect into a per-driver interface#9149NamanMahor wants to merge 3 commits intomainfrom
Conversation
Replace the monolithic `Dialect int` enum and its ~900 lines of switch-statement logic in `runtime/drivers/olap.go` with a `Dialect` interface. Move shared default implementations into a new `runtime/pkg/sqldialect` package (Base struct + helpers), and have each OLAP driver own its dialect implementation in a dedicated `dialect.go` file. - `runtime/drivers/olap.go`: replace `Dialect int`/constants/methods with a `Dialect` interface; add `DialectName*` string constants for comparisons - `runtime/pkg/sqldialect/base.go`: `Base` struct with virtual dispatch via a local `Dispatcher` interface (avoids circular import) - `runtime/pkg/sqldialect/helpers.go`: `DruidTimeFloorSpecifier`, `TempName`, `CheckTypeCompatibility` - 11 new `runtime/drivers/*/dialect.go` files, one per driver - All callers updated to use `Dialect().String()` against `DialectName*` constants instead of comparing int values Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the monolithic
Dialect intenum of switch-statement logic inruntime/drivers/olap.gowith aDialectinterface. Move shared default implementations into a newruntime/pkg/sqldialectpackage (Base struct + helpers), and have each OLAP driver own its dialect implementation in a dedicateddialect.gofile.runtime/drivers/olap.go: replaceDialect int/constants/methods with aDialectinterface; addDialectName*string constants for comparisonsruntime/pkg/sqldialect/base.go:Basestruct with virtual dispatch via a localDispatcherinterface (avoids circular import)runtime/pkg/sqldialect/helpers.go:DruidTimeFloorSpecifier,TempName,CheckTypeCompatibilityruntime/drivers/*/dialect.gofiles, one per driverDialect().String()againstDialectName*constants instead of comparing int valuesChecklist: