Skip to content

[CALCITE-7599] Enhance parser to allow numeric literals as values in k/v hints as suggested by documentation#5012

Open
chrisdennis wants to merge 1 commit into
apache:mainfrom
chrisdennis:calcite-7599
Open

[CALCITE-7599] Enhance parser to allow numeric literals as values in k/v hints as suggested by documentation#5012
chrisdennis wants to merge 1 commit into
apache:mainfrom
chrisdennis:calcite-7599

Conversation

@chrisdennis

Copy link
Copy Markdown
Contributor

CALCITE-7599

This is a small refinement to CALCITE-7498 to finish alignment of the reference documentation example, the reference documentation grammar, and the actual parser grammar. The alignment here could have used a different fixed point, but I figured I would follow the original example and align on the example query as the source of truth. This also has the nice side-effect of supporting the largest set of valid hints.

@chrisdennis

Copy link
Copy Markdown
Contributor Author

In the process of cleaning some test fallout here... right now I don't think this impacts the actual fix however.

@chrisdennis chrisdennis force-pushed the calcite-7599 branch 2 times, most recently from 19f2ab9 to c6fb85c Compare June 10, 2026 20:00
+ "empno, ename, deptno from emps";
sql(sql1).fails("(?s).*Encountered \"k1 = 123\" at .*");
// Allow numeric literal k/v values.
final String expected1 = "SELECT\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to add a few more tests with the more complex numeric literals supported, e.g. 1e-2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make sense, but I'll add them to SqlHintsConverterTest rather than here.

…k/v hints as suggested by documentation

Signed-off-by: Chris Dennis <chris.w.dennis@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@chrisdennis chrisdennis requested a review from mihaibudiu June 13, 2026 12:14
//~ Tools ------------------------------------------------------------------

private static String getOptionAsString(SqlNode node) {
private String getOptionAsString(SqlNode node) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the static?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that we can reference options in the requireNonNull message.

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Jun 14, 2026
@mihaibudiu

Copy link
Copy Markdown
Contributor

Let's see if there are other comments before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants