When building a data object query, you can add Filters to it and then pass it into a DOS load. However, recently we were wondering if the ordering of the filters matter. What if we had a list of filters constructed like this:
DataObjectQuery queryExample = dataObjectQuery(types(ExampleMetadataConstants.TYPE),
stringEquals(ExampleMetadataConstants.ID_A.toString(), testA),
stringEquals(ExampleMetadataConstants.ID_B.toString(), testB),
dateCompare(ExampleMetadataConstants.DATE.toString(), Operator.LESS_THAN_OR_EQUAL_TO, LocalDate.now()),
orderBy(ExampleMetadataConstants.DATE, true));
vs…
DataObjectQuery queryExample = dataObjectQuery(types(ExampleMetadataConstants.TYPE),
orderBy(ExampleMetadataConstants.DATE, true),
stringEquals(ExampleMetadataConstants.ID_A.toString(), testA),
stringEquals(ExampleMetadataConstants.ID_B.toString(), testB),
dateCompare(ExampleMetadataConstants.DATE.toString(), Operator.LESS_THAN_OR_EQUAL_TO, LocalDate.now()));
Again this is just something we were wondering about since in SQL the orderBy predicate usually acts last (and so has to put last) - i.e., select A from B order by C