Tabnine Logo
ScalarFunctionCallExpression
Code IndexAdd Tabnine to your IDE (free)

How to use
ScalarFunctionCallExpression
in
org.apache.hyracks.algebricks.core.algebra.expressions

Best Java code snippets using org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression (Showing top 20 results out of 315)

origin: apache/asterixdb

protected static AbstractFunctionCallExpression createFunctionCallExpression(FunctionIdentifier fid,
    SourceLocation sourceLoc) {
  ScalarFunctionCallExpression callExpr = new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(fid));
  callExpr.setSourceLocation(sourceLoc);
  return callExpr;
}
origin: apache/asterixdb

private ILogicalExpression translateConstantValue(IAObject value, SourceLocation sourceLoc)
    throws CompilationException {
  ConstantExpression constExpr = new ConstantExpression(new AsterixConstantValue(value));
  constExpr.setSourceLocation(sourceLoc);
  IAType valueType = value.getType();
  if (valueType.getTypeTag().isDerivedType()) {
    ScalarFunctionCallExpression castExpr =
        new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.CAST_TYPE));
    castExpr.setSourceLocation(sourceLoc);
    castExpr.getArguments().add(new MutableObject<>(constExpr));
    TypeCastUtils.setRequiredAndInputTypes(castExpr, BuiltinType.ANY, valueType);
    return castExpr;
  } else {
    return constExpr;
  }
}
origin: apache/asterixdb

@Override
public ScalarFunctionCallExpression cloneExpression() {
  List<Mutable<ILogicalExpression>> clonedArgs = cloneArguments();
  ScalarFunctionCallExpression funcExpr = new ScalarFunctionCallExpression(finfo, clonedArgs);
  funcExpr.getAnnotations().putAll(cloneAnnotations());
  funcExpr.setOpaqueParameters(this.getOpaqueParameters());
  funcExpr.setSourceLocation(sourceLoc);
  return funcExpr;
}
origin: apache/asterixdb

@Override
public ILogicalExpression visitScalarFunctionCallExpression(ScalarFunctionCallExpression expr, Void arg)
    throws AlgebricksException {
  ScalarFunctionCallExpression exprCopy = new ScalarFunctionCallExpression(expr.getFunctionInfo(),
      deepCopyExpressionReferenceList(expr.getArguments()));
  deepCopyAnnotations(expr, exprCopy);
  deepCopyOpaqueParameters(expr, exprCopy);
  copySourceLocation(expr, exprCopy);
  return exprCopy;
}
origin: org.apache.vxquery/apache-vxquery-core

private static ILogicalExpression sfce(Function fn, ILogicalExpression... argExprs) {
  List<Mutable<ILogicalExpression>> args = new ArrayList<Mutable<ILogicalExpression>>();
  for (ILogicalExpression e : argExprs) {
    args.add(mutable(e));
  }
  return new ScalarFunctionCallExpression(fn, args);
}
origin: apache/asterixdb

ScalarFunctionCallExpression similarityExp = new ScalarFunctionCallExpression(
    FunctionUtil.getFunctionInfo(simFunctionIdentifier), similarityArgs);
similarityExp.setSourceLocation(sourceLoc);
similarityExp.getAnnotations().putAll(funcExp.getAnnotations());
ArrayList<Mutable<ILogicalExpression>> cmpArgs = new ArrayList<Mutable<ILogicalExpression>>();
cmpArgs.add(new MutableObject<ILogicalExpression>(similarityExp));
origin: apache/asterixdb

private boolean replaceWithFunctionCallArg(Mutable<ILogicalExpression> expRef, FunctionIdentifier normFuncIdent,
    AsterixConstantValue constVal, AbstractFunctionCallExpression funcExpr) throws AlgebricksException {
  // Analyze func expr to see if it is an optimizable similarity function.
  ScalarFunctionCallExpression simCheckFuncExpr = getSimilarityCheckExpr(normFuncIdent, constVal, funcExpr);
  // Replace the expr in the select condition.
  if (simCheckFuncExpr != null) {
    // Get item 0 from var.
    List<Mutable<ILogicalExpression>> getItemArgs = new ArrayList<Mutable<ILogicalExpression>>();
    // First arg is the similarity-check function call.
    getItemArgs.add(new MutableObject<ILogicalExpression>(simCheckFuncExpr));
    // Second arg is the item index to be accessed.
    getItemArgs.add(new MutableObject<ILogicalExpression>(
        new ConstantExpression(new AsterixConstantValue(new AInt32(0)))));
    ScalarFunctionCallExpression getItemExpr = new ScalarFunctionCallExpression(
        FunctionUtil.getFunctionInfo(BuiltinFunctions.GET_ITEM), getItemArgs);
    getItemExpr.setSourceLocation(simCheckFuncExpr.getSourceLocation());
    // Replace the old similarity function call with the new getItemExpr.
    expRef.setValue(getItemExpr);
    return true;
  }
  return false;
}
origin: apache/asterixdb

