Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor col defaults #1932

Closed

Conversation

max-hoffman
Copy link
Contributor

@max-hoffman max-hoffman commented Aug 9, 2023

Dolt column defaults work differently than GMS's. This inlines resolving column defaults during name resolution to get closer to Dolt's desired behavior.

parsed, err := planbuilder.Parse(ctx, e.Analyzer.Catalog, query)
if err != nil {
err2 := clearAutocommitTransaction(ctx)
if err2 != nil {
err = errors.Wrap(err, "unable to clear autocommit transaction: "+err2.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to return an err from here directly rather than letting happen by code outside the block

Same comment on the lines below

@@ -362,14 +363,15 @@ func injectBindVarsAndPrepare(
) (string, map[string]*querypb.BindVariable, error) {
parsed, err := sqlparser.Parse(q)
if err != nil {
return q, nil, err
return q, nil, sql.ErrSyntaxError.New(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this wrapping necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some error tests expected this errors.Kind. I could also change the tests

enginetest/evaluation.go Show resolved Hide resolved
@@ -178,6 +178,11 @@ type PrimaryKeySchemaTarget interface {
WithPrimaryKeySchema(schema PrimaryKeySchema) (Node, error)
}

type DynamicColumnsTable interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a comment, same with method names

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also give this a boolean HasDynamicColumns() bool to make it clearer as a marker interface

@Hydrocharged Hydrocharged deleted the max/refactor-col-defaults branch August 24, 2023 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants