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 — Exasol: IMPORT/EXPORT by ssteinhauser · Pull Request #2256 · JSQLParser/JSqlParser

Conversation

@ssteinhauser

@ssteinhauser ssteinhauser commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

This PR adds support for Exasols IMPORT and EXPORT statements:
https://docs.exasol.com/db/latest/sql/import.htm
https://docs.exasol.com/db/latest/sql/export.htm

The JMH benchmark looks good on my machine:

Benchmark                               (version)  Mode  Cnt    Score    Error  Units
JSQLParserBenchmark.parseSQLStatements     latest  avgt   15  119.730 ± 35.438  ms/op
JSQLParserBenchmark.parseSQLStatements        5.3  avgt   15  244.662 ± 99.050  ms/op
JSQLParserBenchmark.parseSQLStatements        5.1  avgt   15  185.566 ± 76.161  ms/op

Sorry, something went wrong.

Uh oh!

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

All reactions
Stefan Steinhauser added 24 commits February 3, 2025 16:05
Stefan Steinhauser
feat: Implement IMPORT statement grammar
3e18bd0
For reference see https://docs.exasol.com/db/latest/sql/import.htm
Stefan Steinhauser
feat: Classify new keywords in ParserKeywordsUtils
482a993
Stefan Steinhauser
feat: Implement java classes for IMPORT statement
dcea88f
Stefan Steinhauser
feat: Add LOOKAHEADs for IMPORT statement
e1a74e1
Stefan Steinhauser
fix: Fix issues in IMPORT implementation
711200d
Stefan Steinhauser
feat: Update keywords
b0e6276
Stefan Steinhauser
feat: Allow IMPORT as FromItem in SELECT
0c9b80e
Stefan Steinhauser
fix: Split double dot to fix broken unit tests
d412059
Stefan Steinhauser
fix: Fix errors occured during verify step
bcfa4e9
Stefan Steinhauser
test: Implement unit tests for IMPORT
0130d56
Stefan Steinhauser
feat: Simplify grammar
7437a75
Stefan Steinhauser
test: Implement test for sub IMPORT
f495c96
Stefan Steinhauser
Merge branch 'master' into feature/exasol-import-statement
431a046
Stefan Steinhauser
fix: Use double dot token in IMPORT
60bb98d
Stefan Steinhauser
feat: Implement EXPORT statement
34fc6dd
Implement Exasol EXPORT statement (see https://docs.exasol.com/db/latest/sql/export.htm)
Stefan Steinhauser
refactor: Fix file extension in IMPORT tests
c4e5907
Stefan Steinhauser
test: Implement unit tests for EXPORT statement
c1129a0
Stefan Steinhauser
feat: Implement classes for EXPORT statement
34791cf
Stefan Steinhauser
test: Fix EXPORT unit tests
c658f4d
Stefan Steinhauser
Merge branch 'master' into feature/exasol-import-export
9a71180
Stefan Steinhauser
fix: Implement missing SampleClause methods
8adaa89
Stefan Steinhauser
feat: Add further Import tests
0c132d0
Stefan Steinhauser
fix: Update Keywords and fix boolean data type matching
3d1b786
Stefan Steinhauser
fix: Fix SourceDestinationType implementations
223143a
@manticore-projects

manticore-projects commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

@ssteinhauser:

Thank you for your contribution, I will look into it over the weekend.
Though I have a question regarding your JMH: can you please share the specs of your machine?

a) your tests look super slow in general (I am recording only 80 ms on a cheap laptop)
b) your tests record a huge improvement over 5.3 (which I could not explain)
c) your tests have very high variances

Not a real concern or show stopper, I am just curious!

All reactions

Sorry, something went wrong.

Uh oh!

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

Stefan Steinhauser
style: Run spotlessApply
40f916d
@ssteinhauser
ssteinhauser force-pushed the feature/exasol-import-export branch from 4db2a71 to 40f916d Compare June 5, 2025 11:33
Stefan Steinhauser
fix: Fix spotbugsMain
b56565d
@ssteinhauser

ssteinhauser commented Jun 5, 2025

Copy link
Copy Markdown
Contributor Author

@ssteinhauser:

Thank you for your contribution, I will look into it over the weekend. Though I have a question regarding your JMH: can you please share the specs of your machine?

a) your tests look super slow in general (I am recording only 80 ms on a cheap laptop) b) your tests record a huge improvement over 5.3 (which I could not explain) c) your tests have very high variances

Not a real concern or show stopper, I am just curious!

Yes, the benchmark results are super high. Probably because I had quite a few other tools and tasks running consuming lots of CPU and memory. However, my specifications are 32GB of RAM and an Intel Core i7-1185G7 (3.00GHz) CPU.

I've just reexecuted the benchmark (inside WSL) while having lower load on the machine, but the results are still a bit high although the variances are lower:

Benchmark                               (version)  Mode  Cnt    Score    Error  Units
JSQLParserBenchmark.parseSQLStatements     latest  avgt   15  140.343 ± 26.198  ms/op
JSQLParserBenchmark.parseSQLStatements        5.3  avgt   15  103.779 ± 20.458  ms/op
JSQLParserBenchmark.parseSQLStatements        5.1  avgt   15  119.490 ± 27.174  ms/op
All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects

manticore-projects commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

I have benchmarked your branch on my laptop and get more reasonable results:

Benchmark                               (version)  Mode  Cnt   Score   Error  Units
JSQLParserBenchmark.parseSQLStatements     latest  avgt   15  85.965 ± 2.753  ms/op
JSQLParserBenchmark.parseSQLStatements        5.3  avgt   15  81.911 ± 3.433  ms/op
JSQLParserBenchmark.parseSQLStatements        5.1  avgt   15  82.380 ± 2.856  ms/op

