-
Notifications
You must be signed in to change notification settings - Fork 81
handle missing fields in SQL as null #7295
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7201500
handle missing fields in SQL as null
mccanne a43bb68
rebase onto dot-fusion-nullish
mccanne f89315d
fix sqlogic test problem that Phil found
mccanne e29c4ce
clarify sfmt dag syntax of nullish dot operator
mccanne d92b1f2
fix some ztests
mccanne 6f28f4a
address PR feedback
mccanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -599,11 +599,11 @@ func liftFilterOps(seq dag.Seq) dag.Seq { | |
| return newErrorMissing() | ||
| } | ||
| // Copy spread so f and y don't share dag.Exprs. | ||
| e, liftOK = addPathToExpr(dag.CopyExpr(spread), this.Chain.Path()) | ||
| e, liftOK = addPathToExpr(dag.CopyExpr(spread), this.Chain) | ||
| return e | ||
| } | ||
| // Copy e1 so f and y don't share dag.Exprs. | ||
| e, liftOK = addPathToExpr(dag.CopyExpr(e1), this.Chain.Path()[1:]) | ||
| e, liftOK = addPathToExpr(dag.CopyExpr(e1), this.Chain[1:]) | ||
| return e | ||
| }) | ||
| if liftOK { | ||
|
|
@@ -644,10 +644,10 @@ func mergeValuesOps(seq dag.Seq) dag.Seq { | |
| if v1TopLevelSpread == nil { | ||
| return newErrorMissing() | ||
| } | ||
| e, mergeOK = addPathToExpr(v1TopLevelSpread, this.Chain.Path()) | ||
| e, mergeOK = addPathToExpr(v1TopLevelSpread, this.Chain) | ||
| return e | ||
| } | ||
| e, mergeOK = addPathToExpr(v1Expr, this.Chain.Path()[1:]) | ||
| e, mergeOK = addPathToExpr(v1Expr, this.Chain[1:]) | ||
| return e | ||
| } | ||
| var mergedOp dag.Op | ||
|
|
@@ -703,8 +703,8 @@ func hasThisWithEmptyPath(v any) bool { | |
| // - It returns a dag.This when possible. | ||
| // - It descends to a dag.RecordExpr.Elem when possible. | ||
| // - It returns false when it cannot descend to a dag.RecordExpr.Elem. | ||
| func addPathToExpr(e dag.Expr, path []string) (dag.Expr, bool) { | ||
| if len(path) == 0 { | ||
| func addPathToExpr(e dag.Expr, chain field.Chain) (dag.Expr, bool) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nits: Rename this to addChainToExpr. And update the doc comment (s/path/chain/g more or less). |
||
| if len(chain) == 0 { | ||
| return e, true | ||
| } | ||
| switch e := e.(type) { | ||
|
|
@@ -713,14 +713,14 @@ func addPathToExpr(e dag.Expr, path []string) (dag.Expr, bool) { | |
| for _, elem := range slices.Backward(e.Elems) { | ||
| switch elem := elem.(type) { | ||
| case *dag.Field: | ||
| if elem.Name != path[0] { | ||
| if elem.Name != chain[0].ID { | ||
| continue | ||
| } | ||
| if spread != nil { | ||
| // Don't know which will win. | ||
| return e, false | ||
| } | ||
| return addPathToExpr(elem.Value, path[1:]) | ||
| return addPathToExpr(elem.Value, chain[1:]) | ||
| case *dag.Spread: | ||
| if spread != nil { | ||
| // Don't know which will win. | ||
|
|
@@ -732,12 +732,12 @@ func addPathToExpr(e dag.Expr, path []string) (dag.Expr, bool) { | |
| if spread == nil { | ||
| return e, false | ||
| } | ||
| return addPathToExpr(spread.Expr, path) | ||
| return addPathToExpr(spread.Expr, chain) | ||
| case *dag.ThisExpr: | ||
| return dag.NewThis(slices.Concat(e.Chain, field.NewChain(path...))), true | ||
| return dag.NewThis(slices.Concat(e.Chain, chain)), true | ||
| } | ||
| for _, elem := range path { | ||
| e = &dag.DotExpr{Kind: "DotExpr", LHS: e, RHS: elem} | ||
| for _, elem := range chain { | ||
| e = &dag.DotExpr{Kind: "DotExpr", LHS: e, RHS: elem.ID, Noneish: elem.Noneish, Nullish: elem.Nullish} | ||
| } | ||
| return e, true | ||
| } | ||
|
|
||
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Don't delete the newline here.