Tabnine Logo
FunctionDecl.getSignature
Code IndexAdd Tabnine to your IDE (free)

How to use
getSignature
method
in
org.apache.asterix.lang.common.statement.FunctionDecl

Best Java code snippets using org.apache.asterix.lang.common.statement.FunctionDecl.getSignature (Showing top 10 results out of 315)

origin: apache/asterixdb

  private static FunctionDecl findFuncDeclaration(FunctionSignature fid, List<FunctionDecl> sequence) {
    for (FunctionDecl f : sequence) {
      if (f.getSignature().equals(fid)) {
        return f;
      }
    }
    return null;
  }
}
origin: apache/asterixdb

@Override
public boolean equals(Object o) {
  return (o instanceof FunctionDecl && ((FunctionDecl) o).getSignature().equals(signature));
}
origin: apache/asterixdb

@Override
public Void visit(FunctionDecl fd, Integer step) throws CompilationException {
  out.println(skip(step) + "FunctionDecl " + fd.getSignature().getName() + "(" + fd.getParamList().toString()
      + ") {");
  fd.getFuncBody().accept(this, step + 1);
  out.println(skip(step) + "}");
  out.println();
  return null;
}
origin: apache/asterixdb

@Override
public Void visit(FunctionDecl fd, Integer step) throws CompilationException {
  out.print(skip(step) + "declare function " + generateFullName(null, fd.getSignature().getName()) + "(");
  List<Identifier> parameters = new ArrayList<>();
  parameters.addAll(fd.getParamList());
  printDelimitedIdentifiers(parameters, COMMA);
  out.println(") {");
  fd.getFuncBody().accept(this, step + 2);
  out.println();
  out.print(skip(step) + "}");
  out.println(";");
  return null;
}
origin: apache/asterixdb

protected void inlineDeclaredUdfs(boolean inlineUdfs) throws CompilationException {
  List<FunctionSignature> funIds = new ArrayList<FunctionSignature>();
  for (FunctionDecl fdecl : declaredFunctions) {
    funIds.add(fdecl.getSignature());
  }
  List<FunctionDecl> usedStoredFunctionDecls = new ArrayList<>();
  for (Expression topLevelExpr : topExpr.getDirectlyEnclosedExpressions()) {
    usedStoredFunctionDecls.addAll(FunctionUtil.retrieveUsedStoredFunctions(metadataProvider, topLevelExpr,
        funIds, null, expr -> getFunctionCalls(expr), func -> functionRepository.getFunctionDecl(func),
        (signature, sourceLoc) -> FunctionMapUtil.normalizeBuiltinFunctionSignature(signature, false,
            sourceLoc)));
  }
  declaredFunctions.addAll(usedStoredFunctionDecls);
  if (inlineUdfs && !declaredFunctions.isEmpty()) {
    SqlppInlineUdfsVisitor visitor = new SqlppInlineUdfsVisitor(context,
        new SqlppFunctionBodyRewriterFactory() /* the rewriter for function bodies expressions*/,
        declaredFunctions, metadataProvider);
    while (rewriteTopExpr(visitor, declaredFunctions)) {
      // loop until no more changes
    }
  }
  declaredFunctions.removeAll(usedStoredFunctionDecls);
}
origin: apache/asterixdb

private void inlineDeclaredUdfs() throws CompilationException {
  if (topStatement == null) {
    return;
  }
  List<FunctionSignature> funIds = new ArrayList<FunctionSignature>();
  for (FunctionDecl fdecl : declaredFunctions) {
    funIds.add(fdecl.getSignature());
  }
  List<FunctionDecl> storedFunctionDecls = new ArrayList<>();
  for (Expression topLevelExpr : topStatement.getDirectlyEnclosedExpressions()) {
    storedFunctionDecls.addAll(FunctionUtil.retrieveUsedStoredFunctions(metadataProvider, topLevelExpr, funIds,
        null, expr -> getFunctionCalls(expr), func -> functionParser.getFunctionDecl(func),
        (signature, sourceLoc) -> CommonFunctionMapUtil.normalizeBuiltinFunctionSignature(signature)));
    declaredFunctions.addAll(storedFunctionDecls);
  }
  if (!declaredFunctions.isEmpty()) {
    AQLInlineUdfsVisitor visitor =
        new AQLInlineUdfsVisitor(context, new AQLRewriterFactory(), declaredFunctions, metadataProvider);
    while (topStatement.accept(visitor, declaredFunctions)) {
      // loop until no more changes
    }
  }
  declaredFunctions.removeAll(storedFunctionDecls);
}
origin: apache/asterixdb

