google / google/googlesql

[java] analyzer does not identify implicit return type for functions with ANY TYPE arguments

Open
#66 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

`CREATE TEMP FUNCTION test(x INT64) AS (x+1)` correctly identifies implicit signature `(INT64 x) -> INT64`.

`CREATE TEMP FUNCTION test(x INT64) AS ('hello world')` correctly identifies implicit signature `(INT64 x) -> STRING`.

`CREATE TEMP FUNCTION test(x ANY TYPE) AS ('hello world')` incorrectly identifies implicit signature `(ANY TYPE x) -> ANY TYPE` where I would expect `(ANY TYPE x) -> STRING`.

`CREATE TEMP FUNCTION test(x ANY TYPE) RETURNS STRING AS ('hello world')` correctly identifies explicit signature `(ANY TYPE x) -> STRING`.

I am running using java api and zeta version `2020.10.1`

Contributor guide

Open the contributing guide

Research direction

Start with the Java API analyzer reproduction described in the issue, using the three temporary-function examples to compare inferred signatures. Done means an ANY TYPE argument with a literal STRING body infers a STRING return type while preserving the existing INT64 and explicit RETURNS behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.