-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ANTLR only allow traversal on certain expressions (#26068)
## Summary & Motivation We discovered some ambiguity caused by traversal expressions that may cause parser to return an unexpected asset selection. For example, currently the parser reads `*key:a and key:b*` as `*(key:a and key:b)*`. We believe this is unintuitive, so we've decided to force the traversal tokens to only apply to the expression they are immediately next to.
- Loading branch information
Showing
16 changed files
with
1,239 additions
and
942 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -18,7 +18,7 @@ const TEST_GRAPH: AssetGraphQueryItem[] = [ | |
owners: [buildUserAssetOwner({email: '[email protected]'})], | ||
}), | ||
inputs: [{dependsOn: []}], | ||
outputs: [{dependedBy: [{solid: {name: 'B'}}]}], | ||
outputs: [{dependedBy: [{solid: {name: 'B'}}, {solid: {name: 'B2'}}]}], | ||
}, | ||
// Second Layer | ||
{ | ||
|
@@ -30,7 +30,12 @@ const TEST_GRAPH: AssetGraphQueryItem[] = [ | |
inputs: [{dependsOn: [{solid: {name: 'A'}}]}], | ||
outputs: [{dependedBy: [{solid: {name: 'C'}}]}], | ||
}, | ||
|
||
{ | ||
name: 'B2', | ||
node: buildAssetNode(), | ||
inputs: [{dependsOn: [{solid: {name: 'A'}}]}], | ||
outputs: [{dependedBy: [{solid: {name: 'C'}}]}], | ||
}, | ||
// Third Layer | ||
{ | ||
name: 'C', | ||
|
@@ -41,7 +46,7 @@ const TEST_GRAPH: AssetGraphQueryItem[] = [ | |
location: buildRepositoryLocation({name: 'my_location'}), | ||
}), | ||
}), | ||
inputs: [{dependsOn: [{solid: {name: 'B'}}]}], | ||
inputs: [{dependsOn: [{solid: {name: 'B'}}, {solid: {name: 'B2'}}]}], | ||
outputs: [{dependedBy: []}], | ||
}, | ||
]; | ||
|
@@ -74,7 +79,7 @@ describe('parseAssetSelectionQuery', () => { | |
|
||
describe('valid queries', () => { | ||
it('should parse star query', () => { | ||
assertQueryResult('*', ['A', 'B', 'C']); | ||
assertQueryResult('*', ['A', 'B', 'B2', 'C']); | ||
}); | ||
|
||
it('should parse key query', () => { | ||
|
@@ -99,25 +104,34 @@ describe('parseAssetSelectionQuery', () => { | |
it('should parse upstream plus query', () => { | ||
assertQueryResult('+key:A', ['A']); | ||
assertQueryResult('+key:B', ['A', 'B']); | ||
assertQueryResult('++key:C', ['A', 'B', 'C']); | ||
assertQueryResult('+key:C', ['B', 'B2', 'C']); | ||
assertQueryResult('++key:C', ['A', 'B', 'B2', 'C']); | ||
}); | ||
|
||
it('should parse downstream plus query', () => { | ||
assertQueryResult('key:A+', ['A', 'B', 'B2']); | ||
assertQueryResult('key:A++', ['A', 'B', 'B2', 'C']); | ||
assertQueryResult('key:C+', ['C']); | ||
assertQueryResult('key:B+', ['B', 'C']); | ||
assertQueryResult('key:A++', ['A', 'B', 'C']); | ||
}); | ||
|
||
it('should parse upstream star query', () => { | ||
assertQueryResult('*key:A', ['A']); | ||
assertQueryResult('*key:B', ['A', 'B']); | ||
assertQueryResult('**key:C', ['A', 'B', 'C']); | ||
assertQueryResult('*key:C', ['A', 'B', 'B2', 'C']); | ||
}); | ||
|
||
it('should parse downstream star query', () => { | ||
assertQueryResult('key:C*', ['C']); | ||
assertQueryResult('key:A*', ['A', 'B', 'B2', 'C']); | ||
assertQueryResult('key:B*', ['B', 'C']); | ||
assertQueryResult('key:A**', ['A', 'B', 'C']); | ||
assertQueryResult('key:C*', ['C']); | ||
}); | ||
|
||
it('should parse up and down traversal queries', () => { | ||
assertQueryResult('key:A* and *key:C', ['A', 'B', 'B2', 'C']); | ||
assertQueryResult('*key:B*', ['A', 'B', 'C']); | ||
assertQueryResult('key:A* and *key:C and *key:B*', ['A', 'B', 'C']); | ||
assertQueryResult('key:A* and *key:B* and *key:C', ['A', 'B', 'C']); | ||
}); | ||
|
||
it('should parse sinks query', () => { | ||
|
3 changes: 2 additions & 1 deletion
3
js_modules/dagster-ui/packages/ui-core/src/asset-selection/generated/AssetSelection.interp
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
js_modules/dagster-ui/packages/ui-core/src/asset-selection/generated/AssetSelectionLexer.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
616f81a
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.
Deploy preview for dagit-core-storybook ready!
✅ Preview
https://dagit-core-storybook-l33jt6d7d-elementl.vercel.app
Built with commit 616f81a.
This pull request is being automatically deployed with vercel-action