forked from hydromatic/morel
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eeaddf
commit c1a890b
Showing
5 changed files
with
357 additions
and
198 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
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,106 @@ | ||
(* | ||
* Licensed to Julian Hyde under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work | ||
* for additional information regarding copyright ownership. | ||
* Julian Hyde licenses this file to you under the Apache | ||
* License, Version 2.0 (the "License"); you may not use this | ||
* file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific | ||
* language governing permissions and limitations under the | ||
* License. | ||
* | ||
* Tests queries that are to execute mostly in Calcite. | ||
*) | ||
|
||
(*) Query in Hybrid mode (100% Calcite) | ||
Sys.set ("hybrid", true); | ||
from e in scott.emp | ||
where e.deptno = 20 | ||
yield e.empno; | ||
Sys.plan(); | ||
(*) Query in Hybrid mode (20% Morel -> 80% Calcite) | ||
from e in (List.filter (fn e2 => e2.empno < 7700) scott.emp) | ||
where e.deptno = 20 | ||
yield e.empno; | ||
Sys.plan(); | ||
(*) Query in Hybrid mode (99% Calcite; there is a variable but it is not | ||
(*) referenced by Calcite code) | ||
let | ||
val twenty = 20 | ||
in | ||
from e in scott.emp | ||
where e.deptno = 20 | ||
yield e.empno | ||
end; | ||
Sys.plan(); | ||
(*) Query in Hybrid mode (90% Calcite; Calcite code references a variable | ||
(*) and an expression from the enclosing environment) | ||
let | ||
val ten = 10 | ||
val deptNos = ten :: 20 :: 30 :: [40] | ||
in | ||
from e in scott.emp | ||
where e.deptno = List.nth (deptNos, 1) | ||
yield e.empno + 13 mod ten | ||
end; | ||
Sys.plan(); | ||
(*) Query in Hybrid mode (90% Calcite; Calcite code references a function | ||
(*) from the enclosing environment) | ||
let | ||
fun double x = x * 2 | ||
in | ||
from d in scott.dept | ||
yield double d.deptno | ||
end; | ||
Sys.plan(); | ||
(*) Simple query with scan, filter, project | ||
from e in scott.emp where e.deptno = 30 yield e.empno; | ||
Sys.plan(); | ||
(*) Equivalent #1; result and plan should be the same | ||
let | ||
val emps = #emp scott | ||
in | ||
from e in emps | ||
where e.deptno = 30 | ||
yield e.empno | ||
end; | ||
Sys.plan(); | ||
(*) Equivalent #2; result and plan should be the same | ||
let | ||
val emps = #emp scott | ||
val thirty = 30 | ||
in | ||
from e in emps | ||
where e.deptno = thirty | ||
yield e.empno | ||
end; | ||
Sys.plan(); | ||
(*) Equivalent #3; result and plan should be the same | ||
map (fn e => (#empno e)) | ||
(List.filter (fn e => (#deptno e) = 30) (#emp scott)); | ||
Sys.plan(); | ||
(*) Union followed by group | ||
(* | ||
from x in (from e in scott.emp yield e.deptno) | ||
union (from d in scott.dept yield d.deptno) | ||
group x compute c = count; | ||
*) | ||
"end"; | ||
(*) End hybrid.sml |
Oops, something went wrong.