in asterix-bad/src/main/java/org/apache/asterix/bad/lang/statement/CreateContinuousChannelStatement.java [48:71]
protected void initialize(IStatementExecutor statementExecutor, MetadataProvider metadataProvider,
MetadataTransactionContext mdTxnCtx) throws Exception {
// Creates function
SqlppRewriterFactory fact = new SqlppRewriterFactory(new SqlppParserFactory());
((QueryTranslator) statementExecutor).handleCreateFunctionStatement(metadataProvider, stmt,
fact.createStatementRewriter());
this.function = stmt.getFunctionSignature();
// Check whether function exists
Function lookup = MetadataManager.INSTANCE.getFunction(mdTxnCtx, function);
if (lookup == null) {
throw new MetadataException(" Unknown function " + function.getName());
}
if (period != null) {
if (!period.getFunctionSignature().getName().equals("duration")) {
throw new MetadataException("Expected argument period as a duration, but got "
+ period.getFunctionSignature().getName() + ".");
}
duration = ((StringLiteral) ((LiteralExpr) period.getExprList().get(0)).getValue()).getValue();
} else {
duration = "";
}
}