diff --git a/src/main/antlr4/edu/caltech/nanodb/sqlparse/NanoSQL.g4 b/src/main/antlr4/edu/caltech/nanodb/sqlparse/NanoSQL.g4 index 04047f811accda2d6d77676e8c2f5ccff08bc8a6..01cba5b0d599bde1f9904baa5907769460b5e585 100644 --- a/src/main/antlr4/edu/caltech/nanodb/sqlparse/NanoSQL.g4 +++ b/src/main/antlr4/edu/caltech/nanodb/sqlparse/NanoSQL.g4 @@ -43,6 +43,7 @@ commandNoSemicolon: | showTablesStmt | showPropsStmt | setPropStmt + | showSystemStatsStmt ; @@ -204,6 +205,9 @@ rollbackTxnStmt: //============================================================================ // Other utility statements +// SHOW PROPERTIES +// SET PROPERTY '...' = ... +// SHOW '...' STATS // FLUSH // CRASH // EXIT (or QUIT) @@ -215,6 +219,9 @@ showPropsStmt: setPropStmt: SET PROPERTY name=STRING_LITERAL '=' expression ; +showSystemStatsStmt: + SHOW name=STRING_LITERAL STATS ; + flushStmt: FLUSH ; diff --git a/src/main/java/edu/caltech/nanodb/sqlparse/NanoSQLTranslator.java b/src/main/java/edu/caltech/nanodb/sqlparse/NanoSQLTranslator.java index fe6dd9df3e2abb47ef81331682b5d5f1e3875638..d2136215746b033170ec3b4833dc4a7441c02e73 100644 --- a/src/main/java/edu/caltech/nanodb/sqlparse/NanoSQLTranslator.java +++ b/src/main/java/edu/caltech/nanodb/sqlparse/NanoSQLTranslator.java @@ -5,6 +5,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; +import edu.caltech.nanodb.commands.ShowSystemStatsCommand; import edu.caltech.nanodb.expressions.ArithmeticOperator; import edu.caltech.nanodb.expressions.BooleanOperator; import edu.caltech.nanodb.expressions.ColumnName; @@ -166,6 +167,16 @@ public class NanoSQLTranslator extends NanoSQLBaseVisitor<Object> { (Expression) visit(ctx.expression())); } + @Override + public Object visitShowSystemStatsStmt(NanoSQLParser.ShowSystemStatsStmtContext ctx) { + String systemName = ctx.name.getText(); + + // Remove the quotes from around the subsystem name + systemName = systemName.substring(1, systemName.length() - 1); + + return new ShowSystemStatsCommand(systemName); + } + //=== TABLE/INDEX UTILITY COMMANDS ======================================= @Override