@@ -538,11 +538,23 @@ void ir_gen::emit_schema_get_field() {
538538 );
539539 call->add_arg (lir::inst_value_t::variable (" self" ));
540540 call->add_arg (lir::inst_value_t::default_value ());
541+
542+ // enable particular index
543+ // for z in pred(_, _, z, _, _)
544+ // it's better to use pred(x, y, z, _, _) to auto generate index in souffle
545+ int count = 0 ;
546+ bool reach_field = false ;
541547 for (const auto & f : sc.second .ordered_fields ) {
542- call->add_arg (f==field?
543- lir::inst_value_t::variable (" ret?result" ):
544- lir::inst_value_t::default_value ()
548+ if (f == field) {
549+ reach_field = true ;
550+ }
551+ call->add_arg (f==field
552+ ? lir::inst_value_t::variable (" ret?result" )
553+ : reach_field
554+ ? lir::inst_value_t::default_value ()
555+ : lir::inst_value_t::variable (" ?" + std::to_string (count))
545556 );
557+ ++count;
546558 }
547559 rule_impl->get_block ()->add_new_content (call);
548560 }
@@ -1102,6 +1114,16 @@ void ir_gen::report_ignored_DO_schema_data_constraint() {
11021114 err.warn_ignored_DO_schema (ignored_DO_schema);
11031115}
11041116
1117+ void ir_gen::report_no_output_predicate () {
1118+ if (irc.souffle_output .size () || irc.annotated_output .size ()) {
1119+ return ;
1120+ }
1121+ err.warn (
1122+ " no output predicate is found, "
1123+ " execution will not generate any outputs or output files."
1124+ );
1125+ }
1126+
11051127bool ir_gen::visit_number_literal (number_literal* node) {
11061128 value_stack.push_back ({
11071129 data_kind::literal,
@@ -2488,6 +2510,7 @@ void ir_gen::generate(const cli::configure& config, ast_root* root) {
24882510 root->accept (this );
24892511
24902512 report_ignored_DO_schema_data_constraint ();
2513+ report_no_output_predicate ();
24912514}
24922515
24932516}
0 commit comments