mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-28 16:00:37 +01:00
fix
This commit is contained in:
1 parent
eb03d05c97
commit
d192536376
4 files changed
+97
-337
No files matched your search
@@ -5,68 +5,6 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestTimeFilterExtraction tests the extraction of time filters from WHERE clauses
|
||||
func TestTimeFilterExtraction(t *testing.T) {
|
||||
_ = NewTestSQLEngine()
|
||||
|
||||
// Test data: use fixed timestamps for consistent testing
|
||||
|
||||
_ = []struct {
|
||||
name string
|
||||
whereClause string
|
||||
expectedStartNs int64
|
||||
expectedStopNs int64
|
||||
description string
|
||||
}{
|
||||
{
|
||||
name: "Greater Than Filter",
|
||||
whereClause: "_timestamp_ns > 1672531200000000000", // Fixed timestamp
|
||||
expectedStartNs: 1672531200000000000,
|
||||
expectedStopNs: 0, // No upper bound
|
||||
description: "Should extract start time from > comparison",
|
||||
},
|
||||
{
|
||||
name: "Less Than Filter",
|
||||
whereClause: "_timestamp_ns < 1672617600000000000", // Fixed timestamp
|
||||
expectedStartNs: 0, // No lower bound
|
||||
expectedStopNs: 1672617600000000000,
|
||||
description: "Should extract stop time from < comparison",
|
||||
},
|
||||
{
|
||||
name: "Range Filter (AND)",
|
||||
whereClause: "_timestamp_ns >= 1672531200000000000 AND _timestamp_ns <= 1672617600000000000",
|
||||
expectedStartNs: 1672531200000000000,
|
||||
expectedStopNs: 1672617600000000000,
|
||||
description: "Should extract both bounds from range query",
|
||||
},
|
||||
{
|
||||
name: "Equal Filter",
|
||||
whereClause: "_timestamp_ns = 1672531200000000000",
|
||||
expectedStartNs: 1672531200000000000,
|
||||
expectedStopNs: 1672531200000000000,
|
||||
description: "Should set both bounds for exact match",
|
||||
},
|
||||
{
|
||||
name: "Non-Time Filter",
|
||||
whereClause: "user_id > 1000",
|
||||
expectedStartNs: 0,
|
||||
expectedStopNs: 0,
|
||||
description: "Should ignore non-time comparisons",
|
||||
},
|
||||
{
|
||||
name: "OR Filter (Skip)",
|
||||
whereClause: "_timestamp_ns > 1672531200000000000 OR user_id = 123",
|
||||
expectedStartNs: 0,
|
||||
expectedStopNs: 0,
|
||||
description: "Should skip time extraction for OR clauses (unsafe)",
|
||||
},
|
||||
}
|
||||
|
||||
// TODO: Rewrite this test to work with the PostgreSQL parser instead of sqlparser
|
||||
// The test has been temporarily disabled while migrating from sqlparser to native PostgreSQL parser
|
||||
t.Skip("Test disabled during sqlparser removal - needs rewrite for PostgreSQL parser")
|
||||
}
|
||||
|
||||
// TestTimeColumnRecognition tests the recognition of time-related columns
|
||||
func TestTimeColumnRecognition(t *testing.T) {
|
||||
engine := NewTestSQLEngine()
|
||||
@@ -111,15 +49,6 @@ func TestTimeColumnRecognition(t *testing.T) {
|
||||
t.Log("Time column recognition working correctly")
|
||||
}
|
||||
|
||||
// TestTimeValueParsing tests parsing of different time value formats
|
||||
func TestTimeValueParsing(t *testing.T) {
|
||||
_ = NewTestSQLEngine()
|
||||
|
||||
// TODO: Rewrite this test to work without sqlparser types
|
||||
// The test has been temporarily disabled while migrating from sqlparser to native PostgreSQL parser
|
||||
t.Skip("Test disabled during sqlparser removal - needs rewrite for PostgreSQL parser")
|
||||
}
|
||||
|
||||
// TestTimeFilterIntegration tests the full integration of time filters with SELECT queries
|
||||
func TestTimeFilterIntegration(t *testing.T) {
|
||||
engine := NewTestSQLEngine()
|
||||
|
||||
Reference in new issue
Block a user