Skip to content

Commit

Permalink
Added STR_TO_MILLIS func to all order by ts queries (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
TJ202 authored Feb 10, 2025
1 parent c8c9f19 commit 0eb2462
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion libs/agentc_cli/agentc_cli/cmds/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def db_catalog_status(kind, bucket, cluster, compare):
GROUP BY b.catalog_identifier
) AS subquery
ON a.version.identifier = subquery.catalog_identifier
ORDER BY a.version.timestamp DESC LIMIT 1;
ORDER BY STR_TO_MILLIS(a.version.timestamp) DESC LIMIT 1;
"""
else:
# Query to get the metadata based on the kind of catalog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ WITH
PARTITION BY
_id
ORDER BY
rsli.timestamp ASC
STR_TO_MILLIS(rsli.timestamp) ASC
) AS rn
)
FROM
Expand All @@ -39,7 +39,7 @@ LETTING
SELECT VALUE
gii
ORDER BY
gii.rsl.timestamp ASC
STR_TO_MILLIS(gii.rsl.timestamp) ASC
) AS gi
SELECT
gi.rsl.content AS content,
Expand All @@ -59,7 +59,7 @@ SELECT
SELECT VALUE
gi.rsl.timestamp
ORDER BY
gi.rsl.timestamp ASC
STR_TO_MILLIS(gi.rsl.timestamp) ASC
LIMIT 1
)[0] AS start_t,
vid,
Expand Down
4 changes: 2 additions & 2 deletions libs/agentc_core/agentc_core/analytics/ddls/exchanges.sqlpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WITH LatestGenerations AS (
msgsi.content,
msgsi.row_num
ORDER BY
msgsi.timestamp ASC
STR_TO_MILLIS(msgsi.timestamp) ASC
LIMIT 1
)[0],
last_message = (
Expand All @@ -40,7 +40,7 @@ WITH LatestGenerations AS (
COALESCE(msgsi.content, msgsi.tool_calls) AS content,
msgsi.row_num
ORDER BY
msgsi.timestamp DESC
STR_TO_MILLIS(msgsi.timestamp) DESC
LIMIT 1
)[0],
context = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE OR REPLACE ANALYTICS FUNCTION
SELECT VALUE
s.sid
ORDER BY
s.start_t DESC
STR_TO_MILLIS(s.start_t) DESC
LIMIT 1
)[0]
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ SELECT
s1.vid AS vid,
tool_calls AS tool_calls
ORDER BY
vid.timestamp DESC
STR_TO_MILLIS(vid.timestamp) DESC
;
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LETTING
SELECT VALUE
gi.msg
ORDER BY
gi.msg.timestamp ASC
STR_TO_MILLIS(gi.msg.timestamp) ASC
)
SELECT
s.sid AS sid,
Expand Down
2 changes: 1 addition & 1 deletion libs/agentc_core/agentc_core/catalog/catalog/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def version(self) -> VersionDescriptor:
ts_query = f"""
FROM `{self.bucket}`.`{DEFAULT_CATALOG_SCOPE}`.`{self.kind}{DEFAULT_META_COLLECTION_NAME}` AS t
SELECT VALUE t.version
ORDER BY t.version.timestamp DESC
ORDER BY STR_TO_MILLIS(t.version.timestamp) DESC
LIMIT 1
"""
res, err = execute_query(self.cluster, ts_query)
Expand Down
2 changes: 1 addition & 1 deletion libs/agentc_core/agentc_core/learned/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def validate_embedding_model(self) -> "EmbeddingModel":
SELECT
VALUE mc.embedding_model
ORDER BY
mc.version.timestamp DESC
STR_TO_MILLIS(mc.version.timestamp) DESC
LIMIT 1
"""
]
Expand Down
4 changes: 2 additions & 2 deletions templates/agents/with_controlflow/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
" msgsi.content,\n",
" msgsi.row_num\n",
" ORDER BY\n",
" msgsi.timestamp ASC\n",
" STR_TO_MILLIS(msgsi.timestamp) ASC\n",
" LIMIT 1\n",
" )[0],\n",
" last_message = (\n",
Expand All @@ -106,7 +106,7 @@
" COALESCE(msgsi.content, msgsi.tool_calls) AS content,\n",
" msgsi.row_num\n",
" ORDER BY \n",
" msgsi.timestamp DESC\n",
" STR_TO_MILLIS(msgsi.timestamp) DESC\n",
" LIMIT 1\n",
" )[0],\n",
" context = (\n",
Expand Down

0 comments on commit 0eb2462

Please sign in to comment.