( tableName: string, tableSchema: string | undefined, partitions: number | readonly string[], )
| 316 | const createPartitionBound = (value: string): string => normalizePartitionBound(value); |
| 317 | |
| 318 | const createHashPartitions = ( |
| 319 | tableName: string, |
| 320 | tableSchema: string | undefined, |
| 321 | partitions: number | readonly string[], |
| 322 | ): TablePartition[] => { |
| 323 | const count = typeof partitions === 'number' ? partitions : partitions.length; |
| 324 | |
| 325 | return Array.from({ length: count }, (_, remainder) => { |
| 326 | const bound = normalizePartitionBound(`with (modulus ${count}, remainder ${remainder})`); |
| 327 | |
| 328 | if (typeof partitions === 'number') { |
| 329 | return { name: `${tableName}_${remainder}`, schema: tableSchema, bound }; |
| 330 | } |
| 331 | |
| 332 | const { name, schema } = splitPartitionName(partitions[remainder]); |
| 333 | return { name, schema: schema ?? tableSchema, bound }; |
| 334 | }); |
| 335 | }; |
| 336 | |
| 337 | const createExplicitPartitions = ( |
| 338 | tableName: string, |
no test coverage detected