-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from Matts966/feature/templated-functions
Add AlphaCheck support for templated functions
- Loading branch information
Showing
70 changed files
with
225 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# syntax = docker/dockerfile:experimental | ||
|
||
FROM l.gcr.io/google/bazel:1.0.0 as builder | ||
|
||
# Use gcc because clang can't build m4 | ||
RUN apt-get update && \ | ||
apt-get install build-essential software-properties-common -y && \ | ||
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | ||
apt-get update && \ | ||
# Use gcc-9 for using std::filesystem api | ||
apt-get install --no-install-recommends -y make gcc-9 g++-9 graphviz tzdata && \ | ||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \ | ||
--slave /usr/bin/g++ g++ /usr/bin/g++-9 | ||
ENV CC /usr/bin/gcc | ||
COPY . /work/alphasql | ||
WORKDIR /work/alphasql |
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 @@ | ||
ERROR: INVALID_ARGUMENT: Table not found: datawarehouse2 [at samples/ml/create_input.sql:5:3] |
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,5 @@ | ||
Analyzing "samples/ml/create_input.sql" | ||
catalog: | ||
dataset.main | ||
tablename1 | ||
tablename2 |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/ml/create_input.sql" | ||
Reading "samples/ml/create_model.sql" |
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,10 @@ | ||
CREATE OR REPLACE TABLE input AS | ||
SELECT | ||
x | ||
FROM | ||
datawarehouse2 | ||
UNION ALL | ||
SELECT | ||
x | ||
FROM | ||
datawarehouse3; |
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,7 @@ | ||
CREATE OR REPLACE MODEL `tmp.ml_sample` | ||
OPTIONS | ||
(model_type='linear_reg', input_label_cols=['label']) AS | ||
SELECT | ||
* | ||
FROM | ||
`input`; |
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,5 @@ | ||
digraph G { | ||
0 [label="samples/ml/create_input.sql", shape="", type=query]; | ||
1 [label="samples/ml/create_model.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
datawarehouse2 | ||
datawarehouse3 |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/ml/create_input.sql" | ||
Reading "samples/ml/create_model.sql" |
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,5 @@ | ||
digraph G { | ||
0 [label="samples/ml/create_input.sql", shape="", type=query]; | ||
1 [label="samples/ml/create_model.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
datawarehouse2 | ||
datawarehouse3 |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/ml/create_input.sql" | ||
Reading "samples/ml/create_model.sql" |
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,11 @@ | ||
digraph G { | ||
0 [label="samples/ml/create_input.sql", shape="", type=query]; | ||
1 [label="samples/ml/create_model.sql", shape="", type=query]; | ||
2 [label=datawarehouse2, shape=box, type=table]; | ||
3 [label=datawarehouse3, shape=box, type=table]; | ||
4 [label=input, shape=box, type=table]; | ||
0->4 ; | ||
2->0 ; | ||
3->0 ; | ||
4->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
datawarehouse2 | ||
datawarehouse3 |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/ml/create_input.sql" | ||
Reading "samples/ml/create_model.sql" |
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,11 @@ | ||
digraph G { | ||
0 [label="samples/ml/create_input.sql", shape="", type=query]; | ||
1 [label="samples/ml/create_model.sql", shape="", type=query]; | ||
2 [label=datawarehouse2, shape=box, type=table]; | ||
3 [label=datawarehouse3, shape=box, type=table]; | ||
4 [label=input, shape=box, type=table]; | ||
0->4 ; | ||
2->0 ; | ||
3->0 ; | ||
4->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
datawarehouse2 | ||
datawarehouse3 |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/ml/create_input.sql" | ||
Reading "samples/ml/create_model.sql" |
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,5 @@ | ||
digraph G { | ||
0 [label="samples/ml/create_input.sql", shape="", type=query]; | ||
1 [label="samples/ml/create_model.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
datawarehouse2 | ||
datawarehouse3 |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/ml/create_input.sql" | ||
Reading "samples/ml/create_model.sql" |
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,11 @@ | ||
digraph G { | ||
0 [label="samples/ml/create_input.sql", shape="", type=query]; | ||
1 [label="samples/ml/create_model.sql", shape="", type=query]; | ||
2 [label=datawarehouse2, shape=box, type=table]; | ||
3 [label=datawarehouse3, shape=box, type=table]; | ||
4 [label=input, shape=box, type=table]; | ||
0->4 ; | ||
2->0 ; | ||
3->0 ; | ||
4->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
datawarehouse2 | ||
datawarehouse3 |
Empty file.
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,7 @@ | ||
Analyzing "samples/sample-any-type/dedup.sql" | ||
Create Function Statement analyzed, adding function to catalog... | ||
SUCCESS: analysis finished! | ||
Analyzing "samples/sample-any-type/dedup_count.sql" | ||
Create Function Statement analyzed, adding function to catalog... | ||
SUCCESS: analysis finished! | ||
Successfully finished type check! |
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/sample-any-type/dedup.sql" | ||
Reading "samples/sample-any-type/dedup_count.sql" |
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,5 @@ | ||
digraph G { | ||
0 [label="samples/sample-any-type/dedup.sql", shape="", type=query]; | ||
1 [label="samples/sample-any-type/dedup_count.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
CREATE OR REPLACE FUNCTION dedup (arr ANY TYPE) | ||
AS (( | ||
SELECT IFNULL(ARRAY_AGG(DISTINCT x), []) | ||
FROM UNNEST(arr) x | ||
)); | ||
ASSERT ARRAY_LENGTH(dedup([])) = 0; | ||
ASSERT ARRAY_LENGTH(dedup([1])) = 1; | ||
ASSERT ARRAY_LENGTH(dedup([1, 2])) = 2; | ||
ASSERT ARRAY_LENGTH(dedup([1, 3, 5])) = 3; | ||
ASSERT ARRAY_LENGTH(dedup([1, 3, 3, 5, 5])) = 3; |
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,9 @@ | ||
CREATE OR REPLACE FUNCTION dedup_count(arr ANY TYPE) | ||
AS ( | ||
ARRAY_LENGTH(dedup(arr)) | ||
); | ||
ASSERT dedup_count(ARRAY[]) = 0; | ||
ASSERT dedup_count(ARRAY[1]) = 1; | ||
ASSERT dedup_count(ARRAY[1, 2]) = 2; | ||
ASSERT dedup_count(ARRAY[1, 3, 5]) = 3; | ||
ASSERT dedup_count(ARRAY[1, 3, 3, 5, 5]) = 3; |
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions
4
samples/sample-any-type/side_effect_first/alphadag_stdout.txt
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/sample-any-type/dedup.sql" | ||
Reading "samples/sample-any-type/dedup_count.sql" |
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,5 @@ | ||
digraph G { | ||
0 [label="samples/sample-any-type/dedup.sql", shape="", type=query]; | ||
1 [label="samples/sample-any-type/dedup_count.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions
4
samples/sample-any-type/side_effect_first_with_tables/alphadag_stdout.txt
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/sample-any-type/dedup.sql" | ||
Reading "samples/sample-any-type/dedup_count.sql" |
5 changes: 5 additions & 0 deletions
5
samples/sample-any-type/side_effect_first_with_tables/dag.dot
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,5 @@ | ||
digraph G { | ||
0 [label="samples/sample-any-type/dedup.sql", shape="", type=query]; | ||
1 [label="samples/sample-any-type/dedup_count.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/sample-any-type/dedup.sql" | ||
Reading "samples/sample-any-type/dedup_count.sql" |
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,9 @@ | ||
digraph G { | ||
0 [label="samples/sample-any-type/dedup.sql", shape="", type=query]; | ||
1 [label="samples/sample-any-type/dedup_count.sql", shape="", type=query]; | ||
2 [label=dedup, shape=cds, type=function]; | ||
3 [label=dedup_count, shape=cds, type=function]; | ||
0->2 ; | ||
1->3 ; | ||
2->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/sample-any-type/dedup.sql" | ||
Reading "samples/sample-any-type/dedup_count.sql" |
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,9 @@ | ||
digraph G { | ||
0 [label="samples/sample-any-type/dedup.sql", shape="", type=query]; | ||
1 [label="samples/sample-any-type/dedup_count.sql", shape="", type=query]; | ||
2 [label=dedup, shape=cds, type=function]; | ||
3 [label=dedup_count, shape=cds, type=function]; | ||
0->2 ; | ||
1->3 ; | ||
2->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
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,4 @@ | ||
Reading paths passed as a command line arguments... | ||
Only files that end with .sql or .bq are analyzed. | ||
Reading "samples/sample-any-type/dedup.sql" | ||
Reading "samples/sample-any-type/dedup_count.sql" |
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,5 @@ | ||
digraph G { | ||
0 [label="samples/sample-any-type/dedup.sql", shape="", type=query]; | ||
1 [label="samples/sample-any-type/dedup_count.sql", shape="", type=query]; | ||
0->1 ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.