From 102581e7333701ef37a49af2a99221216bcd7cea Mon Sep 17 00:00:00 2001 From: Evgeny Skvortsov <71790359+EvgSkv@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:47:37 -0800 Subject: [PATCH] Making DuckDB to be the default engine. --- common/logica_lib.py | 5 +++++ common/sqlite3_logica.py | 5 +++++ compiler/universe.py | 2 +- integration_tests/analytic_test.l | 2 ++ integration_tests/arg_min_max_test.l | 2 ++ integration_tests/array_test.l | 2 ++ integration_tests/bulk_functions.l | 2 ++ integration_tests/cast_test.l | 2 ++ integration_tests/chain.l | 2 ++ integration_tests/chain_test.l | 2 ++ integration_tests/closure_test.l | 2 ++ integration_tests/composite_functor_test.l | 2 ++ integration_tests/define_aggregation.l | 2 ++ integration_tests/disjunction_test.l | 2 ++ integration_tests/duckdb_is_default.l | 18 ++++++++++++++++++ integration_tests/duckdb_is_default.txt | 5 +++++ integration_tests/equals_true_test.l | 2 ++ integration_tests/factorial_test.l | 1 + integration_tests/flags_test.l | 2 ++ integration_tests/functor_annotations_test.l | 2 ++ integration_tests/functor_chain_test.l | 2 ++ integration_tests/ground_test.l | 2 ++ integration_tests/if_then.l | 2 ++ integration_tests/import_tests/canada_test.l | 2 ++ integration_tests/import_tests/functor_test.l | 2 ++ .../import_tests/modification_inside.l | 2 ++ integration_tests/in_expr_test.l | 2 ++ integration_tests/long_functor_test.l | 2 ++ integration_tests/modification_inside.l | 2 ++ integration_tests/multi_body_aggregation.l | 2 ++ integration_tests/nested_combines_test.l | 2 ++ integration_tests/no_from_test.l | 2 ++ integration_tests/noinject_test.l | 2 ++ integration_tests/nontrivial_restof_test.l | 2 ++ integration_tests/operation_order_test.l | 2 ++ integration_tests/outer_join.l | 2 ++ integration_tests/outer_join_combine.l | 2 ++ integration_tests/outer_join_disjunction.l | 2 ++ integration_tests/outer_join_some_value.l | 2 ++ integration_tests/outer_join_verbose.l | 2 ++ integration_tests/ppq_test.l | 2 ++ integration_tests/quote_escape_test.l | 2 ++ integration_tests/reachability_test.l | 2 ++ integration_tests/run_tests.py | 2 ++ integration_tests/simple_functors_test.l | 2 ++ integration_tests/single_arg_min.l | 2 ++ integration_tests/sql_expr_test.l | 2 ++ integration_tests/sql_string_table_test.l | 2 ++ integration_tests/sqlite_nil_test.l | 4 ++++ integration_tests/sub_if_test.l | 2 ++ integration_tests/testrun_csv_test.l | 2 ++ integration_tests/udf_test.l | 2 ++ integration_tests/unary_test.l | 2 ++ integration_tests/unnest_order_test.l | 2 ++ integration_tests/with_test.l | 2 ++ 55 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 integration_tests/duckdb_is_default.l create mode 100644 integration_tests/duckdb_is_default.txt diff --git a/common/logica_lib.py b/common/logica_lib.py index ef50b009..c9b2c126 100644 --- a/common/logica_lib.py +++ b/common/logica_lib.py @@ -112,6 +112,11 @@ def RunQuery(sql, '--file=/dev/stdin'] + ['--output-format=ALIGNED'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) + elif engine == 'duckdb': + import duckdb + connection = duckdb.connect() + df = connection.sql(sql).df() + return sqlite3_logica.DataframeAsArtisticTable(df) else: assert False, 'Unknown engine: %s' % engine o, _ = p.communicate(sql.encode()) diff --git a/common/sqlite3_logica.py b/common/sqlite3_logica.py index d8809742..8eee6136 100644 --- a/common/sqlite3_logica.py +++ b/common/sqlite3_logica.py @@ -162,6 +162,11 @@ def WriteFile(filename, content): return 'OK' +def DataframeAsArtisticTable(df): + return ArtisticTable(df.columns, + list(df.itertuples(index=False, name=None))) + + def ArtisticTable(header, rows): """ASCII art table for query output.""" width = [0] * len(header) diff --git a/compiler/universe.py b/compiler/universe.py index 17d209d2..988f643f 100755 --- a/compiler/universe.py +++ b/compiler/universe.py @@ -161,7 +161,7 @@ def __init__(self, rules, user_flags): if 'logica_default_engine' in user_flags: self.default_engine = user_flags['logica_default_engine'] else: - self.default_engine = 'bigquery' + self.default_engine = 'duckdb' self.annotations = self.ExtractAnnotations( rules, restrict_to=['@DefineFlag', '@ResetFlagValue']) diff --git a/integration_tests/analytic_test.l b/integration_tests/analytic_test.l index 098ff16e..7162425d 100755 --- a/integration_tests/analytic_test.l +++ b/integration_tests/analytic_test.l @@ -15,6 +15,8 @@ # Testing analytic functions. +@Engine("bigquery"); + Ten() = x :- x in Range(10); Data("one_five", x, y) :- diff --git a/integration_tests/arg_min_max_test.l b/integration_tests/arg_min_max_test.l index c3013d91..cdaad168 100755 --- a/integration_tests/arg_min_max_test.l +++ b/integration_tests/arg_min_max_test.l @@ -15,6 +15,8 @@ # Testing ArgMax, ArgMin, ArgMaxK and ArgMinK builtins. +@Engine("bigquery"); + Data(v: 10, payload: "a"); Data(v: 5, payload: "b"); Data(v: 20, payload: "c"); diff --git a/integration_tests/array_test.l b/integration_tests/array_test.l index 7666166b..d0156ebf 100755 --- a/integration_tests/array_test.l +++ b/integration_tests/array_test.l @@ -15,6 +15,8 @@ # Testing array creation. +@Engine("bigquery"); + FibonacciArray() = f :- f Array= (n -> ToInt64(Round((1 + 5 ^ 0.5) ^ n / (2 ^ n * 5 ^ 0.5))) :- n in Range(10)); diff --git a/integration_tests/bulk_functions.l b/integration_tests/bulk_functions.l index a97ead10..8d7f8c23 100755 --- a/integration_tests/bulk_functions.l +++ b/integration_tests/bulk_functions.l @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +@Engine("bigquery"); + @OrderBy(Test, "col0"); Test("Tan") = Round(Tan(3.14159265 / 4.0), 3); Test("Least") = Round(Least(Sin(0.5), Sin(0.7), Sin(0.001)), 5); diff --git a/integration_tests/cast_test.l b/integration_tests/cast_test.l index b596f082..bfbe236f 100755 --- a/integration_tests/cast_test.l +++ b/integration_tests/cast_test.l @@ -15,5 +15,7 @@ # Testing Cast function. +@Engine("bigquery"); + T(true); T(Cast(1, "BOOL")); diff --git a/integration_tests/chain.l b/integration_tests/chain.l index cc4f3c35..4a5759c5 100755 --- a/integration_tests/chain.l +++ b/integration_tests/chain.l @@ -16,6 +16,8 @@ # An example of a chain broken due to lack of files. # See chain_test on how to test it. +@Engine("bigquery"); + A("data"); B(x) :- A(x); diff --git a/integration_tests/chain_test.l b/integration_tests/chain_test.l index 897de151..00e60070 100755 --- a/integration_tests/chain_test.l +++ b/integration_tests/chain_test.l @@ -19,6 +19,8 @@ import integration_tests.chain.C; # To connect. import integration_tests.chain.D; # To connect. import integration_tests.chain.F; # To test. +@Engine("bigquery"); + # Mocking data. MockA("mock_data"); diff --git a/integration_tests/closure_test.l b/integration_tests/closure_test.l index a1a5ada0..82e2378e 100644 --- a/integration_tests/closure_test.l +++ b/integration_tests/closure_test.l @@ -1,5 +1,7 @@ import lib.closure.TransitiveClosure; +@Engine("bigquery"); + Friend("Alice", "Bob"); Friend("Bob", "Carrol"); Friend("Bob", "Diana"); diff --git a/integration_tests/composite_functor_test.l b/integration_tests/composite_functor_test.l index 26f7f28d..f2b47aa0 100755 --- a/integration_tests/composite_functor_test.l +++ b/integration_tests/composite_functor_test.l @@ -15,6 +15,8 @@ # Test for composite functor. +@Engine("bigquery"); + Traffic(campaign: 1, cookie: 100, country: "US"); Traffic(campaign: 2, cookie: 200, country: "US"); Traffic(campaign: 3, cookie: 300, country: "US"); diff --git a/integration_tests/define_aggregation.l b/integration_tests/define_aggregation.l index 236f441b..2ad2ac29 100755 --- a/integration_tests/define_aggregation.l +++ b/integration_tests/define_aggregation.l @@ -15,6 +15,8 @@ # Testing custom aggregation functions. +@Engine("bigquery"); + SampledVisit(campaign:"1", person:123); SampledVisit(campaign:"1", person:125); SampledVisit(campaign:"2", person:155); diff --git a/integration_tests/disjunction_test.l b/integration_tests/disjunction_test.l index 128ba068..1d80a591 100755 --- a/integration_tests/disjunction_test.l +++ b/integration_tests/disjunction_test.l @@ -23,6 +23,8 @@ # What day of the week was it? # Source: http://brainden.com/logic-problems.htm +@Engine("bigquery"); + # Note that we can not factor out the logic of (x == "T" | ....) into a helper # function because disjunction is supported only for all-out predicates. @OrderBy(Options, "col0"); diff --git a/integration_tests/duckdb_is_default.l b/integration_tests/duckdb_is_default.l new file mode 100644 index 00000000..229a0184 --- /dev/null +++ b/integration_tests/duckdb_is_default.l @@ -0,0 +1,18 @@ +# +# Copyright 2025 Google LLC +# +# Licensed 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. + +# Only duckdb has UniqueNumber function. +Test(fourty_two? Count= UniqueNumber()) distinct :- + i in Range(42); \ No newline at end of file diff --git a/integration_tests/duckdb_is_default.txt b/integration_tests/duckdb_is_default.txt new file mode 100644 index 00000000..bb5db386 --- /dev/null +++ b/integration_tests/duckdb_is_default.txt @@ -0,0 +1,5 @@ ++------------+ +| fourty_two | ++------------+ +| 42 | ++------------+ \ No newline at end of file diff --git a/integration_tests/equals_true_test.l b/integration_tests/equals_true_test.l index 85c68133..d37c0615 100644 --- a/integration_tests/equals_true_test.l +++ b/integration_tests/equals_true_test.l @@ -1,5 +1,7 @@ # Testing equality of equality to true. +@Engine("bigquery"); + Is5(x) = (x == 5); Test(x) :- Is5(x) == true, x in Range(10); \ No newline at end of file diff --git a/integration_tests/factorial_test.l b/integration_tests/factorial_test.l index ffda4d9f..dfa90de4 100755 --- a/integration_tests/factorial_test.l +++ b/integration_tests/factorial_test.l @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +@Engine("bigquery"); Prod(x) = Exp(Sum(Log(x))); diff --git a/integration_tests/flags_test.l b/integration_tests/flags_test.l index 9f2c7998..c1c330c9 100755 --- a/integration_tests/flags_test.l +++ b/integration_tests/flags_test.l @@ -16,6 +16,8 @@ # Example of running: # yodaql --f=a=my_value flags_test_manual.ydg testrun FlagValues +@Engine("bigquery"); + @DefineFlag("a", "default_value_for_a"); @DefineFlag("b", "default_value_for_b"); @DefineFlag("c", "default_value_for_c"); diff --git a/integration_tests/functor_annotations_test.l b/integration_tests/functor_annotations_test.l index 72abe121..7b706de6 100755 --- a/integration_tests/functor_annotations_test.l +++ b/integration_tests/functor_annotations_test.l @@ -17,6 +17,8 @@ # Predicates are meaningless. Simply creating a deep call stack and calling the # functor. +@Engine("bigquery"); + @Ground(L0); L0() = 0; L1() = L0() + 1; diff --git a/integration_tests/functor_chain_test.l b/integration_tests/functor_chain_test.l index ee0309ad..7c08c8a2 100644 --- a/integration_tests/functor_chain_test.l +++ b/integration_tests/functor_chain_test.l @@ -15,6 +15,8 @@ # Verifying functor call for a chain. +@Engine("bigquery"); + A(0); B(x) :- A(x); C(x) :- B(x); diff --git a/integration_tests/ground_test.l b/integration_tests/ground_test.l index 5385f300..10b76134 100755 --- a/integration_tests/ground_test.l +++ b/integration_tests/ground_test.l @@ -15,6 +15,8 @@ # Testing default ground and grounding a predicate to another. +@Engine("bigquery"); + @Ground(A); A("a"); diff --git a/integration_tests/if_then.l b/integration_tests/if_then.l index 79c20c93..81d4a77d 100755 --- a/integration_tests/if_then.l +++ b/integration_tests/if_then.l @@ -15,6 +15,8 @@ # Testing implication and OrderBy annotation. +@Engine("bigquery"); + N(n1 + n2 * 5 + n3 * 25) :- l == [0,1,2,3,4], n1 in l, n2 in l, n3 in l; Qualify(n) = ( diff --git a/integration_tests/import_tests/canada_test.l b/integration_tests/import_tests/canada_test.l index fb24b692..0d8f9831 100755 --- a/integration_tests/import_tests/canada_test.l +++ b/integration_tests/import_tests/canada_test.l @@ -19,6 +19,8 @@ import integration_tests.import_tests.canada.Consume; import integration_tests.import_tests.canada.ImportCost; import integration_tests.import_tests.canada.DomesticCost; +@Engine("bigquery"); + TestImportFraction() = Format("%.3f", import_cost / (import_cost + domestic_cost)) :- import_cost == ImportCost(), domestic_cost == DomesticCost(); diff --git a/integration_tests/import_tests/functor_test.l b/integration_tests/import_tests/functor_test.l index 342c6a89..9aeb3787 100755 --- a/integration_tests/import_tests/functor_test.l +++ b/integration_tests/import_tests/functor_test.l @@ -15,5 +15,7 @@ import integration_tests.import_tests.new_canada.NewCanadaConsume; +@Engine("bigquery"); + @OrderBy(Test, "col0"); Test(..r) :- NewCanadaConsume(..r); diff --git a/integration_tests/import_tests/modification_inside.l b/integration_tests/import_tests/modification_inside.l index ed2e2ff4..4d60bdb5 100755 --- a/integration_tests/import_tests/modification_inside.l +++ b/integration_tests/import_tests/modification_inside.l @@ -18,6 +18,8 @@ # Main predicate: BetterCountry, which is equal to Country, except for anyone # who wanter have got a new washer and doesn't want a new washer any more. +@Engine("bigquery"); + BetterCountry(better_country) :- Country(country), better_country == MakeCountryBetter(country); diff --git a/integration_tests/in_expr_test.l b/integration_tests/in_expr_test.l index 318be77c..ac171230 100644 --- a/integration_tests/in_expr_test.l +++ b/integration_tests/in_expr_test.l @@ -1,3 +1,5 @@ # Testing 'in' as a classic function. +@Engine("bigquery"); + Test(x, x in [1,2,3]) :- x in Range(10); \ No newline at end of file diff --git a/integration_tests/long_functor_test.l b/integration_tests/long_functor_test.l index e2b38300..c4fae544 100755 --- a/integration_tests/long_functor_test.l +++ b/integration_tests/long_functor_test.l @@ -15,6 +15,8 @@ # Testing a long sequence of Make statements. +@Engine("bigquery"); + S("success"); R(x) :- T(x); diff --git a/integration_tests/modification_inside.l b/integration_tests/modification_inside.l index c590b163..50d1ae85 100755 --- a/integration_tests/modification_inside.l +++ b/integration_tests/modification_inside.l @@ -18,6 +18,8 @@ # Main predicate: BetterCountry, which is equal to Country, except for anyone # who wanted have got a new washer and doesn't want a new washer any more. +@Engine("bigquery"); + @OrderBy(BetterCountry, "col0.name"); BetterCountry(better_country) :- Country(country), diff --git a/integration_tests/multi_body_aggregation.l b/integration_tests/multi_body_aggregation.l index 840575c1..c04cf17b 100755 --- a/integration_tests/multi_body_aggregation.l +++ b/integration_tests/multi_body_aggregation.l @@ -15,6 +15,8 @@ # Tests for multi-body-aggregation. +@Engine("bigquery"); + A() += 1; A() += 2; diff --git a/integration_tests/nested_combines_test.l b/integration_tests/nested_combines_test.l index 1390abbd..ccafc8fc 100755 --- a/integration_tests/nested_combines_test.l +++ b/integration_tests/nested_combines_test.l @@ -15,6 +15,8 @@ # Tests that unified combines don't confuse variables. +@Engine("bigquery"); + A(x, y) :- x == (combine List= t * 2 :- t in y), B(y); B(z) :- z == (combine List= t + 1 :- t in [1,2,3]); diff --git a/integration_tests/no_from_test.l b/integration_tests/no_from_test.l index e2dd3208..94f3b8b5 100755 --- a/integration_tests/no_from_test.l +++ b/integration_tests/no_from_test.l @@ -16,6 +16,8 @@ # Testing that predicates with no 'FROM' clause, but with constraints are # compiled correctly. +@Engine("bigquery"); + A() += 1; Test(x) :- x == "a", x == "b"; diff --git a/integration_tests/noinject_test.l b/integration_tests/noinject_test.l index 3f9f1da1..7f9a0b92 100755 --- a/integration_tests/noinject_test.l +++ b/integration_tests/noinject_test.l @@ -15,6 +15,8 @@ # @NoInject annotation test. +@Engine("bigquery"); + @NoInject(A); A(x + x * x) :- x in [1,2,3]; diff --git a/integration_tests/nontrivial_restof_test.l b/integration_tests/nontrivial_restof_test.l index 2763fafb..f2e78db9 100755 --- a/integration_tests/nontrivial_restof_test.l +++ b/integration_tests/nontrivial_restof_test.l @@ -15,6 +15,8 @@ # Testing non-trivial rest-of field. +@Engine("bigquery"); + T(a: 1, b: 2, c: 3, d: "a"); T(a: 4, b: 5, c: 6, d: "b"); T(a: 7, b: 8, c: 9, d: "c"); diff --git a/integration_tests/operation_order_test.l b/integration_tests/operation_order_test.l index f03ad4df..225b43c4 100755 --- a/integration_tests/operation_order_test.l +++ b/integration_tests/operation_order_test.l @@ -13,4 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. +@Engine("bigquery"); + Test() = 4 / 4 / 4; diff --git a/integration_tests/outer_join.l b/integration_tests/outer_join.l index e14a758c..e7a8d5eb 100755 --- a/integration_tests/outer_join.l +++ b/integration_tests/outer_join.l @@ -15,6 +15,8 @@ # Outer join via mult-body-aggregation rules. +@Engine("bigquery"); + Phones(person: "Peter", phone: "4251112222"); Phones(person: "John", phone: "4251113333"); Emails(person: "John", email: "john@salem.org"); diff --git a/integration_tests/outer_join_combine.l b/integration_tests/outer_join_combine.l index 9c724978..60ebefb1 100755 --- a/integration_tests/outer_join_combine.l +++ b/integration_tests/outer_join_combine.l @@ -15,6 +15,8 @@ # Outer join via combine. +@Engine("bigquery"); + Phones(person: "Peter", phone: "4251112222"); Phones(person: "John", phone: "4251113333"); Emails(person: "John", email: "john@salem.org"); diff --git a/integration_tests/outer_join_disjunction.l b/integration_tests/outer_join_disjunction.l index 08b2fc5e..a2660185 100755 --- a/integration_tests/outer_join_disjunction.l +++ b/integration_tests/outer_join_disjunction.l @@ -15,6 +15,8 @@ # Outer join via disjunction. +@Engine("bigquery"); + Phones(person: "Peter", phone: "4251112222"); Phones(person: "John", phone: "4251113333"); Emails(person: "John", email: "john@salem.org"); diff --git a/integration_tests/outer_join_some_value.l b/integration_tests/outer_join_some_value.l index 88bda523..8a474c12 100755 --- a/integration_tests/outer_join_some_value.l +++ b/integration_tests/outer_join_some_value.l @@ -15,6 +15,8 @@ # Outer join via mult-body-aggregation rules. +@Engine("bigquery"); + Phones(person: "Peter", phone: "4251112222"); Phones(person: "John", phone: "4251113333"); Emails(person: "John", email: "john@salem.org"); diff --git a/integration_tests/outer_join_verbose.l b/integration_tests/outer_join_verbose.l index 037f87ff..a359e91f 100755 --- a/integration_tests/outer_join_verbose.l +++ b/integration_tests/outer_join_verbose.l @@ -15,6 +15,8 @@ # Outer join without mult-body-aggregation. +@Engine("bigquery"); + Phones(person: "Peter", phone: "4251112222"); Phones(person: "John", phone: "4251113333"); Emails(person: "John", email: "john@salem.org"); diff --git a/integration_tests/ppq_test.l b/integration_tests/ppq_test.l index f61a7c4a..b145e6b5 100755 --- a/integration_tests/ppq_test.l +++ b/integration_tests/ppq_test.l @@ -15,6 +15,8 @@ # Test for ++? operator. +@Engine("bigquery"); + Character(full_name: "Toby the dog"); Character(full_name: "Pete the cat"); Character(full_name: "Sharik the dog"); diff --git a/integration_tests/quote_escape_test.l b/integration_tests/quote_escape_test.l index be76c3fd..1d281682 100755 --- a/integration_tests/quote_escape_test.l +++ b/integration_tests/quote_escape_test.l @@ -15,6 +15,8 @@ # This is to test escaping of quotes in command line flags. +@Engine("bigquery"); + @DefineFlag("name", ""); Q(FlagValue("name")); diff --git a/integration_tests/reachability_test.l b/integration_tests/reachability_test.l index 37b64479..574199c9 100644 --- a/integration_tests/reachability_test.l +++ b/integration_tests/reachability_test.l @@ -6,6 +6,8 @@ import lib.reachability.GraphPath; import lib.reachability.GP3; import lib.reachability.GraphDistance; +@Engine("bigquery"); + D(a, a + 1) :- a in Range(100); @OrderBy(P, "col0", "col1"); diff --git a/integration_tests/run_tests.py b/integration_tests/run_tests.py index 9c64ad87..98308423 100755 --- a/integration_tests/run_tests.py +++ b/integration_tests/run_tests.py @@ -65,6 +65,8 @@ def RunAll(test_presto=False, test_trino=False): RunTest("dialects/trino/joins_test") RunTest("dialects/trino/joins_test") + RunTest("duckdb_is_default") + RunTest("bq_plusplus_test") RunTest("sqlite_functors_test") diff --git a/integration_tests/simple_functors_test.l b/integration_tests/simple_functors_test.l index 0fd6af1b..7368f516 100755 --- a/integration_tests/simple_functors_test.l +++ b/integration_tests/simple_functors_test.l @@ -15,6 +15,8 @@ # Simple functor test. +@Engine("bigquery"); + Events1(campaign: 1) :- x in [0, 0, 0]; # 3 events. Events1(campaign: 2) :- x in [0, 0]; # 2 events. Events1(campaign: 3) :- x in [0, 0, 0, 0, 0]; # etc. diff --git a/integration_tests/single_arg_min.l b/integration_tests/single_arg_min.l index 5fbb66aa..d87793d9 100644 --- a/integration_tests/single_arg_min.l +++ b/integration_tests/single_arg_min.l @@ -15,6 +15,8 @@ # Testing that Arg functions work for single rule. +@Engine("bigquery"); + T1() ArgMin= 4->4; T2() ArgMax= 4->4; T3() Aggr= ArgMinK(4->4, 5); diff --git a/integration_tests/sql_expr_test.l b/integration_tests/sql_expr_test.l index bed4bbc8..0cb9218e 100755 --- a/integration_tests/sql_expr_test.l +++ b/integration_tests/sql_expr_test.l @@ -15,6 +15,8 @@ # Testing SqlExpr built-in function. +@Engine("bigquery"); + ExtractHour(datetime) = SqlExpr("EXTRACT(HOUR FROM {datetime})", {datetime:}); diff --git a/integration_tests/sql_string_table_test.l b/integration_tests/sql_string_table_test.l index 22faf8d9..c9b4b9b8 100755 --- a/integration_tests/sql_string_table_test.l +++ b/integration_tests/sql_string_table_test.l @@ -17,4 +17,6 @@ # Please never use it this way. # This feature is provided for Spanner indexes specification. +@Engine("bigquery"); + Test(result) :- `((select "success" as result))`(result:); diff --git a/integration_tests/sqlite_nil_test.l b/integration_tests/sqlite_nil_test.l index ea1e6ada..78e837a1 100644 --- a/integration_tests/sqlite_nil_test.l +++ b/integration_tests/sqlite_nil_test.l @@ -16,6 +16,10 @@ # Testing that recursion works even if some predicates have # no initial condition. +# TODO: Seems like this test is incorrectly named to be sqlite, while +# it's on bigquery. + +@Engine("bigquery"); A() Max= 0; B() Max= A() + 1; A() Max= B() + 1; diff --git a/integration_tests/sub_if_test.l b/integration_tests/sub_if_test.l index 28538c3d..739607dd 100644 --- a/integration_tests/sub_if_test.l +++ b/integration_tests/sub_if_test.l @@ -1,5 +1,7 @@ # Testing subscript of implication optimization. +@Engine("bigquery"); + Test(n, a, b, c) :- n in Range(10), r == ( diff --git a/integration_tests/testrun_csv_test.l b/integration_tests/testrun_csv_test.l index 1eaf27d4..1ba9bf6c 100755 --- a/integration_tests/testrun_csv_test.l +++ b/integration_tests/testrun_csv_test.l @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +@Engine("bigquery"); + # Testing querying of CSVs in testrun mode. @OrderBy(Population, "state"); Population( diff --git a/integration_tests/udf_test.l b/integration_tests/udf_test.l index 3d85c608..9f106600 100755 --- a/integration_tests/udf_test.l +++ b/integration_tests/udf_test.l @@ -15,6 +15,8 @@ # Testing simple function compilation. +@Engine("bigquery"); + # Functors of argument F. GridF(t) = F(t) :- t == s / 100.0 - 5, s in Range(1000); FunctionMinimum() = x :- diff --git a/integration_tests/unary_test.l b/integration_tests/unary_test.l index 2075c7d9..717e2406 100755 --- a/integration_tests/unary_test.l +++ b/integration_tests/unary_test.l @@ -15,6 +15,8 @@ # Testing unary operators ! and -. +@Engine("bigquery"); + Test("not") = ToString(is_small) :- is_small == !is_big, is_big == (x > 5), diff --git a/integration_tests/unnest_order_test.l b/integration_tests/unnest_order_test.l index 07e8c6f7..06e399cc 100755 --- a/integration_tests/unnest_order_test.l +++ b/integration_tests/unnest_order_test.l @@ -15,6 +15,8 @@ # Testing that unnestings are ordered by dependency. +@Engine("bigquery"); + @OrderBy(Test, "col0"); Test(x) :- x in y.a, y in [{a:[1,2,3]}]; Test(x) :- y in [{a:[1,2,3]}], x in y.a; diff --git a/integration_tests/with_test.l b/integration_tests/with_test.l index 4aa0ce65..a8e16f50 100755 --- a/integration_tests/with_test.l +++ b/integration_tests/with_test.l @@ -15,6 +15,8 @@ # Testing 'With' annotation. +@Engine("bigquery"); + @With(Parent); Parent("A", "B"); Parent("B", "C");