{"record":{"id":"7b14f747a7b9b690","repo":"apache/shardingsphere","slug":"42000-7b14f7","errorCode":"42000","errorMessage":"Expected integer ID, got: %s","messagePattern":"Expected integer ID, got: (.+?)","errorType":"validation","errorClass":"SQLParsingException","httpStatus":null,"severity":"error","filePath":"parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java","lineNumber":781,"sourceCode":"        MySQLShowDatabasesStatement result = new MySQLShowDatabasesStatement(getDatabaseType(), filter, catalogName);\n        result.addParameterMarkers(getParameterMarkerSegments());\n        return result;\n    }\n    \n    @Override\n    public ASTNode visitShowDatabase(final ShowDatabaseContext ctx) {\n        return new DorisShowDatabaseStatement(getDatabaseType(), parseIntegerToken(ctx.NUMBER_()));\n    }\n    \n    @Override\n    public ASTNode visitShowTable(final ShowTableContext ctx) {\n        return new DorisShowTableStatement(getDatabaseType(), parseIntegerToken(ctx.NUMBER_()));\n    }\n    \n    private long parseIntegerToken(final TerminalNode token) {\n        String text = token.getText();\n        if (!text.chars().allMatch(Character::isDigit)) {\n            throw new SQLParsingException(String.format(\"Expected integer ID, got: %s\", text), text, token.getSymbol().getLine());\n        }\n        return Long.parseLong(text);\n    }\n    \n    @Override\n    public ASTNode visitShowEvents(final ShowEventsContext ctx) {\n        MySQLShowEventsStatement result = new MySQLShowEventsStatement(getDatabaseType(),\n                null == ctx.fromDatabase() ? null : (FromDatabaseSegment) visit(ctx.fromDatabase()), null == ctx.showFilter() ? null : (ShowFilterSegment) visit(ctx.showFilter()));\n        result.addParameterMarkers(getParameterMarkerSegments());\n        return result;\n    }\n    \n    @Override\n    public ASTNode visitShowTables(final ShowTablesContext ctx) {\n        MySQLShowTablesStatement result = new MySQLShowTablesStatement(getDatabaseType(), null == ctx.fromDatabase() ? null : (FromDatabaseSegment) visit(ctx.fromDatabase()),\n                null == ctx.showFilter() ? null : (ShowFilterSegment) visit(ctx.showFilter()), null != ctx.FULL());\n        result.addParameterMarkers(getParameterMarkerSegments());\n        return result;","sourceCodeStart":763,"sourceCodeEnd":799,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java#L763-L799","documentation":"Thrown by DorisDALStatementVisitor.parseIntegerToken when a SHOW DATABASES/SHOW TABLES-style statement in Doris carries a NUMBER_ token whose text is not all digits (e.g. a negative sign, decimal point, or a token like '1e3'). The visitor needs a long statement ID/limit, so any non-pure-digit text is rejected with 'Expected integer ID, got: <text>' plus the token text and line.","triggerScenarios":"Doris 'SHOW DATABASES <n>' / 'SHOW TABLE <n>' grammar where the NUMBER_ token matched something like '-1', '+5', '3.14', or a scientific-notation literal; parseIntegerToken's Character::isDigit check fails on the sign or dot, throwing before Long.parseLong.","commonSituations":"Statements ported from MySQL with a database ID literal; users writing 'SHOW DATABASES 1.0' or passing computed numeric strings; grammar changes where NUMBER_ starts matching previously-lexed tokens.","solutions":["Use a plain non-negative integer literal in the statement (no sign, decimal point, or exponent)","If the value comes from user input, validate it is an unsigned decimal integer string before building the SQL","Quote/bind the value through your own formatting so only digits reach the statement"],"exampleFix":"// before\nString sql = \"SHOW DATABASES -1\"; // sign not allowed\n\n// after\nString sql = \"SHOW DATABASES 1\";","handlingStrategy":"validation","validationCode":"// Validate unsigned integer before building Doris SHOW statement\nstatic String buildShowDb(long id) {\n    if (id < 0) throw new IllegalArgumentException(\"id must be non-negative\");\n    return \"SHOW DATABASES \" + id;\n}","typeGuard":null,"tryCatchPattern":"try { visitorEngine.parse(sql); } catch (SQLParsingException e) { return reject(\"SHOW ID must be an unsigned integer\"); }","preventionTips":["Always emit plain non-negative integer literals in Doris SHOW statements","Never interpolate signs, decimals, or exponents into the ID position"],"tags":["doris","dal","show-statement","integer-validation","visitor"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}