|
@@ -28,6 +28,26 @@ case class CompanyForCidUtils(s: SparkSession, space: String, sourceTable: Strin
|
|
|
|
|
|
val cols_md5 = disCol.filter(!_.equals("new_cid"))
|
|
|
|
|
|
+ val ddl = spark.table(odsTable).schema.filter(s=>{!"ds".equals(s.name)}).map(s=>{
|
|
|
+
|
|
|
+ val name = s.name
|
|
|
+ val dataType = s.dataType
|
|
|
+ s"$name ${DataTypeUtils.getDataType(dataType)} COMMENT '${s.getComment().getOrElse("")}'\n"
|
|
|
+ }).mkString(",")
|
|
|
+
|
|
|
+
|
|
|
+ sql(
|
|
|
+ s"""
|
|
|
+ |CREATE TABLE IF NOT EXISTS ${adsTable}
|
|
|
+ |(
|
|
|
+ | rowkey STRING COMMENT 'FIELD'
|
|
|
+ | ,new_cid STRING COMMENT 'FIELD'
|
|
|
+ | ,$ddl
|
|
|
+ |)
|
|
|
+ |COMMENT 'TABLE COMMENT'
|
|
|
+ |PARTITIONED BY (ds STRING COMMENT '分区')
|
|
|
+ |""".stripMargin)
|
|
|
+
|
|
|
//替换字段
|
|
|
sql(
|
|
|
s"""
|