/** * See if there is already a jar with the same digest */ private Optional<String> getExistingJarPath(String digest) { Collection<UDF> existing = catalogService.listUDFs( Collections.singletonList(new QueryParam(UDF.DIGEST, digest))); if (existing.size() >= 1) { return Optional.of(existing.iterator().next().getJarStoragePath()); } return Optional.empty(); } }
private Map<String, String> getUdfInternalNames() { Map<String, String> internalNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); for (UDF udf : listUDFs()) { internalNames.put(udf.getDisplayName(), udf.getName()); } return internalNames; }
public RuleParser(StreamCatalogService catalogService, String sql, long topologyId, long versionId) { this.catalogService = catalogService; this.sql = sql; this.topologyId = topologyId; this.versionId = versionId; for (UDF udf : catalogService.listUDFs()) { catalogUdfs.put(udf.getName().toUpperCase(), new Udf(udf.getName(), udf.getClassName(), udf.getType())); } }
private void checkDuplicate(UDF udf) { List<QueryParam> qps = QueryParam.params(UDF.NAME, udf.getName(), UDF.CLASSNAME, udf.getClassName(), UDF.TYPE, udf.getType().toString()); Collection<UDF> existing = catalogService.listUDFs(qps); if (!existing.isEmpty()) { LOG.warn("UDF with same (name, classname, type) already exists, udf: {}", udf); throw EntityAlreadyExistsException.byName(udf.getName()); } }
qps.add(new QueryParam(UDF.TYPE, udf.getType().toString())); Collection<UDF> udfs = catalogService.listUDFs(qps); if (udfs.size() > 1) { throw new IllegalStateException("Multiple UDF definitions for :" + udf);