1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
package engine
import "fmt"
// Error types for better error handling and testing
// AggregationError represents errors that occur during aggregation computation
type AggregationError struct {
Operation string
Column string
Cause error
}
func (e AggregationError) Error() string {
return fmt.Sprintf("aggregation error in %s(%s): %v", e.Operation, e.Column, e.Cause)
}
// DataSourceError represents errors that occur when accessing data sources
type DataSourceError struct {
Source string
Cause error
}
func (e DataSourceError) Error() string {
return fmt.Sprintf("data source error in %s: %v", e.Source, e.Cause)
}
// OptimizationError represents errors that occur during query optimization
type OptimizationError struct {
Strategy string
Reason string
}
func (e OptimizationError) Error() string {
return fmt.Sprintf("optimization failed for %s: %s", e.Strategy, e.Reason)
}
// ParseError represents SQL parsing errors
type ParseError struct {
Query string
Message string
Cause error
}
func (e ParseError) Error() string {
if e.Cause != nil {
return fmt.Sprintf("SQL parse error: %s (%v)", e.Message, e.Cause)
}
return fmt.Sprintf("SQL parse error: %s", e.Message)
}
// TableNotFoundError represents table/topic not found errors
type TableNotFoundError struct {
Database string
Table string
}
func (e TableNotFoundError) Error() string {
if e.Database != "" {
return fmt.Sprintf("table %s.%s not found", e.Database, e.Table)
}
return fmt.Sprintf("table %s not found", e.Table)
}
// ColumnNotFoundError represents column not found errors
type ColumnNotFoundError struct {
Table string
Column string
}
func (e ColumnNotFoundError) Error() string {
if e.Table != "" {
return fmt.Sprintf("column %s not found in table %s", e.Column, e.Table)
}
return fmt.Sprintf("column %s not found", e.Column)
}
// UnsupportedFeatureError represents unsupported SQL features
type UnsupportedFeatureError struct {
Feature string
Reason string
}
func (e UnsupportedFeatureError) Error() string {
if e.Reason != "" {
return fmt.Sprintf("feature not supported: %s (%s)", e.Feature, e.Reason)
}
return fmt.Sprintf("feature not supported: %s", e.Feature)
}
|