Skip to main content
Skip table of contents

Scalar Functions

You are looking at an older version of the documentation. The latest version is found here.

The Data Virtuality Server provides several types of built-in scalar functions for different operations. They are listed here in alphabetical order:

Function Determinism

A special feature of scalar functions in the Data Virtuality Server is that they can have different degrees of determinism; this is important because the function's determinism level dictates when the function is evaluated and to what extent the result can be cached. In the Data Virtuality Server, there are five levels of function determinism:

Level
Description
Functions

Deterministic 

  • The function will always return the same result for the given inputs;
  • Deterministic functions are evaluated by the engine as soon as all input values are known, which may occur as soon as the rewrite phase;
  • Some functions are not truly deterministic but are treated as such for performance
All except listed below
User Deterministic
  • The function will return the same result for the given inputs for the same user;
  • User deterministic functions are evaluated by the engine as soon as all input values are known, which may occur as soon as the rewrite phase;
  • If a user deterministic function is evaluated during the creation of a prepared processing plan, then the resulting plan will be cached only for the user

HASROLE

user functions

Session Deterministic
  • The function will return the same result for the given inputs under the same user session;
  • Session deterministic functions are evaluated by the engine as soon as all input values are known, which may occur as soon as the rewrite phase;
  • If a session deterministic function is evaluated during the creation of a prepared processing plan, then the resulting plan will be cached only for the user's session
ENV
Command Deterministic
  • The result of function evaluation is only deterministic within the scope of the user command;
  • Command deterministic functions are delayed in evaluation until processing to ensure that even prepared plans utilizing these functions will be executed with relevant values;
  • Command deterministic function evaluation will occur before pushdown - however, multiple occurrences of the same command deterministic time function are not guaranteed to evaluate to the same value

CURDATE

CURTIME

NOW

Nondeterministic
  • The result of function evaluation is fully nondeterministic;
  • Nondeterministic functions are delayed in evaluation until processing with a preference for pushdown;
  • If the function is not pushed down, then it may be evaluated for every row in its execution context (for example, if the function is used in the SELECT clause)
RAND
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.