| 370 | } |
| 371 | |
| 372 | void Decode(OpKernelContext* ctx, std::vector<UChar32>* char_values, |
| 373 | std::vector<SPLITS_TYPE>* offset_values, int* current_offset, |
| 374 | SPLITS_TYPE* next_row_split, UChar32 char_value, int char_length, |
| 375 | bool found_any_format_error) { |
| 376 | if (error_options_.error_on_malformatting && found_any_format_error) { |
| 377 | ctx->CtxFailure( |
| 378 | errors::InvalidArgument("Invalid formatting on input string")); |
| 379 | } |
| 380 | UChar32 decoded_value = char_value; |
| 381 | if (ShouldHandleFormatError(error_options_, char_value, |
| 382 | found_any_format_error)) { |
| 383 | if (error_options_.elide_replacement && (offset_values != nullptr)) { |
| 384 | *current_offset += char_length; |
| 385 | return; |
| 386 | } else { |
| 387 | decoded_value = error_options_.subst; |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | // Emit the char value. |
| 392 | char_values->push_back(decoded_value); |
| 393 | |
| 394 | // Emit the byte offset |
| 395 | if (offset_values != nullptr) { |
| 396 | offset_values->push_back(*current_offset); |
| 397 | *current_offset += char_length; |
| 398 | } |
| 399 | *next_row_split += 1; |
| 400 | } |
| 401 | |
| 402 | void Compute(OpKernelContext* ctx) override { |
| 403 | const Tensor* input_tensor; |
nothing calls this directly
no test coverage detected