Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/1919#discussion_r16340505
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveTable.scala
---
@@ -159,6 +162,36 @@ case class InsertIntoHiveTable(
writer.commitJob()
}
+ def getDynamicPartDir(tableInfo: TableDesc, row: Row, dynamicPartNum2:
Int, jobConf: JobConf) :String = {
+ dynamicPartNum2 match {
+ case 0 =>""
+ case i => {
+ val colsNum =
tableInfo.getProperties.getProperty("columns").split("\\,").length
+ val partColStr =
tableInfo.getProperties.getProperty("partition_columns")
+ val partCols = partColStr.split("/")
+ var buf = new StringBuffer()
+ if (partCols.length == dynamicPartNum2) {
+ for (j <- 0 until partCols.length) {
+
buf.append("/").append(partCols(j)).append("=").append(handleNull(row(colsNum +
j ), jobConf))
+ }
+ } else {
+ for (j <- 0 until dynamicPartNum2) {
+ buf.append("/").append(partCols(j + partCols.length -
dynamicPartNum2)).append("=").append(handleNull(row(colsNum + j), jobConf))
+ }
+ }
+ buf.toString
+ }
+ }
+ }
+
+ def handleNull(obj :Any, jobConf: JobConf) :String = {
--- End diff --
Should be `private`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]