GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [feat/refactor] AllColumns and AllTableColumns-Support for JSON_OBJECT by ANeumann82 · Pull Request #2323 · JSQLParser/JSqlParser

Conversation

@ANeumann82

@ANeumann82 ANeumann82 commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

This adds support for the JSON_OBJECT(*) and JSON_OBJECT(t1.*, t2.*) syntax, reference is here: https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/JSON_OBJECT.html

While working on this, I noticed that the current handling is a bit off:
In OBJECT_POSTGRES mode, the separate entries are stored in key and value of a single keyValue, and the AllColumns and AllTableColumns-Objects would end up there as well.

As it is possible to mix actual key value pairs and AllTableColumns ( JSON_OBJECT(t1.*, 'name' : t2.name, t3.*) ) we need to make sure that each "entry" gets it's own KeyValuePair, with just the key (or value) set.

I'm not sure how breaking changes are handled here. The PR so far is binary compatible, i.e. the API is backwards compatible, but the behaviour changed slightly.

OBJECT_MYSQL and OBJECT_POSTGRES are not used anymore. Instead the JsonKeyValuePair now has a "separator"-Field that describes how the key and the value are rendered. There is one entry NOT_USED in case the KeyValuePair has only one value.

Open questions:

  • Should we store single entry keyValuePairs in the key or the value field. Value seems a bit more sane, but key is easier.
  • Is it ok to deprecate the old syntax ( JsonKeyValuePair.get/set/withValueKeyword, JsonFunctionType.OBJECT_MYSQL, etc.)? I assume they shouldn't simply be deleted.

I plan to work on this a bit more, also the JsonAggregateFunction should probably be adapted as well, but I'd like to get your opinion on the whole thing first.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ANeumann82 added 5 commits October 7, 2025 22:11
@ANeumann82
[feat] JSON_OBJECT support for AllColumns and AllTableColumns
a87f797
@ANeumann82
[feat] JSON_OBJECT support for AllColumns and AllTableColumns
46f3679
@ANeumann82
[feat] JSON_OBJECT support for AllColumns and AllTableColumns
64221d2
@ANeumann82
[feat] Split the parser syntax for JsonFunction, added more Tests, ad…
d2f762e
…ded Feature to disable Commas as key value separators
@ANeumann82
[feat] Disable Expression as JSON_OBJECT key value via feature flag
efcafec
@ANeumann82
ANeumann82 marked this pull request as ready for review October 11, 2025 12:27
@ANeumann82

ANeumann82 commented Oct 11, 2025

Copy link
Copy Markdown
Contributor Author

Did a bit more work here, and I think it's ok for now. Some thoughts:

  • MySQLs syntax that allows separation of key and value with a ',' is stupid
  • Informix and Snowflake syntax of using ':' to extract values from JSON clashes with the key value separation in all other syntaxes. I would prefer to have the Informix and Snowflake syntax behind a feature flag, but it's supported at the moment and should probably stay that way for now.

I see a lot of potential issues with incompatible syntaxes in the future, we should probably think about how to solve them. I know that the library is designed as a general, language agnostic parser, but at some point it's simply not possible to support everything without specifying the expected syntax...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ANeumann82
[chore] spotlessApply
050e98a
@ANeumann82

ANeumann82 commented Oct 11, 2025

Copy link
Copy Markdown
Contributor Author

JMH on master (without this PR):

Benchmark                               (version)  Mode  Cnt    Score    Error  Units
JSQLParserBenchmark.parseSQLStatements     latest  avgt   15  147.645 ▒ 18.556  ms/op
JSQLParserBenchmark.parseSQLStatements        5.3  avgt   15  130.678 ▒ 11.676  ms/op
JSQLParserBenchmark.parseSQLStatements        5.1  avgt   15  106.721 ▒ 11.682  ms/op

JMH on this PR:

Benchmark                               (version)  Mode  Cnt    Score    Error  Units
JSQLParserBenchmark.parseSQLStatements     latest  avgt   15  147.743 ▒ 16.034  ms/op
JSQLParserBenchmark.parseSQLStatements        5.3  avgt   15  133.559 ▒ 10.180  ms/op
JSQLParserBenchmark.parseSQLStatements        5.1  avgt   15  113.411 ▒ 12.000  ms/op
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ANeumann82
[feat] Use append method from JsonKeyValuePair
1ed2433
@manticore-projects

manticore-projects commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

Thank you for your work and effort. No objections from my side and I will merge when you are ready.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ANeumann82

ANeumann82 commented Oct 12, 2025

Copy link
Copy Markdown
Contributor Author

Thank you, please go ahead and merge, this PR is good from my side. I'll probably have a look at JSON_TABLE next

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@manticore-projects
manticore-projects merged commit e8d6058 into JSQLParser:master Oct 12, 2025
@manticore-projects

manticore-projects commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

Next time please check for those warnings too:

Warning: Choice conflict involving two expansions at
         line 7016, column 14 and line 7020, column 14 respectively.
         A common prefix is: "*"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 7018, column 14 and line 7020, column 14 respectively.
         A common prefix is: <DATA_TYPE> "..."
         Consider using a lookahead of 3 or more for earlier expansion.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ANeumann82

ANeumann82 commented Oct 12, 2025

Copy link
Copy Markdown
Contributor Author

Next time please check for those warnings too:

Warning: Choice conflict involving two expansions at
         line 7016, column 14 and line 7020, column 14 respectively.
         A common prefix is: "*"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 7018, column 14 and line 7020, column 14 respectively.
         A common prefix is: <DATA_TYPE> "..."
         Consider using a lookahead of 3 or more for earlier expansion.

Yeah, didn't look for the JavaCC-Warnings. I'll check those and make another PR to fix them

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@manticore-projects

manticore-projects commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

No worries, I did that already. Good team effort: you do the heavy lifting and leave the easy work to me. Cheers and best!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fudianchn fudianchn mentioned this pull request Aug 23, 2026
[BUG] JSQLParser 5.4-SNAPSHOT : Hive : INSERT PARTITION bare column inherits the previous item's value #2500
Closed
@fudianchn fudianchn mentioned this pull request Aug 31, 2026
fix: prevent bare partition columns from inheriting the previous item's value #2518
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ANeumann82 @manticore-projects
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.