v0.14 to v1 Parser Migration

If there are inaccuracies discovered with this documentation, please submit a GitHub issue.

This guide is intended to cover the differences between the PartiQLParser interfaces used in partiql-lang-kotlin v0.14 and partiql-lang-kotlin v1.

Major Changes

Initialization

PartiQLParser.default() was renamed to PartiQLParser.standard() to be consistent with static factory methods in the rest of the codebase.

Parsed AST

V1 now supports parsing multiple SQL statements in one parse call. A list of parsed AST statements is returned in the PartiQLParser.Result. The AST classes are refactored to different representations to support better backwards-compatibility. For more details on using the AST, please refer to AST Manipulation

Error Handling

PRuntimeException has replaced PartiQLParserException to trap any parsing errors. PRuntimeException wraps a PError which includes code, kind, severity, and properties in addition to location, which allows for more robust and customized error control.

Parsing with Custom Context

Starting in v1, users can now parse with a custom parsing context. This can allow users to specify their own PError listener to customize the handling of errors and warnings during parsing.

Examples

To use the PartiQLParser, we’ve provided more examples within the partiql-lang-kotlin library’s migration guide

Included in the code examples are how to