hashroute3 opened a new issue, #20413:
URL: https://github.com/apache/pinot/issues/20413

   Several standard SQL aggregate and scalar function names aren't recognized 
by either query engine. Tools that generate standard SQL, such as BI tools, SQL 
transpilers like sqlglot, and text-to-SQL agents, fail on them even though 
Pinot has the same function under another name.
   
   Checked on 1.6.0 with the batch QuickStart (`baseballStats`):
   
   | Query | Multi-stage | Single-stage | Pinot equivalent |
   |---|---|---|---|
   | `STDDEV(homeRuns)` | `No match found for function signature STDDEV` | 
`Unsupported function: stddev` | `STDDEV_SAMP` |
   | `VARIANCE(homeRuns)` | `No match found for function signature VARIANCE` | 
`Unsupported function: variance` | `VAR_SAMP` |
   | `APPROX_COUNT_DISTINCT(teamID)` | `No match found ...` | `Unsupported 
function: approxcountdistinct` | `DISTINCTCOUNTHLL` and related functions |
   | `CURRENT_TIMESTAMP` | `The definition of column 'CURRENT_TIMESTAMP' 
depends on itself` | `Unknown columnName 'CURRENT_TIMESTAMP'` | `NOW()` |
   | `POSITION('a' IN s)` | `No match found ...` | `Unsupported function: 
position` | `STRPOS` (0-based) |
   
   In PostgreSQL, Trino and Calcite, `STDDEV` and `VARIANCE` are the sample 
variants, so they map directly onto `STDDEV_SAMP` and `VAR_SAMP`.
   
   I'd like to start with `STDDEV` and `VARIANCE` as aliases on both engines. 
On the single-stage engine, the broker would rewrite them to `stddevsamp` and 
`varsamp` when parsing, so servers that haven't been upgraded never see the new 
names. On the multi-stage engine, they would be registered as aliases of 
Calcite's `STDDEV_SAMP` and `VAR_SAMP`.
   
   The others need a decision first, so I'd leave them for follow-ups:
   - `APPROX_COUNT_DISTINCT`: which sketch should it map to?
   - `CURRENT_TIMESTAMP`: it has special no-parentheses syntax in the parser.
   - `POSITION`: it is 1-based, but Pinot's `STRPOS` is 0-based.
   
   I have the alias change ready with tests and can open a PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to