-
Notifications
You must be signed in to change notification settings - Fork 560
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
client.insert(...) fails if registered class doesn't match all existing columns #2118
Comments
Good day, @gabrielpablorc ! |
@chernser thanks for the quick turnaround! There's actually an important detail I overlooked: The 'missing' column in my registered class is actually a materialized one. For reference, here's what that bit of the table creation script looks like:
I'd like to suggest a fix, but can't figure one out easily. From debugging, this particular materialized column doesn't seem to be distinguishable from the other (non-materialized) ones - at least not from checking the attributes I'm seeing in either I now see this is somewhat related to another reported issue, so feel free to close if you consider this duplicated: #2025 |
I took the liberty of debugging a bit further, and thought it might be useful to actually track (through an additional attribute in
Thought this might help! |
thank you @gabrielpablorc for the thorough analysis. |
Describe the bug
Attempting an
insert
fails if any column from the target table is not defined in the registered POJO.Steps to reproduce
client.insert(...)
for one of these POJO instances.IllegalArgumentException
(No serializer found for column 'example'. Did you forget to register it?
).From my understanding, the problem comes from the fact that
client.insert(...)
assumes the resultingINSERT
command should include values for all existing columns (which should not be the case), throwing an exception in line 1350 ofcom.clickhouse.client.api.Client
when this is not the case.Expected behaviour
client.insert(...)
should ideally work even if the registered class is 'missing' some columns from the mapped table. While this can be partially solved by just adding said missing column into the registered class, this particular behavior can be problematic in certain casesFor example, when adding a new column to an existing table, this would theoretically break the mapping of the version running in production - which would not have the corresponding attribute in the POJO class.
Error log
Thanks in advance for reading this!
The text was updated successfully, but these errors were encountered: