You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Lens node does not fully convert the output of a Lens transform to a core.Doc - it only converts the top level document, this means that inner documents cannot properly have post-view stuff done to them (e.g. aggregates, filters, etc).
This has mostly been fixed in #2951 /2951-cached-views (not yet merged), however some problems remain caused by stuff not expecting schema only definitions (e.g. the sum node).
E.g. the below test will fail on the last action (failure depends on branch):
func TestView_OneToManyWithTransformOnOuterAndSum(t *testing.T) {
test := testUtils.TestCase{
Actions: []any{
testUtils.SchemaUpdate{
Schema: `
type Author {
name: String
books: [Book]
}
type Book {
name: String
author: Author
pages: Int
}
`,
},
testUtils.CreateView{
Query: `
Author {
name
books {
name
}
}
`,
SDL: `
type AuthorView @materialized(if: false) {
fullName: String
books: [BookView]
}
interface BookView {
name: String
pages: Int
}
`,
Transform: immutable.Some(model.Lens{
// This transform will copy the value from `name` into the `fullName` field,
// like an overly-complicated alias
Lenses: []model.LensModule{
{
Path: lenses.CopyModulePath,
Arguments: map[string]any{
"src": "name",
"dst": "fullName",
},
},
},
}),
},
testUtils.CreateDoc{
CollectionID: 0,
Doc: `{
"name": "Ferdowsi"
}`,
},
testUtils.CreateDoc{
CollectionID: 1,
DocMap: map[string]any{
"name": "Shahnameh",
"author": testUtils.NewDocIndex(0, 0),
"pages": 10,
},
},
testUtils.Request{
Request: `
query {
AuthorView {
fullName
_sum(books: {field: pages})
}
}
`,
Results: map[string]any{
"AuthorView": []map[string]any{
{
"fullName": "Ferdowsi",
"_sum": 10,
},
},
},
},
},
}
testUtils.ExecuteTestCase(t, test)
}
Please do not pick this up until after #2951 is merged, as a lot of the problem has been solved and the code rewritten.
The text was updated successfully, but these errors were encountered:
The Lens node does not fully convert the output of a Lens transform to a
core.Doc
- it only converts the top level document, this means that inner documents cannot properly have post-view stuff done to them (e.g. aggregates, filters, etc).This has mostly been fixed in #2951 /
2951-cached-views
(not yet merged), however some problems remain caused by stuff not expecting schema only definitions (e.g. the sum node).E.g. the below test will fail on the last action (failure depends on branch):
Please do not pick this up until after #2951 is merged, as a lot of the problem has been solved and the code rewritten.
The text was updated successfully, but these errors were encountered: