| 121 | class TupleDescriptor; |
| 122 | |
| 123 | class SlotDescriptor { |
| 124 | public: |
| 125 | SlotId id() const { return id_; } |
| 126 | const ColumnType& type() const { return type_; } |
| 127 | const TupleDescriptor* parent() const { return parent_; } |
| 128 | const TupleDescriptor* children_tuple_descriptor() const { |
| 129 | return children_tuple_descriptor_; |
| 130 | } |
| 131 | /// Returns the column index of this slot, including partition keys. |
| 132 | /// (e.g., col_pos - num_partition_keys = the table column this slot corresponds to) |
| 133 | /// TODO: This function should eventually be replaced by col_path(). It is currently |
| 134 | /// convenient for table formats for which we only support flat data. |
| 135 | int col_pos() const { return col_path_[0]; } |
| 136 | const SchemaPath& col_path() const { return col_path_; } |
| 137 | |
| 138 | /// Returns the field index in the generated llvm struct for this slot's tuple. |
| 139 | /// The 'llvm_field_idx' is the index of the slot in the llvm codegen'd tuple struct. |
| 140 | /// This takes into account any padding bytes. |
| 141 | int llvm_field_idx() const { return slot_idx_; } |
| 142 | |
| 143 | int tuple_offset() const { return tuple_offset_; } |
| 144 | const NullIndicatorOffset& null_indicator_offset() const { |
| 145 | return null_indicator_offset_; |
| 146 | } |
| 147 | bool is_nullable() const { return null_indicator_offset_.bit_mask != 0; } |
| 148 | int slot_size() const { return slot_size_; } |
| 149 | |
| 150 | TVirtualColumnType::type virtual_column_type() const { return virtual_column_type_; } |
| 151 | bool IsVirtual() const { return virtual_column_type_ != TVirtualColumnType::NONE; } |
| 152 | |
| 153 | std::optional<int32_t> struct_field_idx() const { return struct_field_idx_; } |
| 154 | |
| 155 | /// Comparison function for ordering slot descriptors by their col_path_. |
| 156 | /// Returns true if 'a' comes before 'b'. |
| 157 | /// Orders the paths as in a depth-first traversal of the schema tree, as follows: |
| 158 | /// - for each level i in min(a.path.size, b.path.size), |
| 159 | /// order the paths ascending by col_path_[i] |
| 160 | /// - in case of ties, the path with smaller size comes first |
| 161 | static bool ColPathLessThan(const SlotDescriptor* a, const SlotDescriptor* b); |
| 162 | |
| 163 | std::string DebugString() const; |
| 164 | |
| 165 | /// Return true if the physical layout of this descriptor matches the physical layout |
| 166 | /// of other_desc, but not necessarily ids. |
| 167 | bool LayoutEquals(const SlotDescriptor& other_desc) const; |
| 168 | |
| 169 | /// Load "any_val"'s value from 'raw_val_ptr', which must be a pointer to the matching |
| 170 | /// native type, e.g. a StringValue or TimestampValue slot in a tuple. |
| 171 | static void CodegenLoadAnyVal(CodegenAnyVal* any_val, llvm::Value* raw_val_ptr); |
| 172 | |
| 173 | /// Generate LLVM code at the insert position of 'builder' that returns a boolean value |
| 174 | /// represented as a LLVM i1 indicating whether this slot is null in 'tuple'. |
| 175 | llvm::Value* CodegenIsNull( |
| 176 | LlvmCodeGen* codegen, LlvmBuilder* builder, llvm::Value* tuple) const; |
| 177 | |
| 178 | /// Generate LLVM code at the insert position of 'builder' that returns a boolean value |
| 179 | /// represented as a LLVM i1 with value of the NULL bit at 'null_indicator_offset' in |
| 180 | /// 'tuple'. |
nothing calls this directly
no test coverage detected