google / google/googlesql

Analyzing statements with Procedures failed

Open
#95 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.6k
Forks
260
PR merge metrics
No merged PRs in 30d

Description

We instantiate `Procedure` like

```C++
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

```sql
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

```patch
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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.