@Override public Void visit(FunctionDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop function "); FunctionSignature funcSignature = del.getFunctionSignature(); out.print(funcSignature.toString()); out.println(SEMICOLON); return null; }
funcSig = FunctionSignature(); ifExists = IfExists(); stmt = new FunctionDropStatement(funcSig, ifExists); break; case FEED:
protected void handleFunctionDropStatement(MetadataProvider metadataProvider, Statement stmt) throws Exception { FunctionDropStatement stmtDropFunction = (FunctionDropStatement) stmt; SourceLocation sourceLoc = stmtDropFunction.getSourceLocation(); FunctionSignature signature = stmtDropFunction.getFunctionSignature(); signature.setNamespace(getActiveDataverseName(signature.getNamespace())); MetadataTransactionContext mdTxnCtx = MetadataManager.INSTANCE.beginTransaction(); metadataProvider.setMetadataTxnContext(mdTxnCtx); MetadataLockUtil.functionStatementBegin(lockManager, metadataProvider.getLocks(), signature.getNamespace(), signature.getNamespace() + "." + signature.getName()); try { Function function = MetadataManager.INSTANCE.getFunction(mdTxnCtx, signature); // If function == null && stmtDropFunction.getIfExists() == true, commit txn directly. if (function == null && !stmtDropFunction.getIfExists()) { throw new CompilationException(ErrorCode.UNKNOWN_FUNCTION, sourceLoc, signature); } else if (function != null) { if (isFunctionUsed(mdTxnCtx, signature, null)) { throw new MetadataException(ErrorCode.METADATA_DROP_FUCTION_IN_USE, sourceLoc, signature); } else { MetadataManager.INSTANCE.dropFunction(mdTxnCtx, signature); } } MetadataManager.INSTANCE.commitTransaction(mdTxnCtx); } catch (Exception e) { abort(e, e, mdTxnCtx); throw e; } finally { metadataProvider.getLocks().unlock(); } }
funcSig = FunctionSignature(); ifExists = IfExists(); stmt = new FunctionDropStatement(funcSig, ifExists); break; case FEED:
funcSig = FunctionSignature(); ifExists = IfExists(); stmt = new FunctionDropStatement(funcSig, ifExists); break; case FEED: