MCPcopy Create free account
hub / github.com/apache/arrow / device_types

Method device_types

cpp/src/arrow/datum.cc:160–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160DeviceAllocationTypeSet Datum::device_types() const {
161 switch (kind()) {
162 case NONE:
163 break;
164 case SCALAR:
165 // Scalars are asssumed as always residing in CPU memory for now.
166 return DeviceAllocationTypeSet::CpuOnly();
167 case ARRAY:
168 return DeviceAllocationTypeSet{array()->device_type()};
169 case CHUNKED_ARRAY:
170 return chunked_array()->device_types();
171 case RECORD_BATCH: {
172 auto& columns = record_batch()->columns();
173 if (columns.empty()) {
174 // An empty RecordBatch is considered to be CPU-only.
175 return DeviceAllocationTypeSet::CpuOnly();
176 }
177 DeviceAllocationTypeSet set;
178 for (const auto& column : columns) {
179 set.add(column->device_type());
180 }
181 return set;
182 }
183 case TABLE: {
184 auto& columns = table()->columns();
185 if (columns.empty()) {
186 // An empty Table is considered to be CPU-only.
187 return DeviceAllocationTypeSet::CpuOnly();
188 }
189 DeviceAllocationTypeSet set;
190 for (const auto& column : columns) {
191 set.Add(column->device_types());
192 }
193 return set;
194 }
195 }
196 return {};
197}
198
199bool Datum::Equals(const Datum& other) const {
200 if (this->kind() != other.kind()) return false;

Callers

nothing calls this directly

Calls 8

CpuOnlyFunction · 0.85
arrayFunction · 0.85
record_batchFunction · 0.85
columnsMethod · 0.80
kindFunction · 0.70
device_typeMethod · 0.45
emptyMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected