apache / apache/pinot

[Feature] Support LiteralContext to replace the default STRING literal

Open
#8,596 0 comments 1 reaction 1 assignee Claimed by @walterddr View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
189

Description

Currently Pinot uses STRING type to store literal [in ExpressionContext](https://github.com/apache/pinot/blob/89836a57c0d2346e4a04d43c8a9d8ef1e7900b18/pinot-common/src/main/java/org/apache/pinot/common/request/context/ExpressionContext.java)

This was creating some confusion in resolving SQL queries for example: `array_remove_string(mvStringCol, 2)` actually removes the literal string `"2"` from the myStringCol because
1. auto type conversion from int value to STRING in ExpressionContext, then
2. implicit type cast to INT, then
3. eventually cast to STRING to match the `arrayRemoveString` signature of `args(String[], String)`

Propose to create a `LiteralContext` similar to the FunctionContext and FilterContext. it holds
- `LiteralType` extracted from the [Thrift Literal](https://github.com/apache/pinot/blob/89836a57c0d2346e4a04d43c8a9d8ef1e7900b18/pinot-common/src/thrift/query.thrift#L59-L68)
- `LiteralValue` which is the optional literal value

CC @Jackie-Jiang @xiangfu0 ^

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.