iyashk-DB
Databricks Employee
Databricks Employee

The std::regex recursive executor in libstdc++ has been a known footgun for patterns like '[^\r\n]*' or '[\s\S]*?' over user-controlled input; every character consumed by the repetition adds a stack frame, so this was always going to blow up on long inputs.

For the immediate workaround: if your SQL is machine-generated and you have any control over the generator, inserting a newline periodically (or specifically after any -- sequence) is probably the most reliable short-term fix. It breaks the condition the regex needs to blow the stack. It's fragile for arbitrary input but works well for templated or DSL-generated queries.

On ARM you're stuck since 2.9.2 never shipped for that arch, so the line-break injection is the only viable path until a fix lands.