ASTERIXDB-1531: fix ORDER BY with primary keys as non-prefix sort keys.

- clean up the local property inference implemenation;
- avoid side-effects for data properties during property matching.

Change-Id: Iee7fcdd6eb1279e8ee14ba75ee31ac118b00c806
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1022
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 1465ca7..83c2ef6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -2973,6 +2973,11 @@
         <output-dir compare="Text">prefix-search</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="misc">
+      <compilation-unit name="query-ASTERIXDB-1531">
+        <output-dir compare="Text">query-ASTERIXDB-1531</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="open-index-enforced">
     <test-group FilePath="open-index-enforced/error-checking">