Oriel — AI & technology worth noticing, every day.

Lua as a Query Language

Web page · https://remy.wang/blog/lua-ql.html

First seen by Oriel on .

AI summary

The post describes using Lua as a dynamic query syntax for Prela, building relational AST nodes in Lua and passing them to a Rust backend without writing a parser.

  • Lua operators and field access are overloaded to express filters, relation products, semijoins, projections, and views; local variables serve as CTEs.
  • For aggregations, closures operate on column AST nodes so Rust can apply reductions without calling back into Lua for every row.
  • A TPC-H Q18 example shows how Prela can avoid repeated GROUP BY attributes, explicit HAVING syntax, and noisy join conditions.
  • The approach trades parser development for Lua sandboxing, since executing arbitrary Lua would be unsafe; the prototype is described as rough.
  • Lua does not allow overloading comparison operators such as < and ==, which limits the syntax.

#lua #query languages #rust #relational algebra

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Points

Score reported by the source.

  • Hacker News: 108, latest observation ; +104 over observed period since

Comments

Comment count reported by the source.

  • Hacker News: 25, latest observation ; +25 over observed period since

Aliases

SourceExternal IDURL
Hacker News50683565https://remy.wang/blog/lua-ql.html Read discussion