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

Method device_types

cpp/src/arrow/datum.cc:175–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175DeviceAllocationTypeSet Datum::device_types() const {
176 switch (kind()) {
177 case NONE:
178 break;
179 case SCALAR:
180 // Scalars are asssumed as always residing in CPU memory for now.
181 return DeviceAllocationTypeSet::CpuOnly();
182 case ARRAY:
183 return DeviceAllocationTypeSet{array()->device_type()};
184 case CHUNKED_ARRAY:
185 return chunked_array()->device_types();
186 case RECORD_BATCH: {
187 auto& columns = record_batch()->columns();
188 if (columns.empty()) {
189 // An empty RecordBatch is considered to be CPU-only.
190 return DeviceAllocationTypeSet::CpuOnly();
191 }
192 DeviceAllocationTypeSet set;
193 for (const auto& column : columns) {
194 set.add(column->device_type());
195 }
196 return set;
197 }
198 case TABLE: {
199 auto& columns = table()->columns();
200 if (columns.empty()) {
201 // An empty Table is considered to be CPU-only.
202 return DeviceAllocationTypeSet::CpuOnly();
203 }
204 DeviceAllocationTypeSet set;
205 for (const auto& column : columns) {
206 set.Add(column->device_types());
207 }
208 return set;
209 }
210 }
211 return {};
212}
213
214bool Datum::Equals(const Datum& other) const {
215 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