diff --git a/.bazelrc b/.bazelrc index 9cbea588..68ac2a2d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -19,4 +19,4 @@ # c++1z was used prior to c++17 being standardized, and is therefore more # widely accepted by compilers. This may lead to strange behavior or compiler # errors in earlier compilers. -build --cxxopt="-std=c++1z" +build --cxxopt="-std=c++1z" --features=-supports_dynamic_linker diff --git a/.gitignore b/.gitignore index a32ed4be..6ee3c30e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ bazel-* .vscode +.cache diff --git a/WORKSPACE b/WORKSPACE index d525698f..d5536db0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -22,7 +22,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "com_google_zetasql", - commit = "2020.10.1", + commit = "dd883180de6387ad80bcf7534b5aae8191e66621", remote = "https://github.com/google/zetasql", patches = ["@com_github_Matts966_alphasql//bazel:zetasql.patch"], ) diff --git a/alphasql/BUILD b/alphasql/BUILD index 94af46b3..a05a751a 100644 --- a/alphasql/BUILD +++ b/alphasql/BUILD @@ -37,9 +37,10 @@ cc_library( "@com_google_zetasql//zetasql/public:simple_catalog", "@com_google_zetasql//zetasql/public:type", "@com_google_zetasql//zetasql/public:analyzer", + "@com_google_zetasql//zetasql/analyzer:analyzer_impl", + "@com_google_zetasql//zetasql/analyzer:resolver", "@com_google_zetasql//zetasql/public:language_options", "@com_google_zetasql//zetasql/parser:parser", - "@com_google_zetasql//zetasql/analyzer", "@boost//:property_tree", "@com_google_absl//absl/strings", ":table_name_resolver" @@ -71,6 +72,7 @@ cc_binary( "@com_google_zetasql//zetasql/base:status", "@com_google_zetasql//zetasql/base:statusor", "@com_google_zetasql//zetasql/public:analyzer", + "@com_google_zetasql//zetasql/analyzer:analyzer_impl", "@com_google_zetasql//zetasql/public:catalog", "@com_google_zetasql//zetasql/public:evaluator", "@com_google_zetasql//zetasql/public:evaluator_table_iterator", @@ -106,7 +108,7 @@ cc_library( name = "dag_lib", hdrs = ["dag_lib.h"], deps = [ - "@com_google_zetasql//zetasql/analyzer", + "@com_google_zetasql//zetasql/analyzer:analyzer_impl", "@com_google_zetasql//zetasql/resolved_ast", "@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:parse", diff --git a/bazel/zetasql.patch b/bazel/zetasql.patch index 97430e82..de89f0d0 100644 --- a/bazel/zetasql.patch +++ b/bazel/zetasql.patch @@ -1,47 +1,41 @@ +diff --git zetasql/analyzer/BUILD zetasql/analyzer/BUILD +index 91c73c6..57e5609 100644 --- zetasql/analyzer/BUILD +++ zetasql/analyzer/BUILD -@@ -14,7 +14,7 @@ - # limitations under the License. - # +@@ -18,7 +18,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + load(":builddefs.bzl", "gen_analyzer_test") package( - default_visibility = ["//zetasql/base:zetasql_implementation"], + default_visibility = ["//visibility:public"], ) - - cc_library( + filegroup( +diff --git zetasql/base/BUILD zetasql/base/BUILD +index 75c8e3e..7874e07 100644 --- zetasql/base/BUILD +++ zetasql/base/BUILD @@ -17,7 +17,7 @@ licenses(["notice"]) # Apache v2.0 - + package( - default_visibility = [":zetasql_implementation"], + default_visibility = ["//visibility:public"], ) - - package_group( - ---- zetasql/common/BUILD -+++ zetasql/common/BUILD -@@ -14,4 +14,4 @@ - # limitations under the License. - - package( -- default_visibility = ["//zetasql/base:zetasql_implementation"], -+ default_visibility = ["//visibility:public"], + package_group( +diff --git zetasql/parser/BUILD zetasql/parser/BUILD +index 5c3c636..5404163 100644 --- zetasql/parser/BUILD +++ zetasql/parser/BUILD -@@ -17,7 +17,7 @@ load("//bazel:bison.bzl", "genyacc") +@@ -20,7 +20,7 @@ load("//bazel:bison.bzl", "genyacc") load("//bazel:flex.bzl", "genlex") - + package( - default_visibility = ["//zetasql/base:zetasql_implementation"], + default_visibility = ["//visibility:public"], ) - + genrule( --- zetasql/public/simple_catalog.h @@ -59,14 +53,15 @@ // Construct a Catalog with catalog name . // ---- zetasql/resolved_ast/BUILD -+++ zetasql/resolved_ast/BUILD -@@ -16,7 +16,7 @@ - - load("//zetasql/resolved_ast:build_rules.bzl", "gen_resolved_ast_files") - --package(default_visibility = ["//zetasql/base:zetasql_implementation"]) -+package(default_visibility = ["//visibility:public"]) - - py_binary( - name = "gen_resolved_ast", +diff --git zetasql/public/sql_formatter.cc zetasql/public/sql_formatter.cc +index 26e52ed..28e8928 100644 +--- zetasql/public/sql_formatter.cc ++++ zetasql/public/sql_formatter.cc +@@ -72,6 +72,7 @@ absl::Status FormatSql(const std::string& sql, std::string* formatted_sql) { + std::vector parse_tokens; + ParseTokenOptions options; + options.stop_at_end_of_statement = true; ++ options.include_comments = true; + const int statement_start = location.byte_position(); + const absl::Status token_status = + GetParseTokens(options, &location, &parse_tokens); diff --git a/samples/sample-ci/alphacheck_stdout.txt b/samples/sample-ci/alphacheck_stdout.txt index 174dc736..1ea0cbdb 100644 --- a/samples/sample-ci/alphacheck_stdout.txt +++ b/samples/sample-ci/alphacheck_stdout.txt @@ -1,6 +1,6 @@ Analyzing "samples/sample-ci/sample/create_datawarehouse3.sql" ERROR: INVALID_ARGUMENT: Table not found: `bigquery-public-data.samples.gsod` [at samples/sample-ci/sample/create_datawarehouse3.sql:5:3] catalog: - dataset.main tablename2 + dataset.main tablename1