MCPcopy Create free account
hub / github.com/bytedance/bolt / compareStringAsc

Function compareStringAsc

bolt/exec/ContainerRowSerde.cpp:647–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645}
646
647int compareStringAsc(
648 ByteInputStream& left,
649 const BaseVector& right,
650 vector_size_t index,
651 bool equalsOnly) {
652 int32_t leftSize = left.read<int32_t>();
653 auto rightView =
654 right.asUnchecked<SimpleVector<StringView>>()->valueAt(index);
655 if (rightView.size() != leftSize && equalsOnly) {
656 return 1;
657 }
658 auto compareSize = std::min<int32_t>(leftSize, rightView.size());
659 int32_t rightOffset = 0;
660 while (compareSize > 0) {
661 auto leftView = left.nextView(compareSize);
662 auto result = memcmp(
663 leftView.data(), rightView.data() + rightOffset, leftView.size());
664 if (result != 0) {
665 return result;
666 }
667 rightOffset += leftView.size();
668 compareSize -= leftView.size();
669 }
670 return leftSize - rightView.size();
671}
672
673template <>
674std::optional<int32_t> compare<TypeKind::VARCHAR>(

Callers 5

VARCHAR>Method · 0.70
VARBINARY>Method · 0.70
equalsWithNullsFunction · 0.70
equalsNoNullsFunction · 0.70
compareFunction · 0.70

Calls 4

valueAtMethod · 0.45
sizeMethod · 0.45
nextViewMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected