Skip to content

Commit 9660fab

Browse files
committed
Replace ai_list_files truncated with last_modified column
1 parent dd089c4 commit 9660fab

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

databend_aiserver/udfs/stage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _collect_stage_files(
114114
("mode", "VARCHAR"),
115115
("content_type", "VARCHAR"),
116116
("etag", "VARCHAR"),
117-
("truncated", "BOOLEAN"),
117+
("last_modified", "TIMESTAMP"),
118118
],
119119
name="ai_list_files",
120120
)
@@ -162,6 +162,7 @@ def ai_list_files(
162162

163163
# Convert mode to string if it exists, otherwise None
164164
mode_str = str(metadata.mode) if metadata.mode is not None else None
165+
last_modified = getattr(metadata, "last_modified", None)
165166

166167
yield {
167168
"stage_name": stage_location.stage_name,
@@ -172,10 +173,9 @@ def ai_list_files(
172173
"mode": mode_str,
173174
"content_type": metadata.content_type,
174175
"etag": metadata.etag,
175-
"truncated": False,
176+
"last_modified": last_modified,
176177
}
177178

178179
except Exception as e:
179180
logging.getLogger(__name__).error("Error listing files: %s", e)
180181
# Stop yielding
181-

tests/integration/test_listing_integration.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ def test_list_stage_files_schema(running_server, memory_stage):
5353
assert "mode" in row
5454
assert "content_type" in row # May be None
5555
assert "etag" in row # May be None
56-
assert row["truncated"] is False
56+
assert "last_modified" in row
5757

5858

5959
def test_list_stage_files_truncation(running_server, memory_stage):
6060
rows = _get_listing(running_server, memory_stage, max_files=1)
6161
assert len(rows) == 1
62-
# With lazy iteration, we can't easily know if result is truncated for all rows
63-
# without buffering. Prioritizing performance over this flag.
64-
assert rows[0]["truncated"] is False
62+
assert "last_modified" in rows[0]

0 commit comments

Comments
 (0)