apache/beam · error · ParseException
Expected SHOW CURRENT CATALOG or SHOW CURRENT DATABASE
Error message
Expected SHOW CURRENT CATALOG or SHOW CURRENT DATABASE
What it means
A parse-time error from Beam SQL's Calcite-based parser: the SHOW statement's parsed path did not have exactly two components, which would mean neither SHOW CURRENT CATALOG nor SHOW CURRENT DATABASE was written. The grammar only supports these two forms of SHOW; any other SHOW target reaches this ParseException.
Solutions
- Rewrite the statement as exactly SHOW CURRENT CATALOG or SHOW CURRENT DATABASE.
- Remove unsupported SHOW variants (SHOW TABLES etc.) — use information-schema-style queries or Beam APIs instead.
- Check the statement for typos or extra tokens after CURRENT.
Example fix
// before SHOW TABLES; // after SHOW CURRENT DATABASE;
Defensive patterns
Strategy: validation
Validate before calling
// pre-validate SHOW statements before handing to Beam SQL
static boolean isSupportedShow(String sql) {
String s = sql.trim().toUpperCase();
return !s.startsWith("SHOW")
|| s.equals("SHOW CURRENT CATALOG")
|| s.equals("SHOW CURRENT DATABASE");
} Try / catch
try {
result = pipeline.apply(SqlTransform.query(sql));
} catch (ParseException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Expected SHOW CURRENT")) {
throw new IllegalArgumentException("Beam SQL only supports SHOW CURRENT CATALOG|DATABASE.", e);
}
throw e;
} Prevention
- Do not port SHOW statements from MySQL/Postgres into Beam SQL.
- Restrict user-supplied SQL to a supported statement whitelist.
- Test ad-hoc SQL against Beam SQL's grammar before running pipelines.
When it happens
Trigger: Executing a SQL statement like SHOW TABLES, SHOW SCHEMAS, or a malformed SHOW (e.g. SHOW CURRENT with a missing target, or extra qualifiers) through BeamSql / sql.parse via zetaql/Calcite front-end.
Common situations: Porting SQL from MySQL/Postgres where SHOW TABLES / SHOW COLUMNS is valid but unsupported by Beam SQL; typo'd SHOW statement; using an IDE-generated statement against Beam SQL.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- 'CREATE TABLE' is not supported in SQL. You can use 'CREATE…
- A 'datagen' table requires either 'rows-per-second' (for…
- Analytics Function [ ] is not supported
- Beam SQL cannot convert Timestamp values with…
- Beam write property ' ' is not supported. Writing to Delta…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/60f67fdcbb1f671d.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/sql/src/main/codegen/includes/parserImpls.ftl:495
}
{
<SHOW> <CURRENT> { s.add(this); }
{
List<String> path = new ArrayList<String>();
path.add("beamsystem");
}
(
<CATALOG> {
path.add("__current_catalog__");
}
|
<DATABASE> {
path.add("__current_database__");
}
)
{
if (path.size() != 2) {
throw new ParseException(
"Expected SHOW CURRENT CATALOG or SHOW CURRENT DATABASE");
}
SqlNodeList selectList = SqlNodeList.of(SqlIdentifier.star(s.end(this)));
SqlIdentifier from = new SqlIdentifier(path, s.end(this));
return new SqlSelect(
s.end(this),
null,
selectList,
from,
null,
null,
null,
null,
null,
null,
null,
null);View on GitHub (pinned to 12126d8942)