object ResolveDefaultColumns
This object contains fields to help process DEFAULT columns.
- Alphabetic
- By Inheritance
- ResolveDefaultColumns
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val CURRENT_DEFAULT_COLUMN_METADATA_KEY: String
- val CURRENT_DEFAULT_COLUMN_NAME: String
- val EXISTS_DEFAULT_COLUMN_METADATA_KEY: String
- 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.
- 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.
- def applyExistenceDefaultValuesToRow(schema: StructType, row: InternalRow): Unit
Updates a subset of columns in the row with default values from the metadata in the schema.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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
tableSchemawith field metadata updated with the constant-folded values.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getDescribeMetadata(schema: StructType): Seq[(String, String, String)]
If any fields in a schema have default values, appends them to the result.
- 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.
- def getExistenceDefaultsBitmask(schema: StructType): Array[Boolean]
Returns an array of boolean values equal in size to the result of getExistenceDefaultValues above, for convenience.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def resetExistenceDefaultsBitmask(schema: StructType): 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.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def validateCatalogForDefaultValue(schema: StructType, catalog: TableCatalog, ident: Identifier): Unit
- def validateTableProviderForDefaultValue(schema: StructType, tableProvider: Option[String], statementType: String, addNewColumnToExistingTable: Boolean): Unit
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- 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.
- object DefaultColumnAnalyzer extends Analyzer
This is an Analyzer for processing default column values using built-in functions only.