aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/query
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/query')
-rw-r--r--pkg/query/compiler.go11
-rw-r--r--pkg/query/errors.go1
-rw-r--r--pkg/query/lexer.go4
-rw-r--r--pkg/query/optimizer.go3
4 files changed, 14 insertions, 5 deletions
diff --git a/pkg/query/compiler.go b/pkg/query/compiler.go
index 7d24b10..2272933 100644
--- a/pkg/query/compiler.go
+++ b/pkg/query/compiler.go
@@ -103,6 +103,13 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error
}
}
+ // NOTE: cases
+ // cat op
+ // any re
+ // .isOrd ap
+ // .isSet !ap
+ // .isSet ap
+ // any any
if op == OP_RE {
idx := 0
for _, stmt := range opStmts {
@@ -197,6 +204,8 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error
}
for _, stmt := range opStmts {
if stmt.Negated {
+ // FIXME: doesn't evaluate correctly for when using MATCH operator in SQL
+ // a potential fix for negated statements is using an EXCEPT-like subquery
b.WriteString("NOT ")
}
b.WriteString(catStr)
@@ -278,7 +287,7 @@ func (c Clause) buildCompile(b *strings.Builder) ([]any, error) {
}
if !isRoot {
- b.WriteString(") ")
+ b.WriteString(")")
}
return args, nil
diff --git a/pkg/query/errors.go b/pkg/query/errors.go
index 889d40d..713e9f0 100644
--- a/pkg/query/errors.go
+++ b/pkg/query/errors.go
@@ -16,7 +16,6 @@ var ErrExpectedMoreStringTokens = errors.New("Expected more string tokens")
var ErrUnexpectedValueType = errors.New("Unexpected value type")
var ErrEmptyResult = errors.New("Queries are contradictory, will lead to an empty result")
-
type TokenError struct {
got Token
gotPrev Token
diff --git a/pkg/query/lexer.go b/pkg/query/lexer.go
index 0ebdb1d..bdb09ef 100644
--- a/pkg/query/lexer.go
+++ b/pkg/query/lexer.go
@@ -130,6 +130,10 @@ func (t queryTokenType) isCategory() bool {
TOK_CAT_META)
}
+func (t queryTokenType) isOrdered() bool {
+ return t == TOK_CAT_DATE || t == TOK_CAT_FILETIME
+}
+
func (t queryTokenType) isDateOperation() bool {
return t.Any(TOK_OP_EQ, TOK_OP_AP, TOK_OP_NE, TOK_OP_LT, TOK_OP_LE, TOK_OP_GE, TOK_OP_GT)
}
diff --git a/pkg/query/optimizer.go b/pkg/query/optimizer.go
index 337ee35..21de619 100644
--- a/pkg/query/optimizer.go
+++ b/pkg/query/optimizer.go
@@ -9,9 +9,6 @@ import (
"github.com/jpappel/atlas/pkg/util"
)
-// FIXME: any substring checks on unorderd approximate statements will fail
-// this is because quotes are added to all approximate string values
-
type Optimizer struct {
workers uint
root *Clause