@@ -236,6 +236,21 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
236236 [ AdminForthSortDirections . asc ] : 'ASC' ,
237237 [ AdminForthSortDirections . desc ] : 'DESC' ,
238238 } ;
239+
240+ isArrayType ( underlineType : string ) : boolean {
241+ return underlineType . startsWith ( 'Array(' ) || underlineType . startsWith ( 'Nullable(Array(' ) ;
242+ }
243+
244+ isNullableType ( underlineType : string ) : boolean {
245+ return underlineType . startsWith ( 'Nullable(' ) ;
246+ }
247+
248+ isStringLikeType ( underlineType : string ) : boolean {
249+ return underlineType . startsWith ( 'String' )
250+ || underlineType . startsWith ( 'FixedString' )
251+ || underlineType . startsWith ( 'Nullable(String)' )
252+ || underlineType . startsWith ( 'Nullable(FixedString)' ) ;
253+ }
239254
240255 getFilterString ( resource : AdminForthResource , filter : IAdminForthSingleFilter | IAdminForthAndOrFilter ) : string {
241256 if ( ( filter as IAdminForthSingleFilter ) . field ) {
@@ -257,6 +272,23 @@ class ClickhouseConnector extends AdminForthBaseConnector implements IAdminForth
257272 return `${ field } ${ operator } ` ;
258273 }
259274
275+ if ( ( filter . operator == AdminForthFilterOperators . LIKE || filter . operator == AdminForthFilterOperators . ILIKE )
276+ && column . isArray ?. enabled ) {
277+ placeholder = '{f$?:String}' ;
278+
279+ if ( this . isArrayType ( column . _underlineType ) ) {
280+ const arrayField = this . isNullableType ( column . _underlineType ) ? `assumeNotNull(${ field } )` : field ;
281+ const arrayMatch = `arrayExists(item -> toString(item) ${ operator } ${ placeholder } , ${ arrayField } )` ;
282+ return this . isNullableType ( column . _underlineType )
283+ ? `${ field } IS NOT NULL AND ${ arrayMatch } `
284+ : arrayMatch ;
285+ }
286+
287+ if ( this . isStringLikeType ( column . _underlineType ) ) {
288+ return `${ field } ${ operator } ${ placeholder } ` ;
289+ }
290+ }
291+
260292 if ( column . _underlineType . startsWith ( 'Decimal' ) ) {
261293 field = `toDecimal64(${ field } , 8)` ;
262294 placeholder = `toDecimal64({f$?:String}, 8)` ;
0 commit comments