@Override public Void visit(CreateFeedPolicyStatement cfps, Integer step) throws CompilationException { out.print(skip(step) + CREATE + "ingestion policy "); out.print(cfps.getPolicyName()); out.print(generateIfNotExists(cfps.getIfNotExists())); out.print(" from "); String srcPolicyName = revertStringToQuoted(cfps.getSourcePolicyName()); if (srcPolicyName != null) { out.print(" policy "); out.print(srcPolicyName + " "); printConfiguration(cfps.getProperties()); } else { out.print(" path "); out.print(cfps.getSourcePolicyFile() + " "); printConfiguration(cfps.getProperties()); } String desc = cfps.getDescription(); if (cfps.getDescription() != null) { out.print(" definition "); out.print(revertStringToQuoted(desc)); } out.println(SEMICOLON); out.println(); return null; }
cfps = new CreateFeedPolicyStatement(policyName, basePolicyName, properties, definition, ifNotExists); break; case PATH: cfps = new CreateFeedPolicyStatement(policyName, sourcePolicyFile, definition, ifNotExists); break; default:
cfps = new CreateFeedPolicyStatement(policyName, basePolicyName, properties, definition, ifNotExists); break; case PATH: cfps = new CreateFeedPolicyStatement(policyName, sourcePolicyFile, definition, ifNotExists); break; default:
MetadataTransactionContext mdTxnCtx = null; CreateFeedPolicyStatement cfps = (CreateFeedPolicyStatement) stmt; SourceLocation sourceLoc = cfps.getSourceLocation(); dataverse = getActiveDataverse(null); policy = cfps.getPolicyName(); MetadataLockUtil.createFeedPolicyBegin(lockManager, metadataProvider.getLocks(), dataverse, dataverse + "." + policy); MetadataManager.INSTANCE.getFeedPolicy(metadataProvider.getMetadataTxnContext(), dataverse, policy); if (feedPolicy != null) { if (cfps.getIfNotExists()) { MetadataManager.INSTANCE.commitTransaction(mdTxnCtx); return; boolean extendingExisting = cfps.getSourcePolicyName() != null; String description = cfps.getDescription() == null ? "" : cfps.getDescription(); if (extendingExisting) { FeedPolicyEntity sourceFeedPolicy = MetadataManager.INSTANCE .getFeedPolicy(metadataProvider.getMetadataTxnContext(), dataverse, cfps.getSourcePolicyName()); if (sourceFeedPolicy == null) { sourceFeedPolicy = MetadataManager.INSTANCE.getFeedPolicy(metadataProvider.getMetadataTxnContext(), MetadataConstants.METADATA_DATAVERSE_NAME, cfps.getSourcePolicyName()); if (sourceFeedPolicy == null) { throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc, "Unknown policy " + cfps.getSourcePolicyName()); policyProperties.putAll(cfps.getProperties()); newPolicy = new FeedPolicyEntity(dataverse, policy, description, policyProperties); } else {
stmt = new CreateFeedPolicyStatement(policyName, basePolicyName, properties, definition, ifNotExists); break; stmt = new CreateFeedPolicyStatement(policyName, sourcePolicyFile, definition, ifNotExists); break; default: