o

org.apache.spark.sql.catalyst.util

ResolveDefaultColumns

object ResolveDefaultColumns extends QueryErrorsBase with ResolveDefaultColumnsUtils

This object contains fields to help process DEFAULT columns.

Linear Supertypes
ResolveDefaultColumnsUtils, QueryErrorsBase, DataTypeErrorsBase, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ResolveDefaultColumns
  2. ResolveDefaultColumnsUtils
  3. QueryErrorsBase
  4. DataTypeErrorsBase
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. val CURRENT_DEFAULT_COLUMN_METADATA_KEY: String
    Definition Classes
    ResolveDefaultColumnsUtils
  5. val CURRENT_DEFAULT_COLUMN_NAME: String
  6. val EXISTS_DEFAULT_COLUMN_METADATA_KEY: String
    Definition Classes
    ResolveDefaultColumnsUtils
  7. def analyze(colName: String, dataType: DataType, defaultSQL: String, statementType: String): Expression

    Parses and analyzes the DEFAULT column SQL string, returning an error upon failure.

    Parses and analyzes the DEFAULT column SQL string, returning an error upon failure.

    returns

    Result of the analysis and constant-folding operation.

  8. def analyze(field: StructField, statementType: String, metadataKey: String = CURRENT_DEFAULT_COLUMN_METADATA_KEY): Expression

    Parses and analyzes the DEFAULT column text in field, returning an error upon failure.

    Parses and analyzes the DEFAULT column text in field, returning an error upon failure.

    field

    represents the DEFAULT column value whose "default" metadata to parse and analyze.

    statementType

    which type of statement we are running, such as INSERT; useful for errors.

    metadataKey

    which key to look up from the column metadata; generally either CURRENT_DEFAULT_COLUMN_METADATA_KEY or EXISTS_DEFAULT_COLUMN_METADATA_KEY.

    returns

    Result of the analysis and constant-folding operation.

  9. def applyExistenceDefaultValuesToRow(schema: StructType, row: InternalRow, bitmask: Array[Boolean]): Unit

    Updates a subset of columns in the row with default values from the metadata in the schema.

  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  12. def constantFoldCurrentDefaultsToExistDefaults(tableSchema: StructType, statementType: String): StructType

    Finds "current default" expressions in CREATE/REPLACE TABLE columns and constant-folds them.

    Finds "current default" expressions in CREATE/REPLACE TABLE columns and constant-folds them.

    The results are stored in the "exists default" metadata of the same columns. For example, in the event of this statement:

    CREATE TABLE T(a INT, b INT DEFAULT 5 + 5)

    This method constant-folds the "current default" value, stored in the CURRENT_DEFAULT metadata of the "b" column, to "10", storing the result in the "exists default" value within the EXISTS_DEFAULT metadata of that same column. Meanwhile the "current default" metadata of this "b" column retains its original value of "5 + 5".

    The reason for constant-folding the EXISTS_DEFAULT is to make the end-user visible behavior the same, after executing an ALTER TABLE ADD COLUMNS command with DEFAULT value, as if the system had performed an exhaustive backfill of the provided value to all previously existing rows in the table instead. We choose to avoid doing such a backfill because it would be a time-consuming and costly operation. Instead, we elect to store the EXISTS_DEFAULT in the column metadata for future reference when querying data out of the data source. In turn, each data source then takes responsibility to provide the constant-folded value in the EXISTS_DEFAULT metadata for such columns where the value is not present in storage.

    tableSchema

    represents the names and types of the columns of the statement to process.

    statementType

    name of the statement being processed, such as INSERT; useful for errors.

    returns

    a copy of tableSchema with field metadata updated with the constant-folded values.

  13. def containsExplicitDefaultColumn(expr: Expression): Boolean

    Returns true if the given expression contains an explicit DEFAULT column reference.

  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  16. def existenceDefaultValues(schema: StructType): Array[Any]

    These define existence default values for the struct fields for efficiency purposes.

    These define existence default values for the struct fields for efficiency purposes. The caller should avoid using such methods in a loop for efficiency.

  17. def existenceDefaultsBitmask(schema: StructType): Array[Boolean]
  18. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def getDefaultValueExprOrNullLit(attr: Attribute, useNullAsDefault: Boolean): Option[NamedExpression]

    Generates the expression of the default value for the given attribute.

    Generates the expression of the default value for the given attribute. If there is no user-specified default value for this attribute, returns null literal if useNullAsDefault is true and the attribute is nullable.

  21. def getDefaultValueExprOrNullLit(field: StructField, useNullAsDefault: Boolean): Option[NamedExpression]

    Generates the expression of the default value for the given field.

    Generates the expression of the default value for the given field. If there is no user-specified default value for this field, returns null literal if useNullAsDefault is true and the field is nullable.

  22. def getDefaultValueExprOrNullLit(attr: Attribute): Expression

    Generates the expression of the default value for the given attribute.

    Generates the expression of the default value for the given attribute. If there is no user-specified default value for this attribute and the attribute is nullable, returns null literal, otherwise an exception is thrown.

  23. def getDefaultValueExprOrNullLit(field: StructField): Expression

    Generates the expression of the default value for the given field.

    Generates the expression of the default value for the given field. If there is no user-specified default value for this field and the field is nullable, returns null literal, otherwise an exception is thrown.

  24. def getDescribeMetadata(schema: StructType): Seq[(String, String, String)]

    If any fields in a schema have default values, appends them to the result.

  25. def getExistenceDefaultValues(schema: StructType): Array[Any]

    Parses the text representing constant-folded default column literal values.

    Parses the text representing constant-folded default column literal values. These are known as "existence" default values because each one is the constant-folded result of the original default value first assigned to the column at table/column creation time. When scanning a field from any data source, if the corresponding value is not present in storage, the output row returns this "existence" default value instead of NULL.

    returns

    a sequence of either (1) NULL, if the column had no default value, or (2) an object of Any type suitable for assigning into a row using the InternalRow.update method.

  26. def getExistenceDefaultsBitmask(schema: StructType): Array[Boolean]

    Returns an array of boolean values equal in size to the result of getExistenceDefaultValues above, for convenience.

  27. def getQueryContext(sqlContext: SQLQueryContext): Array[QueryContext]
    Definition Classes
    DataTypeErrorsBase
  28. def getSummary(sqlContext: SQLQueryContext): String
    Definition Classes
    DataTypeErrorsBase
  29. def hasExistenceDefaultValues(schema: StructType): Boolean
  30. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def isExplicitDefaultColumn(col: UnresolvedAttribute): Boolean

    Returns true if the unresolved column is an explicit DEFAULT column reference.

  32. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  33. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  34. def normalizeFieldName(str: String): String

    Normalizes a schema field name suitable for use in looking up into maps keyed by schema field names.

    Normalizes a schema field name suitable for use in looking up into maps keyed by schema field names.

    str

    the field name to normalize

    returns

    the normalized result

  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. def quoteByDefault(elem: String): String
    Attributes
    protected
    Definition Classes
    DataTypeErrorsBase
  38. def resetExistenceDefaultsBitmask(schema: StructType, bitmask: Array[Boolean]): Unit

    Resets the elements of the array initially returned from getExistenceDefaultsBitmask above.

    Resets the elements of the array initially returned from getExistenceDefaultsBitmask above. Afterwards, set element(s) to false before calling applyExistenceDefaultValuesToRow below.

  39. def resolveColumnDefaultInAssignmentValue(key: Expression, value: Expression, invalidColumnDefaultException: Throwable): Expression

    Resolves the column "DEFAULT" in UPDATE/MERGE assignment value expression if the following conditions are met: 1.

    Resolves the column "DEFAULT" in UPDATE/MERGE assignment value expression if the following conditions are met: 1. The assignment value expression is a single UnresolvedAttribute with name "DEFAULT". This means key = DEFAULT is allowed but key = DEFAULT + 1 is not. 2. The assignment key expression is a top-level column. This means col = DEFAULT is allowed but col.field = DEFAULT is not.

    The column "DEFAULT" will be resolved to the default value expression defined for the column of the assignment key.

  40. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  41. def toDSOption(option: String): String
    Definition Classes
    QueryErrorsBase
  42. def toSQLConf(conf: String): String
    Definition Classes
    DataTypeErrorsBase
  43. def toSQLConfVal(conf: String): String
    Definition Classes
    QueryErrorsBase
  44. def toSQLExpr(e: Expression): String
    Definition Classes
    QueryErrorsBase
  45. def toSQLId(parts: Seq[String]): String
    Definition Classes
    DataTypeErrorsBase
  46. def toSQLId(parts: String): String
    Definition Classes
    DataTypeErrorsBase
  47. def toSQLSchema(schema: String): String
    Definition Classes
    QueryErrorsBase
  48. def toSQLStmt(text: String): String
    Definition Classes
    DataTypeErrorsBase
  49. def toSQLType(t: AbstractDataType): String
    Definition Classes
    DataTypeErrorsBase
  50. def toSQLType(text: String): String
    Definition Classes
    DataTypeErrorsBase
  51. def toSQLValue(v: Any, t: DataType): String
    Definition Classes
    QueryErrorsBase
  52. def toSQLValue(value: Double): String
    Definition Classes
    DataTypeErrorsBase
  53. def toSQLValue(value: Float): String
    Definition Classes
    DataTypeErrorsBase
  54. def toSQLValue(value: Long): String
    Definition Classes
    DataTypeErrorsBase
  55. def toSQLValue(value: Int): String
    Definition Classes
    DataTypeErrorsBase
  56. def toSQLValue(value: Short): String
    Definition Classes
    DataTypeErrorsBase
  57. def toSQLValue(value: UTF8String): String
    Definition Classes
    DataTypeErrorsBase
  58. def toSQLValue(value: String): String
    Definition Classes
    DataTypeErrorsBase
  59. def toString(): String
    Definition Classes
    AnyRef → Any
  60. def validateCatalogForDefaultValue(schema: StructType, catalog: TableCatalog, ident: Identifier): Unit
  61. def validateTableProviderForDefaultValue(schema: StructType, tableProvider: Option[String], statementType: String, addNewColumnToExistingTable: Boolean): Unit
  62. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  63. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  65. object BuiltInFunctionCatalog extends FunctionCatalog

    This is a FunctionCatalog for performing analysis using built-in functions only.

    This is a FunctionCatalog for performing analysis using built-in functions only. It is a helper for the DefaultColumnAnalyzer above.

  66. object DefaultColumnAnalyzer extends Analyzer

    This is an Analyzer for processing default column values using built-in functions only.

  67. object DefaultColumnOptimizer extends Optimizer

    This is an Optimizer for convert default column expressions to foldable literals.

Inherited from ResolveDefaultColumnsUtils

Inherited from QueryErrorsBase

Inherited from DataTypeErrorsBase

Inherited from AnyRef

Inherited from Any

Ungrouped