From 49a2d76d2be793f9aeddd9997ae8abba4a7f03f2 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sun, 10 Aug 2025 20:39:00 -0400 Subject: Fix approximate queries on nullable categories --- pkg/query/compiler.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pkg/query') diff --git a/pkg/query/compiler.go b/pkg/query/compiler.go index dc6f93a..7d24b10 100644 --- a/pkg/query/compiler.go +++ b/pkg/query/compiler.go @@ -146,6 +146,8 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error b.WriteString(") ") } else if cat.IsSet() && op == OP_AP { b.WriteString("( ") + b.WriteString(catStr) + b.WriteString("IS NOT NULL AND ") idx := 0 for _, stmt := range opStmts { b.WriteString(catStr) @@ -188,6 +190,11 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error } } else { idx := 0 + if op == OP_AP { + b.WriteString("( ") + b.WriteString(catStr) + b.WriteString("IS NOT NULL AND ") + } for _, stmt := range opStmts { if stmt.Negated { b.WriteString("NOT ") @@ -206,6 +213,9 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error idx++ sCount++ } + if op == OP_AP { + b.WriteString(") ") + } } if sCount != len(s) { -- cgit v1.2.3