org.apache.spark.sql.catalyst.analysis

SimpleAnalyzer

object SimpleAnalyzer extends Analyzer

A trivial Analyzer with an EmptyCatalog and EmptyFunctionRegistry. Used for testing when all relations are already filled in and the analyser needs only to resolve attribute references.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. SimpleAnalyzer
  2. Analyzer
  3. HiveTypeCoercion
  4. RuleExecutor
  5. Logging
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class Batch(name: String, strategy: Strategy, rules: Rule[TreeType]*) extends Product with Serializable

    A batch of rules.

    A batch of rules.

    Attributes
    protected
    Definition Classes
    RuleExecutor
  2. case class FixedPoint(maxIterations: Int) extends Strategy with Product with Serializable

    A strategy that runs until fix point or maxIterations times, whichever comes first.

    A strategy that runs until fix point or maxIterations times, whichever comes first.

    Definition Classes
    RuleExecutor
  3. abstract class Strategy extends AnyRef

    An execution strategy for rules that indicates the maximum number of executions.

    An execution strategy for rules that indicates the maximum number of executions. If the execution reaches fix point (i.e. converge) before maxIterations, it will stop.

    Definition Classes
    RuleExecutor

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. object BooleanCasts extends Rule[LogicalPlan]

    Casts to/from BooleanType are transformed into comparisons since the JVM does not consider Booleans to be numeric types.

    Casts to/from BooleanType are transformed into comparisons since the JVM does not consider Booleans to be numeric types.

    Definition Classes
    HiveTypeCoercion
  5. object BooleanComparisons extends Rule[LogicalPlan]

    Changes Boolean values to Bytes so that expressions like true < false can be Evaluated.

    Changes Boolean values to Bytes so that expressions like true < false can be Evaluated.

    Definition Classes
    HiveTypeCoercion
  6. object CaseWhenCoercion extends Rule[LogicalPlan]

    Coerces the type of different branches of a CASE WHEN statement to a common type.

    Coerces the type of different branches of a CASE WHEN statement to a common type.

    Definition Classes
    HiveTypeCoercion
  7. object CheckAggregation extends Rule[LogicalPlan]

    Checks for non-aggregated attributes with aggregation

    Checks for non-aggregated attributes with aggregation

    Definition Classes
    Analyzer
  8. object CheckResolution extends Rule[LogicalPlan]

    Makes sure all attributes and logical plans have been resolved.

    Makes sure all attributes and logical plans have been resolved.

    Definition Classes
    Analyzer
  9. object ConvertNaNs extends Rule[LogicalPlan]

    Converts string "NaN"s that are in binary operators with a NaN-able types (Float / Double) to the appropriate numeric equivalent.

    Converts string "NaN"s that are in binary operators with a NaN-able types (Float / Double) to the appropriate numeric equivalent.

    Definition Classes
    HiveTypeCoercion
  10. object DecimalPrecision extends Rule[LogicalPlan]

    Calculates and propagates precision for fixed-precision decimals.

    Calculates and propagates precision for fixed-precision decimals. Hive has a number of rules for this based on the SQL standard and MS SQL: https://cwiki.apache.org/confluence/download/attachments/27362075/Hive_Decimal_Precision_Scale_Support.pdf

    In particular, if we have expressions e1 and e2 with precision/scale p1/s2 and p2/s2 respectively, then the following operations have the following precision / scale:

    Operation Result Precision Result Scale ------------------------------------------------------------------------ e1 + e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2) e1 - e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2) e1 * e2 p1 + p2 + 1 s1 + s2 e1 / e2 p1 - s1 + s2 + max(6, s1 + p2 + 1) max(6, s1 + p2 + 1) e1 % e2 min(p1-s1, p2-s2) + max(s1, s2) max(s1, s2) sum(e1) p1 + 10 s1 avg(e1) p1 + 4 s1 + 4

    Catalyst also has unlimited-precision decimals. For those, all ops return unlimited precision.

    To implement the rules for fixed-precision types, we introduce casts to turn them to unlimited precision, do the math on unlimited-precision numbers, then introduce casts back to the required fixed precision. This allows us to do all rounding and overflow handling in the cast-to-fixed-precision operator.

    In addition, when mixing non-decimal types with decimals, we use the following rules: - BYTE gets turned into DECIMAL(3, 0) - SHORT gets turned into DECIMAL(5, 0) - INT gets turned into DECIMAL(10, 0) - LONG gets turned into DECIMAL(20, 0) - FLOAT and DOUBLE cause fixed-length decimals to turn into DOUBLE (this is the same as Hive, but note that unlimited decimals are considered bigger than doubles in WidenTypes)

    Definition Classes
    HiveTypeCoercion
  11. object Division extends Rule[LogicalPlan]

    Hive only performs integral division with the DIV operator.

    Hive only performs integral division with the DIV operator. The arguments to / are always converted to fractional types.

    Definition Classes
    HiveTypeCoercion
  12. object FunctionArgumentConversion extends Rule[LogicalPlan]

    This ensure that the types for various functions are as expected.

    This ensure that the types for various functions are as expected.

    Definition Classes
    HiveTypeCoercion
  13. object GlobalAggregates extends Rule[LogicalPlan]

    Turns projections that contain aggregate expressions into aggregations.

    Turns projections that contain aggregate expressions into aggregations.

    Definition Classes
    Analyzer
  14. object ImplicitGenerate extends Rule[LogicalPlan]

    When a SELECT clause has only a single expression and that expression is a Generator we convert the Project to a Generate.

    When a SELECT clause has only a single expression and that expression is a Generator we convert the Project to a Generate.

    Definition Classes
    Analyzer
  15. object Once extends Strategy with Product with Serializable

    A strategy that only runs once.

    A strategy that only runs once.

    Definition Classes
    RuleExecutor
  16. object PromoteStrings extends Rule[LogicalPlan]

    Promotes strings that appear in arithmetic expressions.

    Promotes strings that appear in arithmetic expressions.

    Definition Classes
    HiveTypeCoercion
  17. object PropagateTypes extends Rule[LogicalPlan]

    Applies any changes to AttributeReference data types that are made by other rules to instances higher in the query tree.

    Applies any changes to AttributeReference data types that are made by other rules to instances higher in the query tree.

    Definition Classes
    HiveTypeCoercion
  18. object ResolveFunctions extends Rule[LogicalPlan]

    Replaces UnresolvedFunctions with concrete Expressions.

    Replaces UnresolvedFunctions with concrete Expressions.

    Definition Classes
    Analyzer
  19. object ResolveReferences extends Rule[LogicalPlan]

    Replaces UnresolvedAttributes with concrete AttributeReferences from a logical plan node's children.

    Replaces UnresolvedAttributes with concrete AttributeReferences from a logical plan node's children.

    Definition Classes
    Analyzer
  20. object ResolveRelations extends Rule[LogicalPlan]

    Replaces UnresolvedRelations with concrete relations from the catalog.

    Replaces UnresolvedRelations with concrete relations from the catalog.

    Definition Classes
    Analyzer
  21. object ResolveSortReferences extends Rule[LogicalPlan]

    In many dialects of SQL is it valid to sort by attributes that are not present in the SELECT clause.

    In many dialects of SQL is it valid to sort by attributes that are not present in the SELECT clause. This rule detects such queries and adds the required attributes to the original projection, so that they will be available during sorting. Another projection is added to remove these attributes after sorting.

    Definition Classes
    Analyzer
  22. object StarExpansion extends Rule[LogicalPlan]

    Expands any references to Star (*) in project operators.

    Expands any references to Star (*) in project operators.

    Definition Classes
    Analyzer
  23. object StringToIntegralCasts extends Rule[LogicalPlan]

    When encountering a cast from a string representing a valid fractional number to an integral type the jvm will throw a java.lang.NumberFormatException.

    When encountering a cast from a string representing a valid fractional number to an integral type the jvm will throw a java.lang.NumberFormatException. Hive, in contrast, returns the truncated version of this number.

    Definition Classes
    HiveTypeCoercion
  24. object TrimGroupingAliases extends Rule[LogicalPlan]

    Removes no-op Alias expressions from the plan.

    Removes no-op Alias expressions from the plan.

    Definition Classes
    Analyzer
  25. object UnresolvedHavingClauseAttributes extends Rule[LogicalPlan]

    This rule finds expressions in HAVING clause filters that depend on unresolved attributes.

    This rule finds expressions in HAVING clause filters that depend on unresolved attributes. It pushes these expressions down to the underlying aggregates and then projects them away above the filter.

    Definition Classes
    Analyzer
  26. object WidenTypes extends Rule[LogicalPlan]

    Widens numeric types and converts strings to numbers when appropriate.

    Widens numeric types and converts strings to numbers when appropriate.

    Loosely based on rules from "Hadoop: The Definitive Guide" 2nd edition, by Tom White

    The implicit conversion rules can be summarized as follows:

    • Any integral numeric type can be implicitly converted to a wider type.
    • All the integral numeric types, FLOAT, and (perhaps surprisingly) STRING can be implicitly converted to DOUBLE.
    • TINYINT, SMALLINT, and INT can all be converted to FLOAT.
    • BOOLEAN types cannot be converted to any other type.

    Additionally, all types when UNION-ed with strings will be promoted to strings. Other string conversions are handled by PromoteStrings.

    Widening types might result in loss of precision in the following cases: - IntegerType to FloatType - LongType to FloatType - LongType to DoubleType

    Definition Classes
    HiveTypeCoercion
  27. def apply(plan: LogicalPlan): LogicalPlan

    Executes the batches of rules defined by the subclass.

    Executes the batches of rules defined by the subclass. The batches are executed serially using the defined execution strategy. Within each batch, rules are also executed serially.

    Definition Classes
    RuleExecutor
  28. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  29. lazy val batches: Seq[Batch]

    Defines a sequence of rule batches, to be overridden by the implementation.

    Defines a sequence of rule batches, to be overridden by the implementation.

    Definition Classes
    AnalyzerRuleExecutor
  30. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  32. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  33. val extendedRules: Seq[Rule[LogicalPlan]]

    Override to provide additional rules for the "Resolution" batch.

    Override to provide additional rules for the "Resolution" batch.

    Definition Classes
    Analyzer
  34. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. val fixedPoint: FixedPoint

    Definition Classes
    Analyzer
  36. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  37. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  38. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  39. def isTraceEnabled(): Boolean

    Attributes
    protected
    Definition Classes
    Logging
  40. def log: Logger

    Attributes
    protected
    Definition Classes
    Logging
  41. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  42. def logDebug(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  43. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  44. def logError(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  45. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  46. def logInfo(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  47. def logName: String

    Attributes
    protected
    Definition Classes
    Logging
  48. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  49. def logTrace(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  50. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  51. def logWarning(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  52. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  53. final def notify(): Unit

    Definition Classes
    AnyRef
  54. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  55. val resolver: (String, String) ⇒ Boolean

    Definition Classes
    Analyzer
  56. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  57. def toString(): String

    Definition Classes
    AnyRef → Any
  58. val typeCoercionRules: List[Rule[LogicalPlan]]

    Definition Classes
    HiveTypeCoercion
  59. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Analyzer

Inherited from HiveTypeCoercion

Inherited from RuleExecutor[LogicalPlan]

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped