|
|
UpdateSegment * | segment |
| | The update segment that this update info affects.
|
|
DataTable * | table |
| | The table this was update was made on.
|
|
idx_t | column_index |
| | The column index of which column we are updating.
|
|
idx_t | row_group_start |
| | The start index of the row group.
|
|
atomic< transaction_t > | version_number |
| | The version number.
|
|
idx_t | vector_index |
| | The vector index within the uncompressed segment.
|
|
sel_t | N |
| | The amount of updated tuples.
|
|
sel_t | max |
| | The maximum amount of tuples that can fit into this UpdateInfo.
|
|
UndoBufferPointer | prev |
| | The previous update info (or nullptr if it is the base).
|
|
UndoBufferPointer | next |
| | The next update info in the chain (or nullptr if it is the last).
|
UpdateInfo is a class that represents a set of updates applied to a single vector. The UpdateInfo struct contains metadata associated with the update. After the UpdateInfo, we must ALWAYS allocate the list of tuples and the data as contiguous arrays: [UpdateInfo][TUPLES (sel_t[max])][DATA (T[max])] The required allocation size can be obtained using UpdateInfo::GetAllocSize
◆ GetTuples()
| sel_t * duckdb::UpdateInfo::GetTuples |
( |
| ) |
|
The row ids of the tuples that have been updated. This should always be kept sorted!
438921 {
438922 return reinterpret_cast<sel_t *
>(data_ptr_cast(
this) +
sizeof(UpdateInfo));
438923}
uint32_t sel_t
Type used for the selection vector.
Definition duckdb.hpp:251
◆ GetValues()
| data_ptr_t duckdb::UpdateInfo::GetValues |
( |
| ) |
|
The update values.
438925 {
438926 return reinterpret_cast<data_ptr_t
>(data_ptr_cast(
this) +
sizeof(UpdateInfo) +
sizeof(
sel_t) *
max);
438927}
sel_t max
The maximum amount of tuples that can fit into this UpdateInfo.
Definition duckdb.cpp:438787
◆ GetData()
template<class T>
| T * duckdb::UpdateInfo::GetData |
( |
| ) |
|
|
inline |
438800 {
438801 return reinterpret_cast<T *
>(
GetValues());
438802 }
data_ptr_t GetValues()
The update values.
Definition duckdb.cpp:438925
◆ AppliesToTransaction()
438804 {
438805
438806
438808
438809 return true;
438810 }
438812 }
atomic< transaction_t > version_number
The version number.
Definition duckdb.cpp:438781
◆ UpdatesForTransaction()
Loop over the update chain and execute the specified callback on all UpdateInfo's that are relevant for that transaction in-order of newest to oldest
438818 {
438819 if (current.AppliesToTransaction(start_time, transaction_id)) {
438820 callback(current);
438821 }
438822 auto update_ptr = current.next;
438823 while (update_ptr.IsSet()) {
438824 auto pin = update_ptr.Pin();
438825 auto &info = Get(pin);
438826 if (info.AppliesToTransaction(start_time, transaction_id)) {
438827 callback(info);
438828 }
438829 update_ptr = info.next;
438830 }
438831 }
◆ GetValue()
438888 {
438889 auto &type =
segment->column_data.type;
438890
438892 switch (type.id()) {
438893 case LogicalTypeId::VALIDITY:
438894 return Value::BOOLEAN(
reinterpret_cast<bool *
>(tuple_data)[index]);
438895 case LogicalTypeId::INTEGER:
438897 default:
438898 throw NotImplementedException("Unimplemented type for UpdateInfo::GetValue");
438899 }
438900}
static DUCKDB_API Value INTEGER(int32_t value)
Create an integer Value from a specified value.
Definition duckdb.cpp:132139
static DUCKDB_API Value BOOLEAN(bool value)
Create a boolean Value from a specified value.
Definition duckdb.cpp:132118
UpdateSegment * segment
The update segment that this update info affects.
Definition duckdb.cpp:438773
◆ ToString()
| string duckdb::UpdateInfo::ToString |
( |
| ) |
|
438906 {
438907 auto &type =
segment->column_data.type;
438908 string result =
"Update Info [" + type.ToString() +
", Count: " +
to_string(
N) +
438911 for (
idx_t i = 0; i <
N; i++) {
438912 result +=
to_string(tuples[i]) +
": " + GetValue(i).ToString() +
"\n";
438913 }
438914 if (HasNext()) {
438915 auto next_pin =
next.Pin();
438916 result += "\nChild Segment: " + Get(next_pin).ToString();
438917 }
438918 return result;
438919}
std::string to_string(const T &value)
Definition duckdb.cpp:19425
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
sel_t * GetTuples()
The row ids of the tuples that have been updated. This should always be kept sorted!
Definition duckdb.cpp:438921
sel_t N
The amount of updated tuples.
Definition duckdb.cpp:438785
UndoBufferPointer next
The next update info in the chain (or nullptr if it is the last).
Definition duckdb.cpp:438791
◆ Print()
| void duckdb::UpdateInfo::Print |
( |
| ) |
|
438902 {
438904}
static DUCKDB_API void Print(OutputStream stream, const string &str)
Print the object to the stream.
Definition duckdb.cpp:92556
◆ Verify()
| void duckdb::UpdateInfo::Verify |
( |
| ) |
|
438957 {
438958#ifdef DEBUG
438960 for (
idx_t i = 1; i <
N; i++) {
438961 D_ASSERT(tuples[i] > tuples[i - 1] && tuples[i] < STANDARD_VECTOR_SIZE);
438962 }
438963#endif
438964}
◆ HasPrev()
| bool duckdb::UpdateInfo::HasPrev |
( |
| ) |
const |
438934 {
438935 return prev.entry;
438936}
UndoBufferPointer prev
The previous update info (or nullptr if it is the base).
Definition duckdb.cpp:438789
◆ HasNext()
| bool duckdb::UpdateInfo::HasNext |
( |
| ) |
const |
438938 {
438939 return next.entry;
438940}
◆ Get()
438929 {
438930 auto update_info = reinterpret_cast<UpdateInfo *>(entry.Ptr());
438931 return *update_info;
438932}
◆ GetAllocSize()
| idx_t duckdb::UpdateInfo::GetAllocSize |
( |
idx_t | type_size | ) |
|
|
static |
Returns the total allocation size for an UpdateInfo entry, together with space for the tuple data.
438942 {
438944}
static T AlignValue(T n)
Align value (ceiling) (not for pointer types).
Definition duckdb.hpp:2126
◆ Initialize()
Initialize an UpdateInfo struct that has been allocated using GetAllocSize (i.e. has extra space after it).
438947 {
438948 info.max = STANDARD_VECTOR_SIZE;
438950 info.version_number = transaction_id;
438951 info.table = &data_table;
438952 info.segment = nullptr;
438953 info.prev.entry = nullptr;
438954 info.next.entry = nullptr;
438955}
idx_t row_group_start
The start index of the row group.
Definition duckdb.cpp:438779
The documentation for this struct was generated from the following file: