[
https://issues.apache.org/jira/browse/CALCITE-7599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-7599:
---------------------------------
Summary: In SQL hints, allow numeric literals as values (was: Enhance
parser to allow numeric literals as values in k/v hints as suggested by
documentation)
> In SQL hints, allow numeric literals as values
> ----------------------------------------------
>
> Key: CALCITE-7599
> URL: https://issues.apache.org/jira/browse/CALCITE-7599
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.42.0
> Reporter: Chris Dennis
> Priority: Minor
> Labels: pull-request-available
>
> There is a small inconsistency remaining between the reference documentation
> [https://calcite.apache.org/docs/reference.html#syntax] and the parser
> syntax. The documentation example shows unquoted numeric literals being used
> as values in a key-value hint. The reference documentation uses this as an
> example query:
> {code:sql}
> SELECT /*+ hint1, hint2(a=1, b=2) */
> ...
> FROM
> tableName /*+ hint3(5, 'x') */
> JOIN
> tableName /*+ hint4(c=id), hint5 */
> ...
> {code}
> The unquoted literals in {{hint2(a=1, b=2)}} do not parse using the current
> grammar however, and are not present in the copy of the documentation query
> used in SqlHintsConverterTest#testDocumentationExample}}. I think it should
> be pretty simple to expand the grammar to support the same set of literals as
> is currently supported by {{ParenthesizedLiteralOptionCommaList}}, that is
> {{StringLiteral | NumericLiteral}} (in addition to the {{SimpleIdentifier}}
> that is currently also supported for the value of a key-value pair). At the
> same time we should update the test so that the query exactly matches the
> documentation example by not quoting the two numeric constants. To be clear
> that means both signed, and unsigned; integers, decimals and scientific
> notation. The following therefore are all valid numeric literals: {{1}},
> {{-1}}, {{1.1}}, {{-1.1}}, {{1.2e3}}, {{-1.2e-5}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)