Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 58c7b6a

Browse files
committedJan 14, 2025··
fix(mysql): use char_length for all length calls
1 parent 6bfdc65 commit 58c7b6a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎ibis/backends/sql/compilers/mysql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def visit_FindInSet(self, op, *, needle, values):
220220

221221
def visit_EndsWith(self, op, *, arg, end):
222222
to = sge.DataType(this=sge.DataType.Type.BINARY)
223-
return self.f.right(arg, self.f.char_length(end)).eq(sge.Cast(this=end, to=to))
223+
return self.f.right(arg, self.f.length(end)).eq(sge.Cast(this=end, to=to))
224224

225225
def visit_StartsWith(self, op, *, arg, start):
226226
to = sge.DataType(this=sge.DataType.Type.BINARY)

‎ibis/backends/sql/dialects.py

+1
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ class Generator(TSQL.Generator):
363363
sge.RegexpLike: (
364364
lambda _, e: f"({e.this.sql('mysql')} RLIKE {e.expression.sql('mysql')})"
365365
),
366+
sge.Length: rename_func("char_length"),
366367
}
367368

368369

0 commit comments

Comments
 (0)
Please sign in to comment.