-
Notifications
You must be signed in to change notification settings - Fork 1
Noah/refactor filtering #287
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 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
55fe06d
initial refactor to support a bunch more stuff...
froyo-np 97431bd
update, fight with lodash, fix demo... seems to work
froyo-np 4133cac
fmt
froyo-np e277bda
heavy refactor to avoid type erasure of internal classes of previous
froyo-np 8aa43d9
Merge branch 'main' into noah/refactor-filtering
froyo-np 58644cd
wording updates
froyo-np 9f6014c
lint
froyo-np 17445f2
fmnt
froyo-np 975e3a7
Merge branch 'noah/refactor-filtering' of https://github.com/AllenIns…
froyo-np 393396b
excellent PR feedback, much nonsense removed
froyo-np ea0ef87
a better approach to determining the expected type of a swizzled vector
froyo-np 0243876
fmt
froyo-np 9236c74
lint
froyo-np 144c777
get rid of logger in favor of a returned validation value, and add tests
froyo-np 1403589
fmt
froyo-np ed531f3
struct decl not decl... not sure how that happened...
froyo-np 1141392
fmt
froyo-np 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
|
Collaborator
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. Simple but effective at proving the output looks as expected! Thanks! |
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 |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { describe, expect, test } from 'vitest'; | ||
| import { given } from './query'; | ||
|
|
||
| describe('expression building', () => { | ||
| const tables = { | ||
| cells: { A: 'vec2f', B: 'u32' }, | ||
| edges: { E: 'vec2u', str: 'f32' }, | ||
| } as const; | ||
| const { column, table, clause } = given(tables).from('edges'); | ||
|
|
||
| test('indexing a table with a swizzled vector', () => { | ||
| const f32 = table('cells').at('E.x').dot('A.y'); | ||
| const vec2f = table('cells').at('E.y').dot('A'); | ||
| expect(f32).toEqual({ | ||
| kind: 'table at field', | ||
| table: 'cells', | ||
| atExpr: 'E.x', | ||
| field: 'A.y', | ||
| type: 'f32', | ||
| }); | ||
| expect(vec2f).toEqual({ | ||
| kind: 'table at field', | ||
| table: 'cells', | ||
| atExpr: 'E.y', | ||
| field: 'A', | ||
| type: 'vec2f', | ||
| }); | ||
| }); | ||
| test('simple column reference', () => { | ||
| const u32 = column('E.x'); | ||
| const f32 = column('str'); | ||
| expect(f32).toEqual({ | ||
| kind: 'from field', | ||
| field: 'str', | ||
| from: 'edges', | ||
| type: 'f32', | ||
| }); | ||
| expect(u32).toEqual({ | ||
| kind: 'from field', | ||
| field: 'E.x', | ||
| from: 'edges', | ||
| type: 'u32', | ||
| }); | ||
| }); | ||
| test('nested table index', () => { | ||
| const fancy = table('cells').at(table('cells').at('E.x').dot('B')).dot('A.x'); | ||
| expect(fancy).toEqual({ | ||
| kind: 'table at field', | ||
| table: 'cells', | ||
| atExpr: { | ||
| kind: 'table at field', | ||
| table: 'cells', | ||
| atExpr: 'E.x', | ||
| field: 'B', | ||
| type: 'u32', | ||
| }, | ||
| field: 'A.x', | ||
| type: 'f32', | ||
| }); | ||
| }); | ||
| test('predicate', () => { | ||
| const p = clause(table('cells').at('E.x').dot('A.y'), '==', 'stuff'); | ||
| expect(p.predicates).toHaveLength(1); | ||
| expect(p.predicates[0]).toEqual({ | ||
| kind: 'predicate', | ||
| lhs: { | ||
| kind: 'table at field', | ||
| table: 'cells', | ||
| atExpr: 'E.x', | ||
| field: 'A.y', | ||
| type: 'f32', | ||
| }, | ||
| op: '==', | ||
| rhs: 'stuff', | ||
| }); | ||
| }); | ||
| }); |
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.
Looks like this got reverted somehow 😅
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.
fixed, sorry about that...