This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hdbdd artifacts now process and create views (#1473)
* Hdbdd views initial commit * Parsing hdbdd views sucessfully * Regenerated antlr4 files * Added missing cds tokens for not equal to and concatenation * Fixing sonar code smells and bugs * Reverted hdb engine sync facade changes * Adding missing hdbdd tests * Fixing sonar bugs and code smells * Moved cds tokens to a separate lexer grammar for better readablity * Added more tests * Remove unnecessary code
- Loading branch information
1 parent
1849eac
commit 0810cc7
Showing
94 changed files
with
6,874 additions
and
2,404 deletions.
There are no files selected for viewing
266 changes: 167 additions & 99 deletions
266
...ion-tests/engine-hdb/src/test/java/com/sap/xsk/hdb/ds/itest/hdbdd/XSKHDBDDHanaITTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
...ts/engine-hdb/src/test/resources/registry/public/itest/EmployeesWithViewDefinitions.hdbdd
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
namespace itest; | ||
|
||
@Schema: 'TEST_SCHEMA' | ||
|
||
context EmployeesWithViewDefinitions { | ||
|
||
entity employees { | ||
key ID : String(32); | ||
NAME : String(500); | ||
ADDRESS : String(5000); | ||
AGE : Integer; | ||
PHONE : String(200); | ||
}; | ||
|
||
entity employee_roles { | ||
key ID : String(32); | ||
TYPE : String(500); | ||
}; | ||
|
||
entity employee_salaries { | ||
key ID : String(32); | ||
AMOUNT : String(500); | ||
}; | ||
|
||
// Basic view definition | ||
define view employees_view_basic as | ||
select from "itest::EmployeesWithViewDefinitions.employees" as EMP | ||
{ | ||
"EMP"."ID" as "EmployeeID", | ||
"EMP"."NAME" as "EmployeeName", | ||
"EMP"."ADDRESS" as "EmployeeAddress", | ||
"EMP"."AGE" as "EmployeeAge", | ||
"EMP"."PHONE" as "EmployeePhone" | ||
}; | ||
|
||
// View definition with join statements | ||
define view employees_view_with_join as | ||
select from "itest::EmployeesWithViewDefinitions.employees" | ||
join employee_roles as ER | ||
on "ER"."ID" = "itest::EmployeesWithViewDefinitions.employees"."ID" | ||
join employee_salaries as ES | ||
on "ES"."ID" = "itest::EmployeesWithViewDefinitions.employees"."ID" | ||
{ | ||
"itest::EmployeesWithViewDefinitions.employees"."ID" as "EmployeeId", | ||
"itest::EmployeesWithViewDefinitions.employees"."NAME" as "EmployeeName", | ||
"ER"."TYPE" as "EmployeeRoleType", | ||
"ES"."AMOUNT" as "EmployeeSalary" | ||
}; | ||
|
||
// View definition with where statements | ||
define view employees_view_with_where as | ||
select from "itest::EmployeesWithViewDefinitions.employees" | ||
join employee_roles as ER | ||
on "ER"."ID" = "itest::EmployeesWithViewDefinitions.employees"."ID" | ||
join employee_salaries as ES | ||
on "ES"."ID" = "itest::EmployeesWithViewDefinitions.employees"."ID" | ||
{ | ||
"itest::EmployeesWithViewDefinitions.employees"."ID" as "EmployeeId", | ||
"itest::EmployeesWithViewDefinitions.employees"."NAME" as "EmployeeName", | ||
"ER"."TYPE" as "EmployeeRoleType", | ||
"ES"."AMOUNT" as "EmployeeSalary" | ||
} | ||
where "itest::EmployeesWithViewDefinitions.employees"."NAME" = 'John'; | ||
|
||
// View definition with union statements and dummy table | ||
define view employees_view_with_union as | ||
select from "itest::EmployeesWithViewDefinitions.employees" | ||
join employee_roles as ER | ||
on "ER"."ID" = "itest::EmployeesWithViewDefinitions.employees"."ID" | ||
join employee_salaries as ES | ||
on "ES"."ID" = "itest::EmployeesWithViewDefinitions.employees"."ID" | ||
{ | ||
"itest::EmployeesWithViewDefinitions.employees"."ID" as "EmployeeId", | ||
"itest::EmployeesWithViewDefinitions.employees"."NAME" as "EmployeeName", | ||
"ER"."TYPE" as "EmployeeRoleType", | ||
"ES"."AMOUNT" as "EmployeeSalary" | ||
} | ||
where "itest::EmployeesWithViewDefinitions.employees"."NAME" = 'John' | ||
union | ||
select from DUMMY | ||
{ | ||
0 as "EmployeeId", | ||
'Ben' as "EmployeeName", | ||
'Developer' as "EmployeeRoleType", | ||
'2200' as "EmployeeSalary" | ||
}; | ||
} |
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
Oops, something went wrong.