clients/nim-allographer/src/allographer/query_builder/models/baradb/baradb_exec.nim src/barabadb/core/mvcc.nim src/barabadb/query/codegen.nim src/barabadb/query/lexer.nim src/barabadb/query/parser.nim src/barabadb/query/udf.nim tests/test_all.nim
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

This commit is contained in:
2026-05-25 18:56:02 +03:00
parent 0c7847abba
commit a37a62c69e
7 changed files with 34 additions and 26 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ proc write*(tm: TxnManager, txn: Transaction, key: string, value: seq[byte]): bo
if victimId in tm.activeTxns:
tm.activeTxns[victimId].state = tsAborted
tm.activeTxns.del(victimId)
tm.deadlockDetector.removeWait(uint64(txn.id), uint64(otherId))
# Keep the wait edge so subsequent transactions can detect cycles
release(tm.lock)
return false # write-write conflict with uncommitted txn
+1
View File
@@ -1,5 +1,6 @@
## Codegen — compile IR plan to storage operations
import std/strutils
import ../core/types
import ../query/ir
type
+4 -4
View File
@@ -547,11 +547,11 @@ proc readNumber(l: var Lexer, startLine, startCol: int): Token =
proc readIdent(l: var Lexer, startLine, startCol: int): Token =
var ident = ""
while l.pos < l.input.len:
let r = l.peekRune()
var p = l.pos
var r: Rune
fastRuneAt(l.input, p, r, true)
if isIdentPartRune(r):
var run: Rune
fastRuneAt(l.input, l.pos, run, true)
ident.add($run)
ident.add($r)
inc l.col
discard l.advanceRune()
else:
+16 -11
View File
@@ -35,7 +35,7 @@ proc match(p: var Parser, kind: TokenKind): bool =
return false
# Token kinds that can also serve as identifiers in table/column name positions
const identLikeKinds = {tkIdent, tkLabels, tkCount, tkSum, tkAvg, tkMin, tkMax, tkArrayAgg, tkStringAgg}
const identLikeKinds = {tkIdent, tkLabels, tkCount, tkSum, tkAvg, tkMin, tkMax, tkArrayAgg, tkStringAgg, tkJsonFmt, tkArray, tkVector, tkGraph, tkDocument}
proc expectIdent(p: var Parser): Token =
## Expect a token that can serve as an identifier (table name, column name, alias, etc.).
@@ -1154,16 +1154,21 @@ proc parseCreateTable(p: var Parser): Node =
# Parse column definition
let colName = p.expectIdent().value
var colType = ""
if p.peek().kind == tkIdent:
colType = p.advance().value.toUpper()
if p.peek().kind == tkLParen:
discard p.advance()
let size = p.expect(tkIntLit).value
colType &= "(" & size & ")"
discard p.expect(tkRParen)
elif p.peek().kind == tkVector:
discard p.advance()
colType = "VECTOR"
let typeKinds = {tkIdent, tkVector, tkJsonFmt, tkArray, tkDocument, tkGraph}
if p.peek().kind in typeKinds:
let typeTok = p.advance()
if typeTok.kind == tkVector:
colType = "VECTOR"
elif typeTok.kind == tkJsonFmt:
colType = "JSON"
elif typeTok.kind == tkArray:
colType = "ARRAY"
elif typeTok.kind == tkDocument:
colType = "DOCUMENT"
elif typeTok.kind == tkGraph:
colType = "GRAPH"
else:
colType = typeTok.value.toUpper()
if p.peek().kind == tkLParen:
discard p.advance()
let size = p.expect(tkIntLit).value
+5 -5
View File
@@ -191,7 +191,7 @@ proc registerStdlib*(reg: UDFRegistry) =
let length = int(args[2].int64Val)
let endIdx = min(start + length, s.len)
return Value(kind: vkString, strVal: s[start ..< endIdx])
return Value(kind: vkString, strVal: s[start])
return Value(kind: vkString, strVal: s[start .. start])
return Value(kind: vkNull))
# Type conversion
@@ -240,11 +240,11 @@ proc registerStdlib*(reg: UDFRegistry) =
else: discard
elif (item.kind in {vkInt64, vkInt32, vkFloat64}) and
(target.kind in {vkInt64, vkInt32, vkFloat64}):
let a = case item.kind of vkInt64: float64(item.int64Val)
of vkInt32: float64(item.int32Val)
let a = if item.kind == vkInt64: float64(item.int64Val)
elif item.kind == vkInt32: float64(item.int32Val)
else: item.float64Val
let b = case target.kind of vkInt64: float64(target.int64Val)
of vkInt32: float64(target.int32Val)
let b = if target.kind == vkInt64: float64(target.int64Val)
elif target.kind == vkInt32: float64(target.int32Val)
else: target.float64Val
if a == b:
return Value(kind: vkBool, boolVal: true)