@@ -55,7 +55,7 @@ var DefaultConvertOpts = convertOpts{
5555 readConcurrency : runtime .GOMAXPROCS (0 ),
5656 writeConcurrency : 1 ,
5757 maxSamplesPerChunk : tsdb .DefaultSamplesPerChunk ,
58- maxNumColumns : parquet .MaxColumnIndex , // 32767 - max column index supported by parquet-go
58+ maxNumColumns : parquet .MaxColumnIndex , // max column index supported by parquet-go
5959}
6060
6161type Convertible interface {
@@ -283,7 +283,7 @@ func WithMaxSamplesPerChunk(samplesPerChunk int) ConvertOption {
283283}
284284
285285// WithMaxNumColumns sets the maximum number of columns allowed in a Parquet file.
286- // Parquet has a limit of approximately 32767 columns (MaxInt16) . When this limit is exceeded,
286+ // Parquet-go library has a limit of max column index supported . When this limit is exceeded,
287287// the conversion will automatically shard the data into multiple files. This option allows
288288// users to control the number of columns in the converted parquet file.
289289//
@@ -292,7 +292,7 @@ func WithMaxSamplesPerChunk(samplesPerChunk int) ConvertOption {
292292// 998 unique label names can be included in a single shard.
293293//
294294// Parameters:
295- // - maxColumns: Maximum number of columns per Parquet file, including system columns (default: 32767)
295+ // - maxColumns: Maximum number of columns per Parquet file, including system columns
296296//
297297// Example:
298298//
@@ -492,7 +492,8 @@ func singleTSDBRowReader(
492492 }
493493
494494 // If total unique label names exceed the limit, we need to shard based only on column limits.
495- if len (allLabelNames )+ systemColumns >= opts .maxNumColumns {
495+ // Equality is allowed (exactly maxNumColumns columns is fine).
496+ if len (allLabelNames )+ systemColumns > opts .maxNumColumns {
496497 indexReaders := make ([]blockIndexReader , len (blocks ))
497498 defer func () {
498499 for _ , indexReader := range indexReaders {
@@ -808,12 +809,12 @@ func shardSeries(
808809
809810 // Create a new shard if:
810811 // 1. Row-based sharding is enabled AND the row limit is reached, OR
811- // 2. Adding this series would exceed the column limit
812+ // 2. Adding this series would exceed the column limit (equality is allowed)
812813 shouldCreateNewShard := false
813814 if opts .numRowGroups != math .MaxInt32 && uniqueCount >= rowsPerShard {
814815 shouldCreateNewShard = true
815816 }
816- if len (labelColumns )+ newLabelCount + systemColumns >= opts .maxNumColumns {
817+ if len (labelColumns )+ newLabelCount + systemColumns > opts .maxNumColumns {
817818 shouldCreateNewShard = true
818819 }
819820
0 commit comments