Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzing statements with Procedures failed #95

Open
Matts966 opened this issue Mar 27, 2022 · 4 comments
Open

Analyzing statements with Procedures failed #95

Matts966 opened this issue Mar 27, 2022 · 4 comments

Comments

@Matts966
Copy link

We instantiate Procedure like

    Procedure *proc = new Procedure(create_procedure_stmt->name_path(), create_procedure_stmt->signature());
    catalog->AddOwnedProcedure(proc);

and analyze statements with AnalyzeStatementFromParserAST.

AnalyzeStatementFromParserAST fails with something like

CREATE OR REPLACE PROCEDURE create_datawarehouse3()
BEGIN
  CREATE OR REPLACE TABLE datawarehouse3 AS
  SELECT
    x
  FROM
    dataset.main;
END;

create_datawarehouse3();
// -> 2022-03-27 15:33:25  FATAL  function_signature.cc : 496 : Check failed: kind == ARG_TYPE_FIXED == type != nullptr (1 vs. 0) 

Our workaround is patching like

diff --git zetasql/public/function_signature.cc zetasql/public/function_signature.cc
index bca4494..707ea2e 100644
--- zetasql/public/function_signature.cc
+++ zetasql/public/function_signature.cc
@@ -493,7 +493,6 @@ FunctionArgumentType::FunctionArgumentType(
       num_occurrences_(num_occurrences),
       type_(type),
       options_(options) {
-  ZETASQL_DCHECK_EQ(kind == ARG_TYPE_FIXED, type != nullptr);
 }

 FunctionArgumentType::FunctionArgumentType(SignatureArgumentKind kind,

for now.

Is there any better way to handle this issue?
For example, is ignoring runtime errors of *DCHECK* possible?

@jshute111
Copy link

jshute111 commented Mar 28, 2022 via email

@Matts966
Copy link
Author

Thank you :) We use analyzer like below.

https://github.com/Matts966/alphasql/blob/883272aa9a9799cbdfa63cd97a5848ec66786ef8/alphasql/alphacheck.cc#L219

Input SQL example and error log is in #95 (comment), though it is without a stack trace.
The error indicate that kind is ARG_TYPE_FIXED, and type is nullptr.

@Matts966
Copy link
Author

@jshute111
Also, I would like to ask how to run opt builds 🙇‍♂️
We setup ZetaSQL like below.
https://github.com/Matts966/alphasql/blob/883272aa9a9799cbdfa63cd97a5848ec66786ef8/WORKSPACE

@Matts966
Copy link
Author

Found that bazel build -c opt enables opt builds, but DCHECK still triggered.

Matts966/alphasql#89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants