package engine import ( "testing" "time" "github.com/seaweedfs/seaweedfs/weed/mq/topic" ) // A file's name is the start second of its first source log; MIN and MAX of _ts // come from the timestamp range the file records, and from names only without one. func TestSystemColumnTimestampRangePrefersFileStats(t *testing.T) { base := time.Date(2026, 11, 30, 10, 0, 0, 0, time.UTC) stats := map[string][]*ParquetFileStats{ "p0": { {FileName: topic.LogFileName(base, 0) + ".parquet", MinTimestampNs: base.Add(500 * time.Millisecond).UnixNano(), MaxTimestampNs: base.Add(9 * time.Second).UnixNano()}, {FileName: topic.LogFileName(base.Add(5*time.Second), 4) + ".parquet"}, }, } e := &SQLEngine{} if got, want := e.getSystemColumnGlobalMin(SW_COLUMN_NAME_TIMESTAMP, stats), base.Add(500*time.Millisecond).UnixNano(); got != want { t.Errorf("min %v, want %v", got, want) } if got, want := e.getSystemColumnGlobalMax(SW_COLUMN_NAME_TIMESTAMP, stats), base.Add(9*time.Second).UnixNano(); got != want { t.Errorf("max %v, want %v", got, want) } stats["p0"] = stats["p0"][1:] if got, want := e.getSystemColumnGlobalMax(SW_COLUMN_NAME_TIMESTAMP, stats), base.Add(5*time.Second).UnixNano(); got != want { t.Errorf("max without stats %v, want the name's %v", got, want) } }