@@ -538,11 +538,23 @@ void ir_gen::emit_schema_get_field() {
538
538
);
539
539
call->add_arg (lir::inst_value_t::variable (" self" ));
540
540
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 ;
541
547
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))
545
556
);
557
+ ++count;
546
558
}
547
559
rule_impl->get_block ()->add_new_content (call);
548
560
}
@@ -1102,6 +1114,16 @@ void ir_gen::report_ignored_DO_schema_data_constraint() {
1102
1114
err.warn_ignored_DO_schema (ignored_DO_schema);
1103
1115
}
1104
1116
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
+
1105
1127
bool ir_gen::visit_number_literal (number_literal* node) {
1106
1128
value_stack.push_back ({
1107
1129
data_kind::literal,
@@ -2488,6 +2510,7 @@ void ir_gen::generate(const cli::configure& config, ast_root* root) {
2488
2510
root->accept (this );
2489
2511
2490
2512
report_ignored_DO_schema_data_constraint ();
2513
+ report_no_output_predicate ();
2491
2514
}
2492
2515
2493
2516
}
0 commit comments