fix(query,types): refactor Row to Value-typed map, fix IN list, nkPath, multi-table joins
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled

- Refactored Row from Table[string, string] to Table[string, Value]
- Added Value operators: ==, !=, $, in for string interop
- Fixed valueToString for vkNull to return '\\N' instead of ''
- Fixed evalExpr irekField to return vkNull when field not found
- Added IN (val1, val2, ...) parser support
- Fixed nkPath column names in multi-table joins
- Fixed LATERAL JOIN null padding when no matching rows
- Added CREATE/DROP/USE/SHOW DATABASE parser support
- Adapted all tests for new Value type
This commit is contained in:
2026-05-20 23:22:14 +03:00
parent 57d2908066
commit 372e5cf627
14 changed files with 1084 additions and 346 deletions
+48
View File
@@ -1646,6 +1646,42 @@ proc parseDropGraph(p: var Parser): Node =
result = Node(kind: nkDropGraph, dgName: name, dgIfExists: ifExists,
line: tok.line, col: tok.col)
proc parseCreateDatabase(p: var Parser): Node =
let tok = p.expect(tkCreate)
discard p.expect(tkDatabase)
var ifNotExists = false
if p.peek().kind == tkIf:
discard p.advance()
discard p.expect(tkNot)
discard p.expect(tkExists)
ifNotExists = true
let name = p.expect(tkIdent).value
result = Node(kind: nkCreateDatabase, cdDbName: name, cdIfNotExists: ifNotExists,
line: tok.line, col: tok.col)
proc parseDropDatabase(p: var Parser): Node =
let tok = p.expect(tkDrop)
discard p.expect(tkDatabase)
var ifExists = false
if p.peek().kind == tkIf:
discard p.advance()
discard p.expect(tkExists)
ifExists = true
let name = p.expect(tkIdent).value
result = Node(kind: nkDropDatabase, ddDbName: name, ddIfExists: ifExists,
line: tok.line, col: tok.col)
proc parseUseDatabase(p: var Parser): Node =
let tok = p.expect(tkUse)
let name = p.expect(tkIdent).value
result = Node(kind: nkUseDatabase, udDbName: name,
line: tok.line, col: tok.col)
proc parseShowDatabases(p: var Parser): Node =
let tok = p.expect(tkShow)
discard p.expect(tkDatabases)
result = Node(kind: nkShowDatabases, line: tok.line, col: tok.col)
proc parseStatement*(p: var Parser): Node =
case p.peek().kind
of tkWith, tkSelect: p.parseSelect()
@@ -1674,6 +1710,8 @@ proc parseStatement*(p: var Parser): Node =
p.parseCreatePolicy()
elif next.kind == tkGraph:
p.parseCreateGraph()
elif next.kind == tkDatabase:
p.parseCreateDatabase()
else:
p.parseCreateType()
else:
@@ -1695,6 +1733,8 @@ proc parseStatement*(p: var Parser): Node =
p.parseDropPolicy()
elif next.kind == tkGraph:
p.parseDropGraph()
elif next.kind == tkDatabase:
p.parseDropDatabase()
else:
let tok = p.advance()
Node(kind: nkNullLit, line: tok.line, col: tok.col)
@@ -1713,6 +1753,14 @@ proc parseStatement*(p: var Parser): Node =
p.parseRevoke()
of tkSet:
p.parseSetVar()
of tkUse:
p.parseUseDatabase()
of tkShow:
if p.pos + 1 < p.tokens.len and p.tokens[p.pos + 1].kind == tkDatabases:
p.parseShowDatabases()
else:
let tok = p.advance()
Node(kind: nkNullLit, line: tok.line, col: tok.col)
of tkApply:
if p.pos + 1 < p.tokens.len and p.tokens[p.pos + 1].kind == tkMigration:
p.parseApplyMigration()