File tree Expand file tree Collapse file tree
src/storage/adapter/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -218,12 +218,13 @@ export class ClickHouseQueryDialect implements QueryDialect {
218218 for ( const condition of group . conditions ) {
219219 if ( condition . field === "eventType" ) continue ;
220220 const def = FIELD_REGISTRY [ table ] ?. [ condition . field ] ;
221- if ( ! def ?. chWhere ) continue ;
221+
222+ const colExpr = def ?. chWhere || def ?. chAggExpr || def ?. chSelect || "NULL" ;
222223 const op = OPERATOR_SQL [ condition . operator ] ;
223224 if ( ! op ) continue ;
224225
225226 const paramName = `p_${ paramIndex . value ++ } ` ;
226- const paramType = def . chParamType ;
227+ const paramType = def ? .chParamType || "String" ;
227228
228229 let value : string | number = condition . value ;
229230 if (
@@ -237,7 +238,7 @@ export class ClickHouseQueryDialect implements QueryDialect {
237238 }
238239
239240 params [ paramName ] = value ;
240- parts . push ( `${ def . chWhere } ${ op } {${ paramName } :${ paramType } }` ) ;
241+ parts . push ( `${ colExpr } ${ op } {${ paramName } :${ paramType } }` ) ;
241242 }
242243
243244 for ( const subGroup of group . groups ) {
Original file line number Diff line number Diff line change @@ -190,11 +190,14 @@ export class PostgresQueryDialect implements QueryDialect {
190190 for ( const cond of group . conditions ) {
191191 if ( cond . field === "eventType" ) continue ;
192192 const def = FIELD_REGISTRY [ table ] ?. [ cond . field ] ;
193- if ( ! def ?. pgWhereCol ) continue ;
193+
194+ const colExpr =
195+ def ?. pgWhereCol || def ?. pgAggExpr || def ?. pgSelect || "NULL" ;
194196 const op = OPERATOR_SQL [ cond . operator ] ;
195197 if ( ! op ) continue ;
198+
196199 parts . push (
197- sql `${ sql . raw ( def . pgWhereCol ) } ${ sql . raw ( op ) } ${ cond . value } ${ sql . raw ( def . pgWhereCast ) } `
200+ sql `${ sql . raw ( colExpr ) } ${ sql . raw ( op ) } ${ cond . value } ${ sql . raw ( def ? .pgWhereCast || "" ) } `
198201 ) ;
199202 }
200203
You can’t perform that action at this time.
0 commit comments