关注 spark技术分享,
撸spark源码 玩spark最佳实践

ResolvedStar

admin阅读(1091)

ResolvedStar

ResolvedStar is…​FIXME

RankLike Contract

admin阅读(1092)

RankLike Contract

RankLike is…​FIXME

PrettyAttribute

admin阅读(1102)

PrettyAttribute

PrettyAttribute is…​FIXME

PlanExpression

admin阅读(1409)

PlanExpression Contract for Expressions with Query Plans

PlanExpression is the contract for Catalyst expressions that contain a QueryPlan.

Table 1. PlanExpression Contract
Method Description

exprId

Used when…​FIXME

plan

Used when…​FIXME

withNewPlan

Used when…​FIXME

Table 2. PlanExpressions
PlanExpression Description

ExecSubqueryExpression

SubqueryExpression

ParseToTimestamp

admin阅读(1323)

ParseToTimestamp Expression

ParseToTimestamp is a RuntimeReplaceable expression that represents the to_timestamp function (in logical query plans).

As a RuntimeReplaceable expression, ParseToTimestamp is replaced by Catalyst Optimizer with the child expression:

  • Cast(left, TimestampType) for to_timestamp(s: Column): Column function

  • Cast(UnixTimestamp(left, format), TimestampType) for to_timestamp(s: Column, fmt: String): Column function

Creating ParseToTimestamp Instance

ParseToTimestamp takes the following when created:

ParseToDate

admin阅读(1349)

ParseToDate Expression

ParseToDate is a RuntimeReplaceable expression that represents the to_date function (in logical query plans).

As a RuntimeReplaceable expression, ParseToDate is replaced by Catalyst Optimizer with the child expression:

  • Cast(left, DateType) for to_date(e: Column): Column function

  • Cast(Cast(UnixTimestamp(left, format), TimestampType), DateType) for to_date(e: Column, fmt: String): Column function

Creating ParseToDate Instance

ParseToDate takes the following when created:

OffsetWindowFunction Contract — Unevaluable Window Function Expressions

admin阅读(1542)

OffsetWindowFunction Contract — Unevaluable Window Function Expressions

OffsetWindowFunction is the base of window function expressions that are unevaluable and ImplicitCastInputTypes.

Note
An unevaluable expression cannot be evaluated to produce a value (neither in interpreted nor code-generated expression evaluations) and has to be resolved (replaced) to some other expressions or logical operators at analysis or optimization phases or they fail analysis.

Table 1. (Subset of) OffsetWindowFunction Contract
Property Description

default

direction

input

offset

OffsetWindowFunction uses the input, offset and default expressions as the children.

OffsetWindowFunction is not foldable.

OffsetWindowFunction is nullable when the default is not defined or the default or the input expressions are.

When requested for the dataType, OffsetWindowFunction simply requests the input expression for the data type.

When requested for the inputTypes, OffsetWindowFunction returns the AnyDataType, IntegerType with the data type of the input expression and the NullType.

OffsetWindowFunction uses the following text representation (i.e. toString):

Table 2. OffsetWindowFunctions (Direct Implementations)
OffsetWindowFunction Description

Lag

Lead

frame Lazy Property

Note
frame is part of the WindowFunction Contract to define the WindowFrame for function expression execution.

frame…​FIXME

Verifying Input Data Types — checkInputDataTypes Method

Note
checkInputDataTypes is part of the Expression Contract to verify (check the correctness of) the input data types.

checkInputDataTypes…​FIXME

Nondeterministic Contract

admin阅读(1552)

Nondeterministic Expression Contract

Nondeterministic is a contract for Catalyst expressions that are non-deterministic and non-foldable.

Nondeterministic expressions require explicit initialization (with the current partition index) before evaluating a value.

Table 1. Nondeterministic Contract
Method Description

initializeInternal

Initializing the Nondeterministic expression

Used exclusively when Nondeterministic expression is requested to initialize

evalInternal

Evaluating the Nondeterministic expression

Used exclusively when Nondeterministic expression is requested to evaluate a value

Note
Nondeterministic expressions are the target of PullOutNondeterministic logical plan rule.
Table 2. Nondeterministic Expressions
Expression Description

CurrentBatchTimestamp

InputFileBlockLength

InputFileBlockStart

InputFileName

MonotonicallyIncreasingID

NondeterministicExpression

Rand

Randn

RDG

SparkPartitionID

Table 3. Nondeterministic’s Internal Properties (e.g. Registries, Counters and Flags)
Name Description

deterministic

Always turned off (i.e. false)

foldable

Always turned off (i.e. false)

initialized

Controls whether a Nondeterministic expression has been initialized before evaluation.

Turned off by default.

Initializing Expression — initialize Method

Internally, initialize initializes itself (with the input partition index) and turns the internal initialized flag on.

Note
initialize is used exclusively when InterpretedProjection and InterpretedMutableProjection are requested to initialize themselves.

Evaluating Expression — eval Method

Note
eval is part of Expression Contract for the interpreted (non-code-generated) expression evaluation, i.e. evaluating a Catalyst expression to a JVM object for a given internal binary row.

eval is just a wrapper of evalInternal that makes sure that initialize has already been executed (and so the expression is initialized).

Internally, eval makes sure that the expression was initialized and calls evalInternal.

eval reports a IllegalArgumentException exception when the internal initialized flag is off, i.e. initialize has not yet been executed.

NamedExpression Contract

admin阅读(1559)

NamedExpression Contract — Catalyst Expressions with Name, ID and Qualifier

NamedExpression is a contract of Catalyst expressions that have a name, exprId, and optional qualifier.

Table 1. NamedExpression Contract
Method Description

exprId

Used when…​FIXME

name

Used when…​FIXME

qualifier

Used when…​FIXME

toAttribute

Creating ExprId — newExprId Object Method

newExprId…​FIXME

Note
newExprId is used when…​FIXME

Murmur3Hash

admin阅读(1191)

Murmur3Hash

Murmur3Hash is…​FIXME

关注公众号:spark技术分享

联系我们联系我们