Running the following code results in a segfault:
std::string query = "SELECT DISTINCT TOP 3 value, id FROM TableA";
hsql::SQLParserResult result;
hsql::SQLParser::parse(query, &result);
const hsql::SQLStatement* stmt = result.getStatement(0);
DISTINCT and TOP clauses are handled correctly when used individually, the problem seems to happen only when both are used at the same time.
Also not happening when using a LIMIT clause instead of the TOP.