-
Notifications
You must be signed in to change notification settings - Fork 15
support for Values keyword #1000
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
base: main
Are you sure you want to change the base?
Conversation
naronchen
left a comment
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.
WIP
| } | ||
| case Exp::Type::SqlColumnName: | ||
| { | ||
| NativeSqlBuilder sqlSnippet; |
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.
i can also just append the resolved path here?
bc6d03f to
596e534
Compare
| } | ||
| } | ||
|
|
||
| TEST_F(ECSqlStatementTestFixture, ValuesClauseTest) { |
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.
Here is some test we should add in this PR
SELECT column1, column2 FROM (VALUES(1,2)) UNION SELECT column1, column2 FROM (VALUES(3,4));SELECT * FROM (SELECT column1 a, column2 b FROM (VALUES(1,2)))SELECT * FROM (VALUES(1,2)) a, (VALUES(2,3)) bSELECT * FROM (VALUES(1,2)) a, (VALUES(2,3)) b WHERE a.Column2=2SELECT * FROM (VALUES(?,?),(?,?)) abind parameter and test
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.
report this as issue for future work
I also noted that following, but column1_1 or column2_1 cannot be accessed in WHERE clause instead we have to use b.column1 and b.column2 to access it.
iModelConsole> SELECT * FROM (VALUES(1,2)) a, (VALUES(2,3)) b;
column1 |column2 |column1_1 |column2_1
---------------------------------------------------------------------------
1 |2 |2 |3
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.
This should be fixed in this PR.
There is no type checking e.g. Normally if a user uses a different type for the same column in different rows and its constant literal then we should fail if the type is different.
iModelConsole> .metadata SELECT * FROM (VALUES('dd',2),('333',4)) a;
Column metadata
===============
Index Name/PropertyPath DisplayLabel System Type Root class Root class alias
------------------------------------------------------------------------------------------------------------------------------------------------------------------
0 column1 column1 no String generated
1 column2 column2 no Long generated
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.
There is no type checking e.g. Normally if a user uses a different type for the same column in different rows and its constant literal then we should fail if the type is different.
I checked this in SQLite playground and SELECT * FROM (VALUES('dd',2),('333',4)) a; query passes on 4 different playgrounds.
SQLite uses dynamic typing and a concept called type affinity. This means that even if you declare a column to be of a certain type (e.g., INTEGER), SQLite will not strictly enforce it. You can insert different types (e.g., string, float, blob) into that column without errors.
khanaffan
left a comment
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.
I added few mandory work that include add test and validate type of constant literal provided as values if more than one row is specified.
#897