Skip to content

Fix Derby compatibility in metadata DAOs - #1402

Open
xiaotongsaying wants to merge 1 commit into
pixelsdb:masterfrom
xiaotongsaying:master
Open

Fix Derby compatibility in metadata DAOs#1402
xiaotongsaying wants to merge 1 commit into
pixelsdb:masterfrom
xiaotongsaying:master

Conversation

@xiaotongsaying

Copy link
Copy Markdown

Remove MySQL-specific identifier quoting from metadata DAO queries. Use JDBC generated keys instead of LAST_INSERT_ID(). Add the default Derby JDBC driver configuration.
Update fresh installations to use PIXELS_HOME for Derby and var paths. Adjust the affected DAO test for generated-key retrieval.

What does this PR do?

This PR improves Derby compatibility in the metadata DAO implementation while
preserving MySQL support.

Changes

  • Remove MySQL-specific backtick quoting from metadata DAO SQL statements.
  • Replace SELECT LAST_INSERT_ID() with JDBC RETURN_GENERATED_KEYS.
  • Use SQL expressions supported by both Derby and MySQL.
  • Add the Derby JDBC driver to the default metadata configuration.
  • Configure fresh installations to place the Derby database and runtime
    directories under PIXELS_HOME.
  • Update the affected DAO test to mock JDBC generated-key retrieval.

Why is this needed?

The default metadata database is Derby, but some DAO statements still use
MySQL-specific SQL syntax. These statements can fail when metadata operations
are executed against Derby.

Testing

Tested on:

  • Huawei Cloud Kunpeng ARM64
  • Kylin Linux Advanced Server V10 SP3
  • Maven 3.9.16
  • Pixels CLI and coordinator using JDK 8
  • Apache Derby embedded metadata database
  • Trino 466 using ARM64 JDK 23

Verified the following flow:

  1. Built and installed Pixels from the modified source.
  2. Initialized a fresh Derby metadata database with INIT-META.
  3. Started etcd and the Pixels coordinator.
  4. Created the TPC-H region table through the Pixels Trino connector.
  5. Loaded the TPC-H region.tbl file with pixels-cli.
  6. Confirmed that a Pixels .pxl file was generated.
  7. Queried the table through Trino.

Query:

SELECT count(*), sum(r_regionkey) FROM tpch.region;

Related to #1393
Related to #1394

Remove MySQL-specific identifier quoting from metadata DAO queries.
Use JDBC generated keys instead of LAST_INSERT_ID().
Add the default Derby JDBC driver configuration.
Update fresh installations to use PIXELS_HOME for Derby and var paths.
Adjust the affected DAO test for generated-key retrieval.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant