Package org.partiql.lang.eval

Types

Link copied to clipboard
interface Addressed

Facet for a value to indicate that it has an application-defined "address" for this value.

Link copied to clipboard
sealed class Arguments
Link copied to clipboard
abstract class BaseExprValue : ExprValue

Base implementation of ExprValue that provides a bare minimum implementation of a value.

Link copied to clipboard
enum BindingCase : Enum<BindingCase>

Indicates if the lookup of a particular binding should be case-sensitive or not.

Link copied to clipboard
data class BindingName(name: String, bindingCase: BindingCase)

Encapsulates the data necessary to perform a binding lookup.

Link copied to clipboard
interface Bindings<T>

A mapping of name to ExprValue.

Link copied to clipboard
data class CompileOptions

Specifies options that effect the behavior of the PartiQL compiler.

Link copied to clipboard
data class CoverageData(branchConditionCount: CoverageData.ExecutionCount, branchCount: CoverageData.ExecutionCount)

Represents the execution data of a PartiQL Statement as it relates to Code Coverage. This structure specifically represents the aggregation of data of a particular statement. For example, a PartiQL Statement containing a single boolean expression would be represented with a CoverageStructure containing two branches. However, upon execution of the Expression, this structure (CoverageData) will be populated with information related to which branches were taken and their frequency. If the execution of a compiler query results in only a single branch being taken, this class shall reflect that.

Link copied to clipboard
data class CoverageStructure(branches: Map<String, CoverageStructure.Branch>, branchConditions: Map<String, CoverageStructure.BranchCondition>)

Represents the static structure of a compiled Expression. This structure is distinct from the execution data found within CoverageData.

Link copied to clipboard
open class EvaluationException(message: String, errorCode: ErrorCode, errorContext: PropertyValueMap, cause: Throwable?, internal: Boolean) : SqlException

Error for evaluation problems.

Link copied to clipboard
class EvaluationSession

Evaluation Session. Holds user defined constants used during evaluation. Each value has a default value that can be overridden by the client

Link copied to clipboard
interface Expression

An expression that can be evaluated to ExprValue.

Link copied to clipboard
interface ExprFunction

Represents a function that can be invoked from within an EvaluatingCompiler compiled Expression.

Link copied to clipboard
interface ExprValue : Iterable<ExprValue> , Faceted

Representation of a value within the context of an Expression.

Link copied to clipboard
fun interface ExprValueBagOp

Evaluable representation of PartiQL bag operators.

Link copied to clipboard
enum ExprValueType : Enum<ExprValueType>

The core types of ExprValue that exist within the type system of the evaluator. There is a correspondence to IonType, but it isn't quite one-to-one.

Link copied to clipboard
class MapBindings<T>(originalCaseMap: Map<String, T>) : Bindings<T>

A Bindings implementation that is backed by a Map.

Link copied to clipboard
interface Named

Facet for a value to indicate that it either has a name within some context or an ordinal position.

Link copied to clipboard

Provides a total, natural ordering over ExprValue. This ordering is consistent with ExprValue.exprEquals with the exception that NULL and MISSING compare with themselves and have order. PartiQL treats Ion typed nulls as NULL for the purposes of comparisons and Ion annotations are not considered for comparison purposes.

Link copied to clipboard
interface OrderedBindNames

Facet to provide an ordered list of String names that are directly bound to a given ExprValue.

Link copied to clipboard
interface OrdinalBindings

A simple mapping of ordinal index to ExprValue.

Link copied to clipboard
sealed class PartiQLResult

Result of an evaluated PartiQLStatement.

Link copied to clipboard
fun interface PartiQLStatement

A compiled PartiQL statement

Link copied to clipboard

Controls the behavior of ExprValue.iterator in the projection result. For the query Select a,b,c From <<{a:null, c:3}>>;

Link copied to clipboard
data class RequiredArgs(required: List<ExprValue>) : Arguments
Link copied to clipboard
data class RequiredWithOptional(required: List<ExprValue>, opt: ExprValue) : Arguments
Link copied to clipboard
data class RequiredWithVariadic(required: List<ExprValue>, variadic: List<ExprValue>) : Arguments
Link copied to clipboard
interface Scalar

Represents a scalar view over an ExprValue.

Link copied to clipboard
enum StructOrdering : Enum<StructOrdering>

Indicates if a struct is ordered or not.

Link copied to clipboard
data class ThunkOptions

Options for thunk construction.

Link copied to clipboard
enum ThunkReturnTypeAssertions : Enum<ThunkReturnTypeAssertions>

When ENABLED, the compiler adds additional evaluation-time checks to every thunk that verify that the ExprValue instance returned conforms to the expected org.partiql.types.StaticType.

Link copied to clipboard
enum TypedOpBehavior : Enum<TypedOpBehavior>

Indicates how CAST should behave.

Link copied to clipboard
enum TypingMode : Enum<TypingMode>

Indicates how the evaluator is to handle type checking errors and how MISSING values are propagated when encountered while evaluating binary operators and function calls.

Link copied to clipboard
enum UndefinedVariableBehavior : Enum<UndefinedVariableBehavior>

Defines the behavior when a non-existent variable is referenced.

Link copied to clipboard
enum VisitorTransformMode : Enum<VisitorTransformMode>

Controls the behavior of intrinsic AST visitor transforms with EvaluatingCompiler.compile.

Functions

Link copied to clipboard
fun ExprValue.asNamed(): Named

Wraps this ExprValue as a Named instance.

Link copied to clipboard
fun ExprValue.booleanValue(): Boolean
Link copied to clipboard
fun ExprValue.bytesValue(): ByteArray
Link copied to clipboard
fun ExprFunction.call(session: EvaluationSession, args: List<ExprValue>): ExprValue

Invokes the function.

fun ExprFunction.call(session: EvaluationSession, args: Arguments): ExprValue
Link copied to clipboard
fun ExprValue.cast(targetType: SingleType, typedOpBehavior: TypedOpBehavior, locationMeta: SourceLocationMeta?, defaultTimezoneOffset: ZoneOffset): ExprValue

Casts this ExprValue to the target type.

Link copied to clipboard
operator fun ExprValue.compareTo(other: ExprValue): Int

Provides the comparison predicate--which is not a total ordering.

Link copied to clipboard
fun ExprValue.dateValue(): LocalDate
Link copied to clipboard
fun <T> Bindings<T>.delegate(fallback: Bindings<T>): Bindings<T>

Wraps these Bindings to delegate lookup to another instance when lookup on this one fails.

Link copied to clipboard
fun Sequence<ExprValue>.distinct(): Sequence<ExprValue>
Link copied to clipboard
fun errorContextFrom(metaContainer: MetaContainer?): PropertyValueMap

Returns the SourceLocationMeta as an error context if the SourceLocationMeta.TAG exists in the passed metaContainer. Otherwise, returns an empty map.

fun errorContextFrom(location: SourceLocationMeta?): PropertyValueMap
Link copied to clipboard
fun ExprValue.exprEquals(other: ExprValue): Boolean

Provides the default equality function.

Link copied to clipboard
fun PartiqlAst.Expr.extractColumnAlias(idx: Int): String

Determines an appropriate column name for the given PartiqlAst.Expr.

fun PartiqlAst.Expr.Path.extractColumnAlias(idx: Int): String

Returns the name of the last component if it is a string literal, otherwise returns the column index prefixed with _.

Link copied to clipboard
fun fillErrorContext(errorContext: PropertyValueMap, location: SourceLocationMeta?)
Link copied to clipboard
fun Sequence<ExprValue>.multiplicities(): TreeMap<ExprValue, Int>
Link copied to clipboard
fun ExprValue.namedValue(nameValue: ExprValue): ExprValue

Binds the given name value as a Named facet delegate over this ExprValue.

Link copied to clipboard
fun ExprValue.numberValue(): Number
Link copied to clipboard
fun ExprValue.orderedNamesValue(names: List<String>): ExprValue

Wraps the given ExprValue with a delegate that provides the OrderedBindNames facet.

Link copied to clipboard
fun ExprValue.rangeOver(): Iterable<ExprValue>

Implements the FROM range operation. Specifically, this is distinct from the normal ExprValue.iterator in that types that are notExprValueType.isRangeFrom get treated as a singleton as per PartiQL specification.

Link copied to clipboard
fun ExprValue.stringify(): String

A very simple string representation--to be used for diagnostic purposes only.

Link copied to clipboard
fun ExprValue.stringValue(): String
Link copied to clipboard
fun syntheticColumnName(col: Int): String

Constructs the column name based on the zero-based index of that column.

Link copied to clipboard
fun ExprValue.timestampValue(): Timestamp
Link copied to clipboard
fun ExprValue.timeValue(): Time
Link copied to clipboard
fun PartiqlAst.CaseSensitivity.toBindingCase(): BindingCase

Converts a CaseSensitivity to a BindingCase.

Link copied to clipboard
fun ExprValue.toIonValue(ion: IonSystem): IonValue

This method should only be used in case we want to get result from querying an Ion file or an IonValue

Link copied to clipboard
fun ExprValue.unnamedValue(): ExprValue

Wraps this ExprValue in a delegate that always masks the Named facet.

Properties

Link copied to clipboard
val ExprValue.address: ExprValue?
Link copied to clipboard
const val BAG_ANNOTATION: String
Link copied to clipboard
const val DATE_ANNOTATION: String
Link copied to clipboard
val DEFAULT_COMPARATOR: NaturalExprValueComparators
Link copied to clipboard
const val GRAPH_ANNOTATION: String
Link copied to clipboard
const val MISSING_ANNOTATION: String
Link copied to clipboard
val ExprValue.name: ExprValue?
Link copied to clipboard
val ExprValue.orderedNames: List<String>?
Link copied to clipboard
const val TIME_ANNOTATION: String