apache / apache/pinot

Add LASTWITHTIME to FunctionRegistry

Open
#8,315 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
2d 3h
Merged PRs (30d)
195

Description

LASTWITHTIME queries from a Trino connector fail with

`Unexpected aggregate expression: 'lastwithtime(id,timestamp,'string')'`

When further inspected the logs show:
`
org.apache.pinot.common.function.FunctionRegistry Initialized FunctionRegistry with 131 functions: [fromepochminutesbucket, arrayunionint, codepoint, mod, sha256, year, yearofweek, upper, ago, arraycontainsstring, arraydistinctstring, bytestohex, tojsonmapstr, trim, timezoneminute, sqrt, togeometry, normalize, fromepochdays, arraydistinctint, geotoh3, exp, stgeogfromwkb, stgeogfromtext, stgeomfromwkb, jsonpathlong, yow, toepochhoursrounded, lower, toutf8, concat, ceil, todatetime, jsonpathstring, substr, dayofyear, contains, jsonpatharray, arrayindexofint, fromepochhoursbucket, totimestamp, arrayindexofstring, minus, arrayunionstring, toepochhours, toepochdaysrounded, millisecond, fromepochhours, arrayreversestring, dow, doy, min, toepochsecondsrounded, strpos, jsonpath, tosphericalgeography, fromepochsecondsbucket, max, reverse, regexpextract, hammingdistance, stpoint, abs, timezonehour, stgeomfromtext, toepochseconds, arrayconcatint, quarter, md5, ln, toepochminutes, arraysortstring, replace, strrpos, jsonpathdouble, stastext, second, arraysortint, split, fromepochdaysbucket, lpad, day, toepochminutesrounded, strcmp, fromdatetime, fromepochseconds, arrayconcatstring, fromtimestamp, base64encode, ltrim, arraysliceint, chr, sha, plus, base64decode, month, arraycontainsint, toepochminutesbucket, startswith, week, jsonformat, sha512, arrayslicestring, fromepochminutes, remove, dayofmonth, times, hour, rpad, arrayremovestring, now, divide, bigdecimaltobytes, floor, toepochsecondsbucket, stasbinary, toepochdaysbucket, hextobytes, rtrim, length, toepochhoursbucket, bytestobigdecimal, toepochdays, arrayreverseint, datetrunc, minute, round, jsonpatharraydefaultempty, dayofweek, arrayremoveint, weekofyear]
`

LASTWITHTIME is not included in the above list and therefore cannot be used in the queries

Contributor guide

Open the contributing guide

Research direction

Start at the FunctionRegistry entry point and inspect how the existing aggregate functions are registered. Add LASTWITHTIME consistently with those registrations, then verify that the reported Trino query no longer fails with an unexpected aggregate expression and that the function appears in the registry.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.