-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(clickhouse-driver): add intelligent DDL handling for unsupported operations #9845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(clickhouse-driver): add intelligent DDL handling for unsupported operations #9845
Conversation
Hi there! 👋 I'm a FullStack developer with 10+ years of experience, currently working for a company that specializes in Business Intelligence using Cube.js and ClickHouse. This PR addresses a real-world issue we encountered in production with Cube's pre-aggregation feature. We were getting this error:
The problem occurs when Cube tries to execute DDL operations (like What this PR does:
Why I'm contributing: Testing: I'm open to any discussion about this implementation and happy to iterate based on feedback. Feel free to ask questions or suggest improvements! P.S. This is my first PR ever, so please be gentle! But seriously, don't hesitate to question anything - I'm here to learn and improve. Looking forward to contributing more to this amazing project! |
I had to build it with a custom docker image to test It before asking review and I can tell you that okay now. With this fix there is no longer parsing error |
Hi @Greenystuff, thanks for the contribution!
Sorry if I'm missing something here—but when exactly does Cube try to run |
Hi ! It's when the driver wants to store my pre-aggregations on ClickHouse in dev mode, I hade this error and not any table in ClicHouse. |
Check List
Issue Reference this PR resolves
No specific issue reference - this is a proactive enhancement to improve ClickHouse driver compatibility
Description of Changes Made
This PR adds intelligent DDL (Data Definition Language) handling to the ClickHouse driver to handle operations that are not natively supported by certain ClickHouse storage engines, particularly the
Log
engine.Key Changes:
CREATE
,ALTER
,DROP
,TRUNCATE
,RENAME
,ATTACH
,DETACH
,GRANT
,REVOKE
)ALTER TABLE ADD COLUMN
onLog
engineTechnical Implementation:
connection.command()
instead ofconnection.query()
to avoid JSON parsing errorsALTER TABLE ADD COLUMN
onLog
engine: automatically recreates table with new schema, copies data, drops old table, renames new tableTesting:
ALTER TABLE ADD COLUMN
compatibility layer works as expectedProblem Solved:
The ClickHouse
Log
engine doesn't supportALTER TABLE ADD COLUMN
operations, returning error code 48 (NOT_IMPLEMENTED). This PR implements a compatibility layer that automatically handles this limitation by recreating the table with the new schema, ensuring data integrity while maintaining the expected behavior.