-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Support checking error data row when doing INSERT #1597
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
Conversation
| // set to OK, which means the insert load job is successfully submitted. | ||
| // and user can check the job's status by label. | ||
| context.getState().setOk("{'label':'" + uuid.toString() + "'}"); | ||
| Map<String, String> res = Maps.newHashMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can make some old client code not compatible. I think if client can get tracking URL from show load, we can not return URL here.
And this version is deprecated, I think it's better to keep old version's return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change it
If INSERT operation failed on some error data rows, a url will be provided
for user to checking the error data rows.
eg:
{"label":"d2cac0a0-a16d-482d-9041-c949a4b71604","url":"xxx"}
or
ERROR 1064 (HY000): all partitions have no load data. url:xxx
d8df0d9 to
b707fc6
Compare
| return; | ||
| } | ||
|
|
||
| if (insertStmt.getQueryStmt() != null && (coord.getCommitInfos() == null || coord.getCommitInfos().isEmpty())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we keep this when insertedRows and filterRows both are 0
| if (insertStmt.getQueryStmt() != null && (coord.getCommitInfos() == null || coord.getCommitInfos().isEmpty())) { | ||
| Catalog.getCurrentGlobalTransactionMgr().abortTransaction(insertStmt.getTransactionId(), "select stmt return empty set when insert"); | ||
| if (loadedRows == 0 && filteredRows == 0) { | ||
| // if no data, just return ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abort transaction.
If strict mode is true, and at least one row is filtered, the insert operation will fail and a url will be given to get the error rows.
If all rows are good, insert will return OK with affected rows:
If strict mode is false, and at least one row is good, the insert operation will return OK with affected rows and warnings. If has error row num, a label will be returned: