snowflake.snowpark.functions.interval_day_time_from_parts

snowflake.snowpark.functions.interval_day_time_from_parts(days: Optional[Union[Column, str]] = None, hours: Optional[Union[Column, str]] = None, mins: Optional[Union[Column, str]] = None, secs: Optional[Union[Column, str]] = None) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.39.0/src/snowflake/snowpark/functions.py#L11044-L11188)

Creates a day-time interval expression using with specified days, hours, mins and seconds.

This DayTime is not to be confused with the interval created by make_interval. You can define a table column to be of data type DayTimeIntervalType.

Parameters:
  • days – The number of days, positive or negative

  • hours – The number of hours, positive or negative

  • mins – The number of minutes, positive or negative

  • secs – The number of seconds, positive or negative

Returns:

A Column representing a day-time interval

Example:

>>> from snowflake.snowpark.functions import interval_day_time_from_parts
>>>
>>> _ = session.sql("ALTER SESSION SET FEATURE_INTERVAL_TYPES=ENABLED;").collect()
>>> df = session.create_dataframe([[1, 12, 30, 01.001001]], ['day', 'hour', 'min', 'sec'])
>>> df.select(interval_day_time_from_parts(col("day"), col("hour"), col("min"), col("sec")).alias("interval")).show()
--------------------------
|"INTERVAL"              |
--------------------------
|1 day, 12:30:01.001000  |
--------------------------




This function or method is in private preview since 1.38.0. Type DayTimeIntervalType is currently in private preview and needs to be enabled by setting parameter `FEATURE_INTERVAL_TYPES` to `ENABLED`.
Copy
语言: 中文