|
@@ -35,6 +35,12 @@ object PhoenixHelper {
|
|
|
.mode("append")
|
|
|
.jdbc(PhoenixConfig.getPhoenixJDBCUrl, tableName, PhoenixConfig.getPhoenixProperties)
|
|
|
}
|
|
|
+
|
|
|
+ def save2PhoenixByJDBC(tableName: String, cols: Seq[String]): Unit = {
|
|
|
+ import org.apache.spark.sql.functions.col
|
|
|
+ val stringDf = df.select(cols.map(column => col(column).cast("string")): _*)
|
|
|
+ stringDf.save2PhoenixByJDBC(tableName)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|