@Override
public FunctionDecl visit(FunctionDecl fd, Void arg) throws CompilationException {
  FunctionDecl copy =
      new FunctionDecl(fd.getSignature(), fd.getParamList(), (Expression) fd.getFuncBody().accept(this, arg));
  copy.setSourceLocation(fd.getSourceLocation());
  return copy;
}
origin: apache/asterixdb

  messageBuilder.append("function " + functionDecls.get(functionDecls.size() - 1).getSignature()
      + " depends upon function " + signature + " which is undefined");
} else {
  if (functionDecls.contains(functionDecl)) {
    throw new CompilationException(ErrorCode.COMPILATION_ERROR, functionCall.getSourceLocation(),
        "Recursive invocation " + functionDecls.get(functionDecls.size() - 1).getSignature()
            + " <==> " + functionDecl.getSignature());
origin: apache/asterixdb

@Override
public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(FunctionDecl fd,
    VariableSubstitutionEnvironment env) throws CompilationException {
  List<VarIdentifier> newList = new ArrayList<>(fd.getParamList().size());
  for (VarIdentifier vi : fd.getParamList()) {
    VariableExpr varExpr = new VariableExpr(vi);
    if (!env.constainsOldVar(varExpr)) {
      throw new CompilationException(ErrorCode.COMPILATION_ERROR, fd.getSourceLocation(),
          "Parameter " + vi + " does not appear in the substitution list.");
    }
    Expression newExpr = env.findSubstitution(varExpr);
    if (newExpr.getKind() != Kind.VARIABLE_EXPRESSION) {
      throw new CompilationException(ErrorCode.COMPILATION_ERROR, fd.getSourceLocation(),
          "Parameter " + vi + " cannot be substituted by a non-variable expression.");
    }
    newList.add(((VariableExpr) newExpr).getVar());
  }
  Pair<ILangExpression, VariableSubstitutionEnvironment> p1 = fd.getFuncBody().accept(this, env);
  FunctionDecl newF = new FunctionDecl(fd.getSignature(), newList, (Expression) p1.first);
  newF.setSourceLocation(fd.getSourceLocation());
  return new Pair<>(newF, env);
}
origin: apache/asterixdb

private Expression rewriteFunctionBody(FunctionDecl fnDecl) throws CompilationException {
  SourceLocation sourceLoc = fnDecl.getSourceLocation();
  Query wrappedQuery = new Query(false);
  wrappedQuery.setSourceLocation(sourceLoc);
  wrappedQuery.setBody(fnDecl.getFuncBody());
  wrappedQuery.setTopLevel(false);
  String fnNamespace = fnDecl.getSignature().getNamespace();
  Dataverse defaultDataverse = metadataProvider.getDefaultDataverse();
  Dataverse fnDataverse;
  if (fnNamespace == null || fnNamespace.equals(defaultDataverse.getDataverseName())) {
    fnDataverse = defaultDataverse;
  } else {
    try {
      fnDataverse = metadataProvider.findDataverse(fnNamespace);
    } catch (AlgebricksException e) {
      throw new CompilationException(ErrorCode.UNKNOWN_DATAVERSE, e, sourceLoc, fnNamespace);
    }
  }
  metadataProvider.setDefaultDataverse(fnDataverse);
  try {
    IQueryRewriter queryRewriter = rewriterFactory.createQueryRewriter();
    queryRewriter.rewrite(declaredFunctions, wrappedQuery, metadataProvider, context, true,
        fnDecl.getParamList());
    return wrappedQuery.getBody();
  } finally {
    metadataProvider.setDefaultDataverse(defaultDataverse);
  }
}
org.apache.asterix.lang.common.statementFunctionDeclgetSignature

Popular methods of FunctionDecl

  • <init>
  • getFuncBody
  • setFuncBody
  • getParamList
  • getSourceLocation
  • setSourceLocation

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Kernel (java.awt.image)
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now