| 431 | }; |
| 432 | |
| 433 | bool SplitStringMapOperation::handleKey(const char* start, const char* end, |
| 434 | const CSVOption* option) { |
| 435 | trimRightWhitespace(start, end); |
| 436 | auto fieldVector = StructVector::getFieldVector(resultVector, 0).get(); |
| 437 | CastString::copyStringToVector(fieldVector, offset, |
| 438 | std::string_view{start, (uint32_t)(end - start)}, option); |
| 439 | if (fieldVector->isNull(offset)) { |
| 440 | throw common::ConversionException{"Map does not allow null as key."}; |
| 441 | } |
| 442 | auto val = common::Value::createDefaultValue(fieldVector->dataType); |
| 443 | val.copyFromColLayout(fieldVector->getData() + fieldVector->getNumBytesPerValue() * offset, |
| 444 | fieldVector); |
| 445 | auto uniqueKey = uniqueKeys.insert(val).second; |
| 446 | if (!uniqueKey) { |
| 447 | throw common::ConversionException{"Map does not allow duplicate keys."}; |
| 448 | } |
| 449 | return true; |
| 450 | } |
| 451 | |
| 452 | void SplitStringMapOperation::handleValue(const char* start, const char* end, |
| 453 | const CSVOption* option) { |
no test coverage detected