[ASTERIXDB-2999][RT] Round towards zero when convering floating-point to integer
authorDmitry Lychagin <dmitry.lychagin@couchbase.com>
Mon, 13 Dec 2021 20:50:10 +0000 (12:50 -0800)
committerDmitry Lychagin <dmitry.lychagin@couchbase.com>
Tue, 14 Dec 2021 21:35:59 +0000 (21:35 +0000)
commit3030acb653b41a52c97a842043e36739f1677554
tree6ecfe6c3d90e4a48c69c0dc5217f4c7d8308332d
parentd5e5d0f8a71be2220224d19668c9cb7bc51770ec
[ASTERIXDB-2999][RT] Round towards zero when convering floating-point to integer

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Remove use of Math.floor() during floating-point to integer conversion.
  The conversion code now rounds both positivie and negative values towards zero
- Update index selection code to account for this change
- Add SqlppNumericIndexRQGTest to randomly test different combinations
  of indexes on numeric fields

Change-Id: I1c92d6235e16e6c5d9dadd7a09cd9703781eadb6
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14525
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
21 files changed:
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/ArrayBTreeAccessMethod.java
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppNumericIndexRQGTest.java [new file with mode: 0644]
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppRQGTestBase.java
asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/kurtosis_distinct/kurtosis_distinct.1.adm
asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/kurtosis_distinct/kurtosis_distinct.1.adm
asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.1.adm
asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.2.adm
asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.3.adm
asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.4.adm
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/DoubleToInt16TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/DoubleToInt32TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/DoubleToInt64TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/DoubleToInt8TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToInt16TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToInt32TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToInt64TypeConvertComputer.java
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToInt8TypeConvertComputer.java