Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7644#discussion_r35490369
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2419,6 +2419,44 @@ object functions {
*/
def weekofyear(columnName: String): Column =
weekofyear(Column(columnName))
+ /**
+ * Gets current Unix timestamp in seconds.
+ * @group datetime_funcs
+ * @since 1.5.0
+ */
+ def from_unixtime(ut: Column): Column = FromUnixTime(Seq(ut.expr))
+
+ /**
+ * Gets current Unix timestamp in seconds.
+ * @group datetime_funcs
+ * @since 1.5.0
+ */
+ def from_unixtime(ut: Column, f: Column): Column =
FromUnixTime(Seq(ut.expr, f.expr))
+
+ /**
+ * Gets current Unix timestamp in seconds.
+ * @group datetime_funcs
+ * @since 1.5.0
+ */
+ def unix_timestamp(): Column = UnixTimestamp(Nil: Seq[Expression])
+
+ /**
+ * Converts time string in format yyyy-MM-dd HH:mm:ss to Unix timestamp
(in seconds),
+ * using the default timezone and the default locale, return null if
fail.
+ * @group datetime_funcs
+ * @since 1.5.0
+ */
+ def unix_timestamp(s: Column): Column = UnixTimestamp(Seq(s.expr))
+
+ /**
+ * Convert time string with given pattern
+ * (see
[http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html])
+ * to Unix time stamp (in seconds), return null if fail.
+ * @group datetime_funcs
+ * @since 1.5.0
+ */
+ def unix_timestamp(s: Column, p: Column): Column =
UnixTimestamp(Seq(s.expr, p.expr))
--- End diff --
p should just be a String
---
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]