Python 从pysaprk中的时间戳列中减去持续时间

Python 从pysaprk中的时间戳列中减去持续时间,python,scala,apache-spark,pyspark,Python,Scala,Apache Spark,Pyspark,我试图从时间戳列中减去存储了分钟数的列 我知道下面的方法可以减去一个固定的持续时间 from pyspark.sql.functions import current_timestamp, expr (spark.range(1).select( current_timestamp().alias("now"), (current_timestamp() + expr("INTERVAL 12 MINUTES")).alias("now_plus_twelve"))) 是否

我试图从时间戳列中减去存储了分钟数的列

我知道下面的方法可以减去一个固定的持续时间

from pyspark.sql.functions import current_timestamp, expr

(spark.range(1).select(
    current_timestamp().alias("now"), 
    (current_timestamp() + expr("INTERVAL 12 MINUTES")).alias("now_plus_twelve")))
是否有方法从具有存储值的列调用此持续时间值

大概是这样的:

(spark.range(1).select(
    current_timestamp().alias("now"), 
    (current_timestamp() + expr("INTERVAL col('duration_column) MINUTES")).alias("now_plus_twelve")))

我发现它是这样工作的:

(spark.range(1).select(
    current_timestamp().alias("now"), 
    (current_timestamp() + col('duration_column')*expr("INTERVAL 1 minutes")).alias("now_plus_twelve")))