-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21687][SQL] Spark SQL should set createTime for Hive partition #18900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
71a660a
f668ce8
2fb1dda
c833ce7
bf2a105
478e205
a00e943
e3a0cc4
b0846c3
0390e88
c843ef1
715c7cc
18c85b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,12 +93,16 @@ object CatalogStorageFormat { | |
| * @param spec partition spec values indexed by column name | ||
| * @param storage storage format of the partition | ||
| * @param parameters some parameters for the partition | ||
| * @param createTime creation time of the partition | ||
| * @param lastAccessTime last access time | ||
| * @param stats optional statistics (number of rows, total size, etc.) | ||
| */ | ||
| case class CatalogTablePartition( | ||
| spec: CatalogTypes.TablePartitionSpec, | ||
| storage: CatalogStorageFormat, | ||
| parameters: Map[String, String] = Map.empty, | ||
| createTime: Long = System.currentTimeMillis, | ||
| lastAccessTime: Long = -1, | ||
| stats: Option[CatalogStatistics] = None) { | ||
|
|
||
| def toLinkedHashMap: mutable.LinkedHashMap[String, String] = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also need to add it to this map for display
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gatorsmile Thanks for your reminding, i will add it. |
||
|
|
@@ -109,6 +113,8 @@ case class CatalogTablePartition( | |
| if (parameters.nonEmpty) { | ||
| map.put("Partition Parameters", s"{${parameters.map(p => p._1 + "=" + p._2).mkString(", ")}}") | ||
| } | ||
| map.put("Created Time", new Date(createTime).toString) | ||
| map.put("Last Access", new Date(lastAccessTime).toString) | ||
| stats.foreach(s => map.put("Partition Statistics", s.simpleString)) | ||
| map | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -995,6 +995,8 @@ private[hive] object HiveClientImpl { | |
| tpart.setTableName(ht.getTableName) | ||
| tpart.setValues(partValues.asJava) | ||
| tpart.setSd(storageDesc) | ||
| tpart.setCreateTime((p.createTime / 1000).toInt) | ||
| tpart.setLastAccessTime((p.lastAccessTime / 1000).toInt) | ||
| tpart.setParameters(mutable.Map(p.parameters.toSeq: _*).asJava) | ||
| new HivePartition(ht, tpart) | ||
| } | ||
|
|
@@ -1019,6 +1021,8 @@ private[hive] object HiveClientImpl { | |
| compressed = apiPartition.getSd.isCompressed, | ||
| properties = Option(apiPartition.getSd.getSerdeInfo.getParameters) | ||
| .map(_.asScala.toMap).orNull), | ||
| createTime = apiPartition.getCreateTime.toLong * 1000, | ||
| lastAccessTime = apiPartition.getLastAccessTime.toLong * 1000) | ||
|
||
| parameters = properties, | ||
| stats = readHiveStats(properties)) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's mention the time unit, i.e. in milliseconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it's the same as CatalogTable, in milliseconds. I fill fix this comment.