I'm trying to do self non-equi join on a date and a numeric column. The single column version of both non-equi joins produce the expected results, but when i try both columns in the on clause, i get some
very funky output.
d[d, if (.GRP == 4) x.index, on = .(index > index, FwdHi > High), by = .EACHI]
# index FwdHi V1
# 1: 2017-08-30 52.29 1970-01-01
# same result OP sees
d[d, x.index, on = .(index > index, FwdHi > High), by = .EACHI]
# index FwdHi x.index
# 1: 2017-08-30 52.29 <NA>
# correct result
Somehow the inclusion of other groups in the join affects the values in this group. I think it's similar to #2275
I have been doing some work on a workaround for this issues, by chaining d[...][...][...] the output of each condition into a discrete expression of the next. This produces correct output.
My real world case is more complex than the example above and i have been testing various combination of chaining schemes. What is interesting is that when i mix data-types on conditions. the processing is much slower than chaining those same conditions. eg:
d[d, on = .(index > index, FwdHi > High)]
where processing is on both date and numerics, is much slower than: d[d, on = .(index > index)[FwdHi > High)]
I figured i'd note this, just in case it helps identify the source of the problem