@@ -90,7 +90,7 @@ struct LanceScanBindData : public TableFunctionData {
9090 ArrowTableSchema arrow_table;
9191 vector<string> names;
9292 vector<LogicalType> types;
93- string lance_complex_filter_sql ;
93+ string lance_pushed_filter_sql ;
9494
9595 ~LanceScanBindData () override {
9696 if (dataset) {
@@ -413,7 +413,7 @@ static bool TrySerializeLanceExpr(const LogicalGet &get,
413413 }
414414 out_sql = " (" + child_sql +
415415 (op.type == ExpressionType::OPERATOR_IS_NULL ? " IS NULL)"
416- : " IS NOT NULL)" );
416+ : " IS NOT NULL)" );
417417 return true ;
418418 }
419419 if (op.type == ExpressionType::COMPARE_IN ||
@@ -467,7 +467,7 @@ static bool TrySerializeLanceExpr(const LogicalGet &get,
467467}
468468
469469static void
470- LancePushdownComplexFilter (ClientContext &, LogicalGet &get,
470+ LancePushdownComplexFilter (ClientContext &context , LogicalGet &get,
471471 FunctionData *bind_data,
472472 vector<unique_ptr<Expression>> &filters) {
473473 if (!bind_data || filters.empty ()) {
@@ -493,11 +493,11 @@ LancePushdownComplexFilter(ClientContext &, LogicalGet &get,
493493 return ;
494494 }
495495 auto pushed_sql = StringUtil::Join (predicates, " AND " );
496- if (scan_bind.lance_complex_filter_sql .empty ()) {
497- scan_bind.lance_complex_filter_sql = std::move (pushed_sql);
496+ if (scan_bind.lance_pushed_filter_sql .empty ()) {
497+ scan_bind.lance_pushed_filter_sql = std::move (pushed_sql);
498498 } else {
499- scan_bind.lance_complex_filter_sql =
500- " (" + scan_bind.lance_complex_filter_sql + " ) AND (" + pushed_sql + " )" ;
499+ scan_bind.lance_pushed_filter_sql =
500+ " (" + scan_bind.lance_pushed_filter_sql + " ) AND (" + pushed_sql + " )" ;
501501 }
502502}
503503
@@ -583,13 +583,15 @@ LanceScanInitGlobal(ClientContext &context, TableFunctionInitInput &input) {
583583 }
584584
585585 auto table_filter_sql = BuildLanceFilterSQL (bind_data, input);
586- if (bind_data.lance_complex_filter_sql .empty ()) {
586+ auto pushed_filter_sql = bind_data.lance_pushed_filter_sql ;
587+
588+ if (pushed_filter_sql.empty ()) {
587589 scan_state.lance_filter_sql = std::move (table_filter_sql);
588590 } else if (table_filter_sql.empty ()) {
589- scan_state.lance_filter_sql = bind_data. lance_complex_filter_sql ;
591+ scan_state.lance_filter_sql = std::move (pushed_filter_sql) ;
590592 } else {
591- scan_state.lance_filter_sql = " ( " + bind_data. lance_complex_filter_sql +
592- " ) AND (" + table_filter_sql + " )" ;
593+ scan_state.lance_filter_sql =
594+ " ( " + pushed_filter_sql + " ) AND (" + table_filter_sql + " )" ;
593595 }
594596 return state;
595597}
0 commit comments