Changeset: 98adfbf8eda2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/98adfbf8eda2
Modified Files:
        sql/test/nested/Tests/events.test.in
        sql/test/nested/Tests/webclicks.test.in
Branch: nested
Log Message:

add some functions aliases in tests


diffs (62 lines):

diff --git a/sql/test/nested/Tests/events.test.in 
b/sql/test/nested/Tests/events.test.in
--- a/sql/test/nested/Tests/events.test.in
+++ b/sql/test/nested/Tests/events.test.in
@@ -54,7 +54,14 @@ statement ok
 insert into events select * from read_ndjson(r'$TSTSRCDIR/events.ndjson')
 
 statement ok
-CREATE OR REPLACE FUNCTION pcre_match(s string, pattern string) RETURNS 
boolean EXTERNAL NAME pcre."match"
+CREATE OR REPLACE FUNCTION REGEXP_CONTAINS(s string, pattern string) RETURNS 
boolean EXTERNAL NAME pcre."match"
+
+statement ok
+CREATE OR REPLACE FUNCTION TIMESTAMP_TRUNC(t timestamp, granularity string)
+returns timestamp
+begin
+return sys.date_trunc(granularity, t);
+end
 
 # this is not exactly the functionality intended
 # in the large query to follow
@@ -62,7 +69,7 @@ statement ok
 create or replace function REGEXP_EXTRACT(s string, pattern string)
 returns string
 begin
-    if (pcre_match(s, pattern))
+    if (REGEXP_CONTAINS(s, pattern))
     then return s;
     else return null;
     end if;
@@ -189,3 +196,12 @@ where row_num=1
 group by 1, 2, 3, 4
 order by 3 desc
 ----
+
+query TT
+SELECT distinct event, TIMESTAMP_TRUNC(timestamp_processed, 'hour') t FROM 
events
+WHERE NOT REGEXP_CONTAINS(user_agent, 
r'(AdsBot|Googlebot|bingbot|spider|crawler|AhrefsBot)')
+----
+link_click
+2023-03-31 14:00:00
+link_click
+2023-03-31 13:00:00
diff --git a/sql/test/nested/Tests/webclicks.test.in 
b/sql/test/nested/Tests/webclicks.test.in
--- a/sql/test/nested/Tests/webclicks.test.in
+++ b/sql/test/nested/Tests/webclicks.test.in
@@ -221,7 +221,7 @@ select ecommerce from events
 #----
 
 statement ok
-CREATE OR REPLACE FUNCTION pcre_match(s string, pattern string) RETURNS 
boolean EXTERNAL NAME pcre."match"
+CREATE OR REPLACE FUNCTION REGEXP_CONTAINS(s string, pattern string) RETURNS 
boolean EXTERNAL NAME pcre."match"
 
 # this is not exactly the functionality intended
 # in the large query to follow
@@ -229,7 +229,7 @@ statement ok
 create or replace function REGEXP_EXTRACT(s string, pattern string)
 returns string
 begin
-    if (pcre_match(s, pattern))
+    if (REGEXP_CONTAINS(s, pattern))
     then return s;
     else return null;
     end if;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to