Skip to content

Conversation

@urosstan-db
Copy link
Contributor

What changes were proposed in this pull request?

Add new error class which indicates certain data source does not support DML operation.

Why are the changes needed?

Sometimes, Data Source V2 does not support DML operations such as create table, alter table, drop namespace, etc i.e. it is read only data source, so we need some new error class which will be thrown in case we implement such data source.

Does this PR introduce any user-facing change?

No

How was this patch tested?

No testing needed, compile only

Was this patch authored or co-authored using generative AI tooling?

No

],
"sqlState" : "KD010"
},
"DATA_SOURCE_UNSUPPORTED_DML_OPERATION" : {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe subclasses for each operation is better?
Operations are something like
'CREATE TABLE', 'ALTER NAMESPACE', etc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is common to name the operation: "ALTER TABLE', "UPDATE" as a parameter.

"sqlState" : "KD011"
},
"DATA_SOURCE_NOT_EXIST" : {
"message" : [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add JIRA item when we are satisfied with the changes in PR

],
"sqlState" : "KD010"
},
"DATA_SOURCE_UNSUPPORTED_DML_OPERATION" : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the feature is just not supported yet, we should consider to add a sub-class to UNSUPPORTED_FEATURE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error class should be for data sources which does not have implementation for some DML operation, not like transient state.

},
"DATA_SOURCE_UNSUPPORTED_DML_OPERATION" : {
"message" : [
"Data source '<provider>' does not support requested DML operation: '<operation>'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove '' around . You should quote it by toSQLStmt when you form error message parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, TBD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even for provider as well? Or just for SQL operation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the dml operation. Are you going to pass some SQL ops there, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, some descriptive SQL operations, e.g. CREATE TABLE, DROP NAMESPACE, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I also renamed operation to sqlOperation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to propose a KD011, it seems new.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Data source '<provider>' does not support requested DML operation: <sqlOperation>"
"Data source '<provider>' does not support requested operation: <sqlOperation>"

We can be more generic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@urosstan-db urosstan-db force-pushed the add-new-error-condition branch from 3d34c2d to 950ea4b Compare October 25, 2024 17:01
@urosstan-db urosstan-db changed the title Add new error class - Data source does not support DML operation [SPARK-50125] Add new error class - Data source does not support DML operation Oct 25, 2024
@urosstan-db urosstan-db marked this pull request as ready for review October 25, 2024 17:03
Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@urosstan-db Are you going to raise the error from somewhere?

],
"sqlState" : "42K03"
},
"DATA_SOURCE_UNSUPPORTED_DML_OPERATION" : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we removed DML from message, let's remove it from the condition name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to have it just exception dedicated to DML operations, if it is needed I can revert DML in message? Serge suggested me to do that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message should be in sync with the name. So yes, I implied to remove it from both.

Co-authored-by: Maxim Gekk <max.gekk@gmail.com>
@urosstan-db
Copy link
Contributor Author

@urosstan-db Are you going to raise the error from somewhere?

No for now, not in Spark to be more precise.

Co-authored-by: Serge Rielau <srielau@users.noreply.github.com>
@MaxGekk
Copy link
Member

MaxGekk commented Oct 30, 2024

No for now, not in Spark to be more precise.

In that case, I don't think it should be merged to OSS Spark, sorry.

@urosstan-db
Copy link
Contributor Author

No for now, not in Spark to be more precise.

In that case, I don't think it should be merged to OSS Spark, sorry.

Ok thanks, I thought to avoid introducing of multiple similar codes, but let's close this one then.

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.

3 participants