File tree 1 file changed +9
-1
lines changed
godel-script/godel-frontend/src/sema
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -581,11 +581,18 @@ bool ungrounded_parameter_checker::is_schema_get_primary_key(call_root* node) {
581
581
if (node->get_call_head ()->get_first_expression ()->get_ast_class ()!=ast_class::ac_identifier) {
582
582
return false ;
583
583
}
584
+
584
585
const auto & head_type = node->get_call_head ()->get_resolve ();
586
+ // head type should not be global symbol or data-set type
585
587
if (head_type.is_global || head_type.type .is_set ) {
586
588
return false ;
587
589
}
588
- if (node->get_call_chain ().size ()!=1 ) {
590
+
591
+ // schema get primary key pattern may be:
592
+ // 1. schema.primary_key
593
+ // 2. schema.primary_key.other_calls()
594
+ // so size should be >= 1
595
+ if (node->get_call_chain ().size ()<1 ) {
589
596
return false ;
590
597
}
591
598
const auto name = head_type.type .full_path_name_without_set ();
@@ -602,6 +609,7 @@ bool ungrounded_parameter_checker::is_schema_get_primary_key(call_root* node) {
602
609
return false ;
603
610
}
604
611
const auto key = node->get_call_chain ()[0 ]->get_field_name ()->get_name ();
612
+ // check if the field is primary key
605
613
return sc.fields .count (key) && sc.fields .at (key).primary ;
606
614
}
607
615
You can’t perform that action at this time.
0 commit comments