@@ -643,6 +643,7 @@ func TestSelectProjectionHints(t *testing.T) {
643643 projectionHintsIngesterBuffer time.Duration
644644 hasRemainingBlocks bool // Whether there are non-parquet (TSDB) blocks
645645 inputProjectionLabels []string
646+ inputProjectionInclude bool // Input ProjectionInclude value
646647 expectedProjectionLabels []string // nil means projection disabled
647648 expectedProjectionInclude bool
648649 }{
@@ -653,6 +654,7 @@ func TestSelectProjectionHints(t *testing.T) {
653654 projectionHintsIngesterBuffer : 1 * time .Hour ,
654655 hasRemainingBlocks : false ,
655656 inputProjectionLabels : []string {"__name__" , "job" },
657+ inputProjectionInclude : true ,
656658 expectedProjectionLabels : []string {"__name__" , "job" }, // Preserved
657659 expectedProjectionInclude : true ,
658660 },
@@ -663,6 +665,7 @@ func TestSelectProjectionHints(t *testing.T) {
663665 projectionHintsIngesterBuffer : 1 * time .Hour ,
664666 hasRemainingBlocks : true , // Mixed blocks
665667 inputProjectionLabels : []string {"__name__" , "job" },
668+ inputProjectionInclude : true ,
666669 expectedProjectionLabels : nil , // Reset
667670 expectedProjectionInclude : false ,
668671 },
@@ -673,6 +676,7 @@ func TestSelectProjectionHints(t *testing.T) {
673676 projectionHintsIngesterBuffer : 1 * time .Hour ,
674677 hasRemainingBlocks : false ,
675678 inputProjectionLabels : []string {"__name__" , "job" },
679+ inputProjectionInclude : true ,
676680 expectedProjectionLabels : nil , // Reset (maxT >= now - 2h - 1h = now - 3h)
677681 expectedProjectionInclude : false ,
678682 },
@@ -683,6 +687,7 @@ func TestSelectProjectionHints(t *testing.T) {
683687 projectionHintsIngesterBuffer : 1 * time .Hour ,
684688 hasRemainingBlocks : false ,
685689 inputProjectionLabels : []string {"__name__" , "job" },
690+ inputProjectionInclude : true ,
686691 expectedProjectionLabels : nil , // Reset (maxT = now - 2.5h, threshold = now - 3h, so 2.5h > 3h means disabled)
687692 expectedProjectionInclude : false ,
688693 },
@@ -693,6 +698,7 @@ func TestSelectProjectionHints(t *testing.T) {
693698 projectionHintsIngesterBuffer : 1 * time .Hour ,
694699 hasRemainingBlocks : false ,
695700 inputProjectionLabels : []string {"__name__" , "job" },
701+ inputProjectionInclude : true ,
696702 expectedProjectionLabels : nil , // Reset
697703 expectedProjectionInclude : false ,
698704 },
@@ -703,6 +709,7 @@ func TestSelectProjectionHints(t *testing.T) {
703709 projectionHintsIngesterBuffer : 1 * time .Hour ,
704710 hasRemainingBlocks : false ,
705711 inputProjectionLabels : []string {"__name__" , "job" },
712+ inputProjectionInclude : true ,
706713 expectedProjectionLabels : []string {"__name__" , "job" }, // Preserved
707714 expectedProjectionInclude : true ,
708715 },
@@ -713,6 +720,7 @@ func TestSelectProjectionHints(t *testing.T) {
713720 projectionHintsIngesterBuffer : 0 , // No buffer
714721 hasRemainingBlocks : false ,
715722 inputProjectionLabels : []string {"__name__" , "job" },
723+ inputProjectionInclude : true ,
716724 expectedProjectionLabels : []string {"__name__" , "job" }, // Preserved
717725 expectedProjectionInclude : true ,
718726 },
@@ -723,9 +731,21 @@ func TestSelectProjectionHints(t *testing.T) {
723731 projectionHintsIngesterBuffer : 1 * time .Hour ,
724732 hasRemainingBlocks : false ,
725733 inputProjectionLabels : []string {"__name__" , "job" },
734+ inputProjectionInclude : true ,
726735 expectedProjectionLabels : nil , // Reset
727736 expectedProjectionInclude : false ,
728737 },
738+ "projection disabled: ProjectionInclude is false, disable projection" : {
739+ minT : util .TimeToMillis (now .Add (- 10 * time .Hour )),
740+ maxT : util .TimeToMillis (now .Add (- 5 * time .Hour )),
741+ queryIngestersWithin : 2 * time .Hour ,
742+ projectionHintsIngesterBuffer : 1 * time .Hour ,
743+ hasRemainingBlocks : false ,
744+ inputProjectionLabels : []string {"job" },
745+ inputProjectionInclude : false ,
746+ expectedProjectionLabels : nil ,
747+ expectedProjectionInclude : false ,
748+ },
729749 }
730750
731751 for testName , testData := range tests {
@@ -782,7 +802,7 @@ func TestSelectProjectionHints(t *testing.T) {
782802 Start : testData .minT ,
783803 End : testData .maxT ,
784804 ProjectionLabels : testData .inputProjectionLabels ,
785- ProjectionInclude : true ,
805+ ProjectionInclude : testData . inputProjectionInclude ,
786806 }
787807
788808 // Execute Select
0 commit comments