Although there is a deterioration in performance I think we can accept that.
Question: Could we introduce a Feature switch to avoid parsing any of your statements, unless explicitly requested for?

All reactions

Sorry, something went wrong.

Uh oh!

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

@ssteinhauser

ssteinhauser commented Jun 6, 2025

Copy link
Copy Markdown
Contributor Author

Hi @manticore-projects ,
thanks for your tests and feedback as well.
Sure we can add a feature flag. Which kind of flag are you thinking of? One flag for IMPORT/EXPORT or something else? Should its default be false or true?

All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects

manticore-projects commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Good Morning Stefan,

the decision is all yours because you understand your implementation best.
My take is:

  • you added lots of Exasol specific Grammar (kudos!)
  • this Grammar slows down the Parser somewhat (expected and justified)
  • this Grammar does not serve most of the users (unless they want Exasol)

Best way would be to have RDBMS specific parsers and I will look for ways to achieve that soon.
In the meantime, I wonder if we can introduce Features like 'DIALECT_EXASOL' or 'RDBMS_EXASOL' and then wrap all/most of your extensions into semantic lookaheads like:

LOOKAHEAD( { "DIALECT_EXASOL".equals(Features.get("dialect")) } ) production = ExasolProduction()

(This is an abstract illustration only, of course.)

My hope and goal was to reduce the performance penalty for common RDMS and use-cases to a minimum.
And to have a template for similar exotic dialects like apache hive etc.

All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects

manticore-projects commented Jun 6, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Example: line 4663/4664

 LOOKAHEAD(2) fromItem=SubImport() { fromItem = new ParenthesedFromItem(fromItem); }     

could be changed into:

 LOOKAHEAD(2,  { "DIALECT_EXASOL".equals(Features.get("dialect")) } ) fromItem=SubImport() { fromItem = new ParenthesedFromItem(fromItem); }     
All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects

manticore-projects commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

You have introduced new tokens RTRIM and LTRIM, please double-check that those won't collide with parsing the normal functions.

Beside that we are good to merge!

All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects

manticore-projects commented Jun 7, 2025

Copy link
Copy Markdown
Contributor

Greetings!

I have added already a new Feature for dialect which you can set to Dialect.EXASOL.
This feature can be used now in your lookaheads.

All reactions

Sorry, something went wrong.

Uh oh!

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

Stefan Steinhauser added 3 commits June 10, 2025 09:46
Stefan Steinhauser
feat: Add test for RTRIM and LTRIM functions
3b74289
Refs: JSQLParser#2256
Stefan Steinhauser
Merge branch 'master' into feature/exasol-import-export
7a08e3f
Stefan Steinhauser
feat: Add EXPORT feature flag
140a6f1
@ssteinhauser

ssteinhauser commented Jun 10, 2025

Copy link
Copy Markdown
Contributor Author

Greetings!

I have added already a new Feature for dialect which you can set to Dialect.EXASOL. This feature can be used now in your lookaheads.

Thank you very much for your support and effort on this. I've implemented the feature flag for EXPORT and IMPORT statements including the SubImport().

Furthermore, I've added tests for RTRIM and LTRIM functions in order to ensure, there is no clash between the keywords and usage of functions (see 3b74289).

If you don't have any further suggestions or concerns, we are good to merge from my point of view.

manticore-projects reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

Stefan Steinhauser
feat: Implement EXASOL dialect feature flag
82e2f78
@ssteinhauser
ssteinhauser force-pushed the feature/exasol-import-export branch from 3a0438c to 82e2f78 Compare June 10, 2025 10:07
@manticore-projects

manticore-projects commented Jun 10, 2025

Copy link
Copy Markdown
Contributor

Thank you very much, excellent work and I am going to merge this.

Interestingly, the performance deterioration is all about the addition tokens and the white listing of such tokens for Object Identifiers. Your productions have no impact. So in the future I will need to look for a way to reduce those tokens again (especially any token used less than 3 times in the grammar).

Also, the Dialect feature needs some syntax sugar -- but that will be on me.

All reactions

Sorry, something went wrong.

Uh oh!

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

@manticore-projects
Merge branch 'master' into feature/exasol-import-export
f30d0bf
@manticore-projects
manticore-projects merged commit 7460762 into JSQLParser:master Jun 10, 2025
@ssteinhauser
ssteinhauser deleted the feature/exasol-import-export branch June 11, 2025 06:26
@guizmaii guizmaii mentioned this pull request Oct 12, 2026
Allow ERRORS as an unquoted identifier #2781
Merged
manticore-projects pushed a commit that referenced this pull request Oct 13, 2026
@guizmaii Jules Ivanic
Allow ERRORS as an unquoted identifier (#2781)
cf6c83c
`ERRORS` was declared in the reserved keyword block when the Exasol IMPORT/EXPORT
error clauses were added (#2256), so 5.4 rejects queries using it as a name, e.g.
`SELECT errors FROM t` or a `WITH errors AS (...)` CTE, which DuckDB, PostgreSQL
and most databases accept.

Its only uses, `ERRORS INTO ...` and `REJECT LIMIT n ERRORS`, are behind
lookaheads, so it moves to the non-reserved keywords next to `ERROR`. The Exasol
IMPORT/EXPORT tests still pass.

Co-authored-by: Jules Ivanic <[email protected]>
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

@ssteinhauser @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.