/**
 * Inject a dynamic cast function wrapping an existing expression
 *
 * @param funcInfo
 *            the cast function
 * @param reqType
 *            the required type
 * @param inputType
 *            the original type
 * @param exprRef
 *            the expression reference
 * @param argExpr
 *            the original expression
 * @throws AlgebricksException
 */
private static void injectCastFunction(IFunctionInfo funcInfo, IAType reqType, IAType inputType,
    Mutable<ILogicalExpression> exprRef, ILogicalExpression argExpr) throws AlgebricksException {
  ScalarFunctionCallExpression cast = new ScalarFunctionCallExpression(funcInfo);
  cast.getArguments().add(new MutableObject<ILogicalExpression>(argExpr));
  exprRef.setValue(cast);
  TypeCastUtils.setRequiredAndInputTypes(cast, reqType, inputType);
}
origin: apache/asterixdb

  /**
   * Whether the expression contains a missing filtering
   *
   * @param expr
   * @return true if the expression contains a missing filtering function call; false otherwise.
   */
  private boolean containsMissingFiltering(ILogicalExpression expr) {
    if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
      return false;
    }
    ScalarFunctionCallExpression func = (ScalarFunctionCallExpression) expr;
    if (func.getFunctionIdentifier() == AlgebricksBuiltinFunctions.AND) {
      for (Mutable<ILogicalExpression> argumentRef : func.getArguments()) {
        if (containsMissingFiltering(argumentRef.getValue())) {
          return true;
        }
      }
      return false;
    }
    if (func.getFunctionIdentifier() != AlgebricksBuiltinFunctions.IS_MISSING) {
      return false;
    }
    return true;
  }
}
origin: apache/asterixdb

  Void arg) throws AlgebricksException {
boolean changed = changeRec(expr, arg);
if (!checkArgs(expr) || !expr.isFunctional()) {
  return new Pair<>(changed, expr);
if (FUNC_ID_SET_THAT_SHOULD_NOT_BE_APPLIED.contains(expr.getFunctionIdentifier())) {
  return new Pair<>(false, null);
  if (expr.getFunctionIdentifier().equals(BuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR)
      || expr.getFunctionIdentifier().equals(BuiltinFunctions.ORDERED_LIST_CONSTRUCTOR)) {
    AbstractCollectionType listType = (AbstractCollectionType) TypeCastUtils.getRequiredType(expr);
    if (listType != null && (listType.getItemType().getTypeTag() == ATypeTag.ANY
  if (expr.getFunctionIdentifier().equals(BuiltinFunctions.FIELD_ACCESS_BY_NAME)) {
    ARecordType rt = (ARecordType) _emptyTypeEnv.getType(expr.getArguments().get(0).getValue());
    String str = ConstantExpressionUtil.getStringConstant(expr.getArguments().get(1).getValue());
    int k = rt.getFieldIndex(str);
    if (k >= 0) {
  IAObject c = FUNC_ID_TO_CONSTANT.get(expr.getFunctionIdentifier());
  if (c != null) {
    return new Pair<>(true, new ConstantExpression(new AsterixConstantValue(c)));
origin: org.apache.vxquery/apache-vxquery-core

Function fn = (Function) fcExpr.getFunctionInfo();
    fcExpr.getArguments());
origin: apache/asterixdb

public static void resetLOJMissingPlaceholderVarInGroupByOp(AccessMethodAnalysisContext analysisCtx,
    LogicalVariable newMissingPlaceholderVaraible, IOptimizationContext context) throws AlgebricksException {
  //reset the missing placeholder variable in groupby operator
  ScalarFunctionCallExpression isMissingFuncExpr = analysisCtx.getLOJIsMissingFuncInGroupBy();
  isMissingFuncExpr.getArguments().clear();
  VariableReferenceExpression newMissingVarRef = new VariableReferenceExpression(newMissingPlaceholderVaraible);
  newMissingVarRef.setSourceLocation(isMissingFuncExpr.getSourceLocation());
  isMissingFuncExpr.getArguments().add(new MutableObject<ILogicalExpression>(newMissingVarRef));
  //recompute type environment.
  OperatorPropertiesUtil.typeOpRec(analysisCtx.getLOJGroupbyOpRef(), context);
}
origin: apache/asterixdb

private static ScalarFunctionCallExpression getNestedIsMissingCall(AbstractFunctionCallExpression call,
    OptimizableOperatorSubTree rightSubTree) throws AlgebricksException {
  ScalarFunctionCallExpression isMissingFuncExpr;
  if (call.getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.NOT)) {
    if (call.getArguments().get(0).getValue().getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
      if (((AbstractFunctionCallExpression) call.getArguments().get(0).getValue()).getFunctionIdentifier()
          .equals(AlgebricksBuiltinFunctions.IS_MISSING)) {
        isMissingFuncExpr = (ScalarFunctionCallExpression) call.getArguments().get(0).getValue();
        if (isMissingFuncExpr.getArguments().get(0).getValue()
            .getExpressionTag() == LogicalExpressionTag.VARIABLE) {
          LogicalVariable var =
              ((VariableReferenceExpression) isMissingFuncExpr.getArguments().get(0).getValue())
                  .getVariableReference();
          List<LogicalVariable> liveSubplanVars = new ArrayList<>();
          VariableUtilities.getSubplanLocalLiveVariables(rightSubTree.getRoot(), liveSubplanVars);
          if (liveSubplanVars.contains(var)) {
            return isMissingFuncExpr;
          }
        }
      }
    }
  }
  return null;
}
origin: apache/asterixdb

ScalarFunctionCallExpression funcExpr = (ScalarFunctionCallExpression) assignOp.getExpressions()
    .get(expectedRecordIndex).getValue();
fid = funcExpr.getFunctionIdentifier();
origin: apache/asterixdb

public static ScalarFunctionCallExpression getComparisonExpr(String simFuncName,
    ArrayList<Mutable<ILogicalExpression>> cmpArgs) {
  if (simFuncName.equals(JACCARD_FUNCTION_NAME)) {
    return new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(AlgebricksBuiltinFunctions.GE),
        cmpArgs);
  } else if (simFuncName.equals(EDIT_DISTANCE_FUNCTION_NAME)) {
    return new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(AlgebricksBuiltinFunctions.LE),
        cmpArgs);
  }
  return null;
}
origin: apache/asterixdb

similarityArgs.add(new MutableObject<ILogicalExpression>(
    new ConstantExpression(new AsterixConstantValue(jaccThresh))));
simCheckFuncExpr = new ScalarFunctionCallExpression(
    FunctionUtil.getFunctionInfo(BuiltinFunctions.SIMILARITY_JACCARD_CHECK), similarityArgs);
simCheckFuncExpr.setSourceLocation(funcExpr.getSourceLocation());
similarityArgs.add(
    new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(edThresh))));
simCheckFuncExpr = new ScalarFunctionCallExpression(
    FunctionUtil.getFunctionInfo(BuiltinFunctions.EDIT_DISTANCE_CHECK), similarityArgs);
simCheckFuncExpr.setSourceLocation(funcExpr.getSourceLocation());
simCheckFuncExpr.getAnnotations().putAll(funcExpr.getAnnotations());
origin: apache/asterixdb

SourceLocation sourceLoc = simCheckFuncExpr.getSourceLocation();
ScalarFunctionCallExpression selectGetItemExpr = new ScalarFunctionCallExpression(
    FunctionUtil.getFunctionInfo(BuiltinFunctions.GET_ITEM), selectGetItemArgs);
selectGetItemExpr.setSourceLocation(sourceLoc);
ScalarFunctionCallExpression assignGetItemExpr = new ScalarFunctionCallExpression(
    FunctionUtil.getFunctionInfo(BuiltinFunctions.GET_ITEM), assignGetItemArgs);
assignGetItemExpr.setSourceLocation(sourceLoc);
origin: apache/asterixdb

matched = true;
ScalarFunctionCallExpression notNullFunc = new ScalarFunctionCallExpression(
    FunctionUtil.getFunctionInfo(BuiltinFunctions.CHECK_UNKNOWN));
notNullFunc.getArguments().add(new MutableObject<ILogicalExpression>(arg));
origin: apache/asterixdb

if (func.getFunctionIdentifier() == AlgebricksBuiltinFunctions.AND) {
  for (Mutable<ILogicalExpression> argumentRef : func.getArguments()) {
    if (containsNotMissingFiltering(argumentRef.getValue())) {
      return true;
if (func.getFunctionIdentifier() != AlgebricksBuiltinFunctions.NOT) {
  return false;
ILogicalExpression arg = func.getArguments().get(0).getValue();
if (arg.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
  return false;
if (func2.getFunctionIdentifier() != AlgebricksBuiltinFunctions.IS_MISSING) {
  return false;
origin: apache/asterixdb

private ILogicalExpression getScalarExpr(FunctionIdentifier func, ILogicalExpression interval) {
  List<Mutable<ILogicalExpression>> intervalArg = new ArrayList<>();
  intervalArg.add(new MutableObject<ILogicalExpression>(interval));
  ScalarFunctionCallExpression fnExpr =
      new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(func), intervalArg);
  fnExpr.setSourceLocation(interval.getSourceLocation());
  return fnExpr;
}
org.apache.hyracks.algebricks.core.algebra.expressionsScalarFunctionCallExpression

Most used methods

  • <init>
  • getArguments
  • setSourceLocation
  • getAnnotations
  • getFunctionIdentifier
  • getFunctionInfo
  • cloneAnnotations
  • cloneArguments
  • equals
  • getOpaqueParameters
  • getSourceLocation
  • getUsedVariables
  • getSourceLocation,
  • getUsedVariables,
  • isFunctional,
  • setOpaqueParameters,
  • substituteVar,
  • toString

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Top plugins for WebStorm
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