Skip to main content

Module parser

Module parser 

Source
Expand description

§Query Statement Parser

Lightweight keyword-based parser for CQL DML statements in the query engine.

§Purpose

This module parses SELECT, INSERT, UPDATE, and DELETE statements for execution by the M2+ query engine. It uses keyword extraction rather than full AST parsing to provide fast, lightweight query handling.

§Architecture Context

This is one of four parsing subsystems in cqlite-core:

ModulePurpose
cql/Full CQL text → AST parsing
parser/SSTable binary format parsing
schema/cql_parser.rsCREATE TABLE → TableSchema
query/parser.rsDML → ParsedQuery (this module)

See docs/architecture/parser-overview.md for the complete architecture overview.

§Key Components

§Supported Statements

  • SELECT - With WHERE (equality only for M2), ORDER BY, LIMIT
  • INSERT - Explicit or implicit column syntax
  • UPDATE - SET clause with WHERE
  • DELETE - FROM with WHERE
  • CREATE TABLE / DROP TABLE - Table name extraction
  • DESCRIBE / USE - Basic keyword parsing

§Example

use cqlite_core::query::QueryParser;

let parser = QueryParser::new(&config);
let query = parser.parse("SELECT * FROM users WHERE id = 1 LIMIT 10")?;
assert_eq!(query.query_type, QueryType::Select);

§M2 Limitations

The M2 milestone supports a subset of CQL SELECT:

  • Partition key equality filters only (=)
  • No range operators (>, <, >=, <=)
  • No aggregates (COUNT, SUM, etc.)
  • No ALLOW FILTERING

For advanced CQL parsing with full AST support, use the crate::cql module.

Structs§

QueryParser
CQL query parser