google / google/googlesql

Qualified function calls result in "Function not found"

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

Description

When I parse this query with SqlAnalyzer::analyzeNextStatement, it succeeds:
```sql
CREATE FUNCTION foo.bar.baz() AS (1); SELECT baz();
```

But this query fails:

```sql
CREATE FUNCTION foo.bar.baz() AS (1); SELECT foo.bar.baz();
```

It looks like singleton and non-singleton paths are handled differently, and non-singleton paths don't work.

https://github.com/google/zetasql/blob/3e5d33d707919df42d1083665113ef05dd78ffff/zetasql/public/catalog.cc#L120-L128

Contributor guide

Open the contributing guide

Research direction

Start with zetasql/public/catalog.cc at the linked lines and trace how SqlAnalyzer::analyzeNextStatement resolves singleton versus non-singleton function paths. Reproduce the two CREATE FUNCTION and SELECT queries, then verify that the qualified call foo.bar.baz() resolves successfully like the unqualified baz() call.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sql
Domain
compilers, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.