That's tricky and related to Doctrine. While I am not 100% (almost 100% sure though) sure this is how XC determines which records are orders and which are not - is_order = 1 for placed orders
The Repo Order class when creating the query builder uses "placedOnly" parameter. Search the class fot it and you will see how it adds condition to select only records that are an instance of Order.
The Model Order class has these Doctrine annotations
@DiscriminatorColumn
@DiscriminatorMap
These 2 tell DQL what determines the "instance of" condition
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/annotations-reference.html#discriminatorcolumn