Pragmas
Pragmas control various language features and appear in a declaration block so their effect is lexically scoped. They have the form
pragma <id> [ = <expr> ]
where <id> is an identifier
and <expr> is a constant expression
that must evaluate at compile time without referencing any
runtime state such as this or a field of this.
If <expr> is omitted, it defaults to true.
Pragmas must appear in the declaration section of a scope.
List of Pragmas
Currently, there are two supported pragmas.
index_base- controls whether index expressions and slice expressions are 0-based or 1-based.0for zero-based indexing1for one-based indexing
pg- controls the precedence of scoping for GROUP BY clauses in SQL operatorsfalseto follow Google SQL semantics of resolving identifiers first from column aliases then from the input tabletrueto follow PostgreSQL semantics of resolving identifiers first from the input table then from the column aliases
Example
Controlling indexing and slicing
# spq
pragma index_base = 1
values {
a: this[2:3],
b: (
pragma index_base = 0
values this[0]
)
}
# input
"bar"
[1,2,3]
# expected output
{a:"a",b:error("missing")}
{a:[2],b:1}