Skip to content

Commit

Permalink
fix(clickhouse): use backwards compatible string search function
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Mar 28, 2024
1 parent a67847c commit bb736fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ibis/backends/clickhouse/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ def visit_StringFind(self, op, *, arg, substr, start, end):
)

if start is not None:
return self.f.locate(arg, substr, start)
return self.f.position(arg, substr, start)

return self.f.locate(arg, substr)
return self.f.position(arg, substr)

def visit_RegexSearch(self, op, *, arg, pattern):
return sge.RegexpLike(this=arg, expression=pattern)
Expand Down Expand Up @@ -478,7 +478,7 @@ def visit_Repeat(self, op, *, arg, times):
return self.f.repeat(arg, self.f.accurateCast(times, "UInt64"))

def visit_StringContains(self, op, haystack, needle):
return self.f.locate(haystack, needle) > 0
return self.f.position(haystack, needle) > 0

def visit_DayOfWeekIndex(self, op, *, arg):
weekdays = len(calendar.day_name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SELECT
locate("t0"."string_col", 'a') - 1 AS "StringFind(string_col, 'a')"
position("t0"."string_col", 'a') - 1 AS "StringFind(string_col, 'a')"
FROM "functional_alltypes" AS "t0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SELECT
locate("t0"."string_col", "t0"."string_col") - 1 AS "StringFind(string_col, string_col)"
position("t0"."string_col", "t0"."string_col") - 1 AS "StringFind(string_col, string_col)"
FROM "functional_alltypes" AS "t0"

0 comments on commit bb736fe

Please sign in to comment.