lbug 0.12.3-dev.25 → 0.12.3-dev.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  cmake_minimum_required(VERSION 3.15)
2
2
 
3
- project(Lbug VERSION 0.12.3.25 LANGUAGES CXX C)
3
+ project(Lbug VERSION 0.12.3.27 LANGUAGES CXX C)
4
4
 
5
5
  option(SINGLE_THREADED "Single-threaded mode" FALSE)
6
6
  if(SINGLE_THREADED)
@@ -28,7 +28,6 @@ std::optional<WarningSourceData> getWarningSourceData(
28
28
  return ret;
29
29
  }
30
30
 
31
- // TODO(Guodong): Add short path for unfiltered case.
32
31
  bool checkNullKey(ValueVector* keyVector, offset_t vectorOffset,
33
32
  BatchInsertErrorHandler* errorHandler, const std::vector<ValueVector*>& warningDataVectors) {
34
33
  bool isNull = keyVector->isNull(vectorOffset);
@@ -71,27 +70,17 @@ struct OffsetVectorManager {
71
70
  offset_t insertOffset;
72
71
  };
73
72
 
74
- // TODO(Guodong): Add short path for unfiltered case.
75
73
  template<bool hasNoNullsGuarantee>
76
- void fillOffsetArraysFromVector(transaction::Transaction* transaction, const IndexLookupInfo& info,
77
- ValueVector* keyVector, ValueVector* resultVector,
78
- const std::vector<ValueVector*>& warningDataVectors, BatchInsertErrorHandler* errorHandler) {
79
- KU_ASSERT(resultVector->dataType.getPhysicalType() == PhysicalTypeID::INT64);
74
+ void fillOffsetArraysFromVectorInternal(transaction::Transaction* transaction,
75
+ const IndexLookupInfo& info, ValueVector* keyVector, ValueVector* resultVector,
76
+ const std::vector<ValueVector*>& warningDataVectors, BatchInsertErrorHandler* errorHandler,
77
+ const sel_t* selVector, sel_t numKeys) {
80
78
  TypeUtils::visit(
81
79
  keyVector->dataType.getPhysicalType(),
82
80
  [&]<IndexHashable T>(T) {
83
- auto numKeys = keyVector->state->getSelVector().getSelSize();
84
-
85
- // fetch all the selection pos at the start
86
- // since we may modify the selection vector in the middle of the lookup
87
- std::vector<sel_t> lookupPos(numKeys);
88
- for (idx_t i = 0; i < numKeys; ++i) {
89
- lookupPos[i] = (keyVector->state->getSelVector()[i]);
90
- }
91
-
92
81
  OffsetVectorManager resultManager{resultVector, errorHandler};
93
- for (auto i = 0u; i < numKeys; i++) {
94
- auto pos = lookupPos[i];
82
+ for (sel_t i = 0u; i < numKeys; i++) {
83
+ auto pos = selVector ? selVector[i] : i;
95
84
  if constexpr (!hasNoNullsGuarantee) {
96
85
  if (!checkNullKey(keyVector, pos, errorHandler, warningDataVectors)) {
97
86
  continue;
@@ -99,12 +88,9 @@ void fillOffsetArraysFromVector(transaction::Transaction* transaction, const Ind
99
88
  }
100
89
  offset_t lookupOffset = 0;
101
90
  if (!info.nodeTable->lookupPK(transaction, keyVector, pos, lookupOffset)) {
102
- TypeUtils::visit(keyVector->dataType, [&]<typename type>(type) {
103
- errorHandler->handleError(
104
- ExceptionMessage::nonExistentPKException(
105
- TypeUtils::toString(keyVector->getValue<type>(pos), keyVector)),
106
- getWarningSourceData(warningDataVectors, pos));
107
- });
91
+ errorHandler->handleError(ExceptionMessage::nonExistentPKException(
92
+ keyVector->getAsValue(pos)->toString()),
93
+ getWarningSourceData(warningDataVectors, pos));
108
94
  } else {
109
95
  resultManager.insertEntry(lookupOffset, pos);
110
96
  }
@@ -112,6 +98,28 @@ void fillOffsetArraysFromVector(transaction::Transaction* transaction, const Ind
112
98
  },
113
99
  [&](auto) { KU_UNREACHABLE; });
114
100
  }
101
+
102
+ template<bool hasNoNullsGuarantee>
103
+ void fillOffsetArraysFromVector(transaction::Transaction* transaction, const IndexLookupInfo& info,
104
+ ValueVector* keyVector, ValueVector* resultVector,
105
+ const std::vector<ValueVector*>& warningDataVectors, BatchInsertErrorHandler* errorHandler) {
106
+ KU_ASSERT(resultVector->dataType.getPhysicalType() == PhysicalTypeID::INT64);
107
+ auto& selVector = keyVector->state->getSelVector();
108
+ auto numKeys = selVector.getSelSize();
109
+ if (selVector.isUnfiltered()) {
110
+ // Fast path: selection vector is unfiltered - pass a null selection vector
111
+ fillOffsetArraysFromVectorInternal<hasNoNullsGuarantee>(transaction, info, keyVector,
112
+ resultVector, warningDataVectors, errorHandler, nullptr /* selVector */, numKeys);
113
+ } else {
114
+ // Filtered case: copy selection positions since we may modify the selection vector
115
+ std::vector<sel_t> lookupPos(numKeys);
116
+ for (idx_t i = 0; i < numKeys; ++i) {
117
+ lookupPos[i] = selVector[i];
118
+ }
119
+ fillOffsetArraysFromVectorInternal<hasNoNullsGuarantee>(transaction, info, keyVector,
120
+ resultVector, warningDataVectors, errorHandler, lookupPos.data(), numKeys);
121
+ }
122
+ }
115
123
  } // namespace
116
124
 
117
125
  std::string IndexLookupPrintInfo::toString() const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lbug",
3
- "version": "0.12.3-dev.25",
3
+ "version": "0.12.3-dev.27",
4
4
  "description": "An in-process property graph database management system built for query speed and scalability.",
5
5
  "main": "index.js",
6
6
  "module": "./index.mjs",
Binary file
Binary file
Binary file
Binary file