@@ -208,13 +208,6 @@ public final class OmFileWriterArray<OmType: OmFileArrayDataTypeProtocol, FileHa
208
208
self . scale_factor = scale_factor
209
209
self . add_offset = add_offset
210
210
211
- if OmType . dataTypeArray == . string_array {
212
- // string arrays need to have chunk dimensions of 1
213
- if !chunkDimensions. allSatisfy ( { $0 == 1 } ) {
214
- throw OmFileFormatSwiftError . omEncoder ( error: " String arrays need to have chunk dimensions of 1 " )
215
- }
216
- }
217
-
218
211
// Note: The encoder keeps the pointer to `&self.dimensions`. It is important that this array is not deallocated!
219
212
self . encoder = OmEncoder_t ( )
220
213
let error = om_encoder_init ( & encoder, scale_factor, add_offset, compression. toC ( ) , OmType . dataTypeArray. toC ( ) , & self . dimensions, & self . chunks, UInt64 ( dimensions. count) )
@@ -428,12 +421,12 @@ public final class OmFileWriterStringArray<FileHandle: OmFileWriterBackend> {
428
421
buffer. incrementWritePosition ( by: lutSize)
429
422
430
423
return OmFileWriterArrayFinalised (
431
- scale_factor: 0 , // these are fake entries we don't really need, but wasting 4 bytes is fine
432
- add_offset: 0 , // these are fake entries we don't really need, but wasting 4 bytes is fine
424
+ scale_factor: 0 , // these are fake entries we don't need, will not be written to the file for string arrays
425
+ add_offset: 0 , // these are fake entries we don't need, will not be written to the file for string arrays
433
426
compression: . none,
434
427
datatype: . string_array,
435
428
dimensions: dimensions,
436
- chunks: dimensions . map { _ in 1 } , // one string per chunk
429
+ chunks: [ ] , // this is a fake entry we don't need, will not be written to the file for string arrays
437
430
lutSize: UInt64 ( lutSize) ,
438
431
lutOffset: UInt64 ( lutOffset)
439
432
)
0 commit comments