类 DeltaTableBuilder 继承 AnyRef
:: 演进中 :
用于指定如何创建/替换 Delta 表的构建器。您必须在执行构建器之前指定表名或路径。您可以指定表列、分区列、数据位置、表注释和属性,以及如何创建/替换 Delta 表。
执行构建器后,将返回 DeltaTable 的实例。
使用表名创建带生成列的 Delta 表的 Scala 示例
val table: DeltaTable = DeltaTable.create() .tableName("testTable") .addColumn("c1", dataType = "INT", nullable = false) .addColumn( DeltaTable.columnBuilder("c2") .dataType("INT") .generatedAlwaysAs("c1 + 10") .build() ) .addColumn( DeltaTable.columnBuilder("c3") .dataType("INT") .comment("comment") .nullable(true) .build() ) .partitionedBy("c1", "c2") .execute()
使用位置创建 Delta 表的 Scala 示例
val table: DeltaTable = DeltaTable.createIfNotExists(spark) .location("/foo/`bar`") .addColumn("c1", dataType = "INT", nullable = false) .addColumn( DeltaTable.columnBuilder(spark, "c2") .dataType("INT") .generatedAlwaysAs("c1 + 10") .build() ) .addColumn( DeltaTable.columnBuilder(spark, "c3") .dataType("INT") .comment("comment") .nullable(true) .build() ) .partitionedBy("c1", "c2") .execute()
替换表的 Java 示例
DeltaTable table = DeltaTable.replace() .tableName("db.table") .addColumn("c1", "INT", false) .addColumn( DeltaTable.columnBuilder("c2") .dataType("INT") .generatedAlwaysBy("c1 + 10") .build() ) .execute();
- 注解
- @Evolving()
- 自
1.0.0
- 按字母顺序
- 按继承顺序
- DeltaTableBuilder
- AnyRef
- Any
- 隐藏所有
- 显示所有
- 公共
- 受保护的
值成员
- final def !=(arg0: Any): Boolean
- 定义类
- AnyRef → Any
- final def ##: Int
- 定义类
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- 定义类
- AnyRef → Any
- def addColumn(col: StructField): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定列。
- col
structField 列结构
- 注解
- @Evolving()
- 自
1.0.0
- def addColumn(colName: String, dataType: DataType, nullable: Boolean): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定列。
- colName
string 列名
- dataType
dataType DDL 数据类型
- nullable
boolean 列是否可为空
- 注解
- @Evolving()
- 自
1.0.0
- def addColumn(colName: String, dataType: String, nullable: Boolean): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定列。
- colName
string 列名
- dataType
string DDL 数据类型
- nullable
boolean 列是否可为空
- 注解
- @Evolving()
- 自
1.0.0
- def addColumn(colName: String, dataType: DataType): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定列。
- colName
string 列名
- dataType
dataType DDL 数据类型
- 注解
- @Evolving()
- 自
1.0.0
- def addColumn(colName: String, dataType: String): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定列。
- colName
string 列名
- dataType
string DDL 数据类型
- 注解
- @Evolving()
- 自
1.0.0
- def addColumns(cols: StructType): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
使用现有模式指定列。
- cols
structType 列的现有模式
- 注解
- @Evolving()
- 自
1.0.0
- final def asInstanceOf[T0]: T0
- 定义类
- Any
- def clone(): AnyRef
- 属性
- protected[lang]
- 定义类
- AnyRef
- 注解
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def clusterBy(colNames: String*): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定在文件系统上对输出进行聚类的列。
注意:这应该只包含模式中已定义的表列。
- colNames
string* 用于聚类的列名
- 注解
- @Evolving() @varargs()
- 自
3.2.0
- def comment(comment: String): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定表注释以描述表。
- comment
string 表注释
- 注解
- @Evolving()
- 自
1.0.0
- final def eq(arg0: AnyRef): Boolean
- 定义类
- AnyRef
- def equals(arg0: AnyRef): Boolean
- 定义类
- AnyRef → Any
- def execute(): DeltaTable
:: 演进中 :
:: 演进中 :
执行命令以创建/替换 Delta 表并返回 DeltaTable 的实例。
- 注解
- @Evolving()
- 自
1.0.0
- final def getClass(): Class[_ <: AnyRef]
- 定义类
- AnyRef → Any
- 注解
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- 定义类
- AnyRef → Any
- 注解
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- 定义类
- Any
- def location(location: String): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定存储表数据的目录路径,可以是分布式存储上的路径。
- location
string 数据位置
- 注解
- @Evolving()
- 自
1.0.0
- final def ne(arg0: AnyRef): Boolean
- 定义类
- AnyRef
- final def notify(): Unit
- 定义类
- AnyRef
- 注解
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- 定义类
- AnyRef
- 注解
- @IntrinsicCandidate() @native()
- def partitionedBy(colNames: String*): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定在文件系统上对输出进行分区的列。
注意:这应该只包含模式中已定义的表列。
- colNames
string* 用于分区的列名
- 注解
- @Evolving() @varargs()
- 自
1.0.0
- def property(key: String, value: String): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定键值对以标记表定义。
- key
string 表属性键
- value
string 表属性值
- 注解
- @Evolving()
- 自
1.0.0
- final def synchronized[T0](arg0: => T0): T0
- 定义类
- AnyRef
- def tableName(identifier: String): DeltaTableBuilder
:: 演进中 :
:: 演进中 :
指定表名,可选地用数据库名限定 [database_name.] table_name
- identifier
string 表名
- 注解
- @Evolving()
- 自
1.0.0
- def toString(): String
- 定义类
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- 定义类
- AnyRef
- 注解
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- 定义类
- AnyRef
- 注解
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- 定义类
- AnyRef
- 注解
- @throws(classOf[java.lang.InterruptedException])
已弃用的值成员
- def finalize(): Unit
- 属性
- protected[lang]
- 定义类
- AnyRef
- 注解
- @throws(classOf[java.lang.Throwable]) @Deprecated
- 已弃用
(版本 9 起)