-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-26168][SQL] Update the code comments in Expression and Aggregate #23135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,9 +43,24 @@ import org.apache.spark.sql.types._ | |
| * There are a few important traits: | ||
| * | ||
| * - [[Nondeterministic]]: an expression that is not deterministic. | ||
| * - [[Stateful]]: an expression that contains mutable state. For example, MonotonicallyIncreasingID | ||
| * and Rand. A stateful expression is always non-deterministic. | ||
| * - [[Unevaluable]]: an expression that is not supposed to be evaluated. | ||
| * - [[CodegenFallback]]: an expression that does not have code gen implemented and falls back to | ||
| * interpreted mode. | ||
| * - [[NullIntolerant]]: an expression that is null intolerant (i.e. any null input will result in | ||
| * null output). | ||
| * - [[NonSQLExpression]]: a common base trait for the expressions that doesn't have SQL | ||
| * expressions like representation. For example, `ScalaUDF`, `ScalaUDAF`, | ||
| * and object `MapObjects` and `Invoke`. | ||
| * - [[UserDefinedExpression]]: a common base trait for user-defined functions, including | ||
| * UDF/UDAF/UDTF. | ||
| * - [[HigherOrderFunction]]: a common base trait for higher order functions that take one or more | ||
| * (lambda) functions and applies these to some objects. The function | ||
| * produces a number of variables which can be consumed by some lambda | ||
| * function. | ||
|
||
| * - [[NamedExpression]]: An [[Expression]] that is named. | ||
| * - [[TimeZoneAwareExpression]]: A common base trait for time zone aware expressions. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we also mention
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||
| * | ||
| * - [[LeafExpression]]: an expression that has no child. | ||
| * - [[UnaryExpression]]: an expression that has one child. | ||
|
|
@@ -54,12 +69,20 @@ import org.apache.spark.sql.types._ | |
| * - [[BinaryOperator]]: a special case of [[BinaryExpression]] that requires two children to have | ||
| * the same output data type. | ||
| * | ||
| * A few important traits used for type coercion rules: | ||
| * - [[ExpectsInputTypes]]: an expression that has the expected input types. This trait is typically | ||
| * used by operator expressions (e.g. [[Add]], [[Subtract]]) to define | ||
| * expected input types without any implicit casting. | ||
| * - [[ImplicitCastInputTypes]]: an expression that has the expected input types, which can be | ||
| * implicitly castable using [[TypeCoercion.ImplicitTypeCasts]]. | ||
| * - [[ComplexTypeMergingExpression]]: to resolve output types of the complex expressions | ||
| * (e.g., [[CaseWhen]]). | ||
| */ | ||
| abstract class Expression extends TreeNode[Expression] { | ||
|
|
||
| /** | ||
| * Returns true when an expression is a candidate for static evaluation before the query is | ||
| * executed. | ||
| * executed. A typical use case: [[org.apache.spark.sql.catalyst.optimizer.ConstantFolding]] | ||
| * | ||
| * The following conditions are used to determine suitability for constant folding: | ||
| * - A [[Coalesce]] is foldable if all of its children are foldable | ||
|
|
@@ -72,7 +95,8 @@ abstract class Expression extends TreeNode[Expression] { | |
|
|
||
| /** | ||
| * Returns true when the current expression always return the same result for fixed inputs from | ||
| * children. | ||
| * children. The non-deterministic expressions should not change in number and order. They should | ||
| * not be evaluated during the query planning. | ||
| * | ||
| * Note that this means that an expression should be considered as non-deterministic if: | ||
| * - it relies on some mutable internal state, or | ||
|
|
@@ -252,8 +276,9 @@ abstract class Expression extends TreeNode[Expression] { | |
|
|
||
|
|
||
| /** | ||
| * An expression that cannot be evaluated. Some expressions don't live past analysis or optimization | ||
| * time (e.g. Star). This trait is used by those expressions. | ||
| * An expression that cannot be evaluated. These expressions don't live past analysis or | ||
| * optimization time (e.g. Star) and should not be evaluated during query planning and | ||
| * execution. | ||
| */ | ||
| trait Unevaluable extends Expression { | ||
|
|
||
|
|
@@ -724,9 +749,10 @@ abstract class TernaryExpression extends Expression { | |
| } | ||
|
|
||
| /** | ||
| * A trait resolving nullable, containsNull, valueContainsNull flags of the output date type. | ||
| * This logic is usually utilized by expressions combining data from multiple child expressions | ||
| * of non-primitive types (e.g. [[CaseWhen]]). | ||
| * A trait used for resolving nullable flags, including `nullable`, `containsNull` of [[ArrayType]] | ||
| * and `valueContainsNull` of [[MapType]], containsNull, valueContainsNull flags of the output date | ||
| * type. This is usually utilized by the expressions (e.g. [[CaseWhen]]) that combine data from | ||
| * multiple child expressions of non-primitive types. | ||
| */ | ||
| trait ComplexTypeMergingExpression extends Expression { | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
doesn't->do not