@@ -164,24 +164,31 @@ def test_date_literal_cast(assert_sql):
164164
165165
166166def test_timestamp_from_unix_seconds (simple_table , assert_sql ):
167- """Test timestamp from Unix seconds uses to_timestamp()."""
168- expr = simple_table .mutate (ts = simple_table .id .to_timestamp ())
167+ """Test timestamp from Unix seconds uses to_timestamp().
168+
169+ Uses as_timestamp('s') method to convert Unix timestamps.
170+ """
171+ expr = simple_table .mutate (ts = simple_table .id .as_timestamp ("s" ))
169172 assert_sql (expr )
170173
171174
172175def test_timestamp_from_unix_milliseconds (simple_table , assert_sql ):
173- """Test timestamp from Unix milliseconds converts to seconds."""
174- expr = simple_table .mutate (ts = simple_table .id .to_timestamp (unit = "ms" ))
176+ """Test timestamp from Unix milliseconds converts to seconds.
177+
178+ Uses as_timestamp('ms') method which divides by 1000 before calling to_timestamp().
179+ """
180+ expr = simple_table .mutate (ts = simple_table .id .as_timestamp ("ms" ))
175181 assert_sql (expr )
176182
177183
178- def test_json_extract_with_path_operator (assert_sql ):
179- """Test JSON extraction uses #>> operator for text.
184+ def test_json_extract_with_cast_to_string (assert_sql ):
185+ """Test JSON extraction can be converted to text using cast .
180186
181- Materialize doesn't have json_extract_path_text, so we use the #>> operator.
187+ Materialize doesn't have json_extract_path_text, but we can use
188+ bracket notation and cast to string.
182189 """
183190 t = ibis .table ({"json_col" : "json" }, name = "json_table" )
184- expr = t .mutate (extracted = t .json_col ["field1" ]["field2" ].as_text ( ))
191+ expr = t .mutate (extracted = t .json_col ["field1" ]["field2" ].cast ( "string" ))
185192 assert_sql (expr )
186193
187194
@@ -247,17 +254,23 @@ def test_date_now_operation(simple_table, assert_sql):
247254
248255
249256def test_interval_from_integer_days (simple_table , assert_sql ):
250- """Test creating interval from integer (days)."""
257+ """Test creating interval from integer (days).
258+
259+ Uses as_interval('D') method to convert integers to day intervals.
260+ """
251261 expr = simple_table .mutate (
252- future = simple_table .date_col + simple_table .id .to_interval ( unit = "D" )
262+ future = simple_table .date_col + simple_table .id .as_interval ( "D" )
253263 )
254264 assert_sql (expr )
255265
256266
257267def test_interval_from_integer_hours (simple_table , assert_sql ):
258- """Test creating interval from integer (hours)."""
268+ """Test creating interval from integer (hours).
269+
270+ Uses as_interval('h') method to convert integers to hour intervals.
271+ """
259272 expr = simple_table .mutate (
260- future = simple_table .timestamp_col + simple_table .id .to_interval ( unit = "h" )
273+ future = simple_table .timestamp_col + simple_table .id .as_interval ( "h" )
261274 )
262275 assert_sql (expr )
263276
0 commit comments