From 267e9b7db2745adaa215b26d959498791f1c6811 Mon Sep 17 00:00:00 2001
From: Alexandru Hambasan <alex.hambasan2000@gmail.com>
Date: Tue, 2 Jul 2019 12:04:12 +0200
Subject: [PATCH] ticket:2068 - Extend binary induced operations with option to
indicate null values treatment
---
catalogmgr/ops.cc | 601 ++++++++++++++++++++++++++++++++-----
catalogmgr/ops.hh | 4 +-
qlparser/qtbinaryinduce.cc | 2 +-
3 files changed, 535 insertions(+), 72 deletions(-)
diff --git a/catalogmgr/ops.cc b/catalogmgr/ops.cc
index f053331c1..a283cfd10 100644
|
a
|
b
|
OpNOTBool::operator()(char *res, const char *op)
|
| 1564 | 1564 | |
| 1565 | 1565 | BinaryOp::BinaryOp(const BaseType *newResType, const BaseType *newOp1Type, |
| 1566 | 1566 | const BaseType *newOp2Type, size_t newResOff, |
| 1567 | | size_t newOp1Off, size_t newOp2Off) |
| | 1567 | size_t newOp1Off, size_t newOp2Off, bool nullAsIdentity) |
| 1568 | 1568 | : NullValuesHandler(), op1Type(newOp1Type), op2Type(newOp2Type), resType(newResType), |
| 1569 | 1569 | resOff(newResOff), op1Off(newOp1Off), op2Off(newOp2Off) |
| 1570 | 1570 | { |
| | 1571 | this->treatNullAsIdentity = nullAsIdentity; |
| 1571 | 1572 | } |
| 1572 | 1573 | |
| 1573 | 1574 | void |
| … |
… |
OpPLUSCULong::operator()(char *res, const char *op1, const char *op2)
|
| 1611 | 1612 | |
| 1612 | 1613 | if (isNull(longOp1)) |
| 1613 | 1614 | { |
| 1614 | | longRes = longOp1; |
| | 1615 | if (treatNullAsIdentity) |
| | 1616 | { |
| | 1617 | longRes = longOp2; |
| | 1618 | } |
| | 1619 | else |
| | 1620 | { |
| | 1621 | longRes = longOp1; |
| | 1622 | } |
| 1615 | 1623 | } |
| 1616 | 1624 | else if (isNull(longOp2)) |
| 1617 | 1625 | { |
| 1618 | | longRes = longOp2; |
| | 1626 | if (treatNullAsIdentity) |
| | 1627 | { |
| | 1628 | longRes = longOp1; |
| | 1629 | } |
| | 1630 | else { |
| | 1631 | longRes = longOp2; |
| | 1632 | } |
| 1619 | 1633 | } |
| 1620 | 1634 | else |
| 1621 | 1635 | { |
| … |
… |
OpPLUSULong::operator()(char *res, const char *op1, const char *op2)
|
| 1646 | 1660 | { |
| 1647 | 1661 | if (isNull(*(r_ULong *)(const_cast<char *>(op1) + op1Off))) |
| 1648 | 1662 | { |
| 1649 | | *(r_ULong *)(res + resOff) = *(r_ULong *)(const_cast<char *>(op1) + op1Off); |
| | 1663 | if (treatNullAsIdentity) |
| | 1664 | { |
| | 1665 | *(r_ULong *)(res + resOff) = *(r_ULong *)(const_cast<char *>(op2) + op1Off); |
| | 1666 | } |
| | 1667 | else { |
| | 1668 | *(r_ULong *)(res + resOff) = *(r_ULong *)(const_cast<char *>(op1) + op1Off); |
| | 1669 | } |
| 1650 | 1670 | } |
| 1651 | 1671 | else if (isNull(*(r_ULong *)(const_cast<char *>(op2) + op2Off))) |
| 1652 | 1672 | { |
| 1653 | | *(r_ULong *)(res + resOff) = *(r_ULong *)(const_cast<char *>(op2) + op2Off); |
| | 1673 | if (treatNullAsIdentity) |
| | 1674 | { |
| | 1675 | *(r_ULong *)(res + resOff) = *(r_ULong *)(const_cast<char *>(op1) + op1Off); |
| | 1676 | } |
| | 1677 | else { |
| | 1678 | *(r_ULong *)(res + resOff) = *(r_ULong *)(const_cast<char *>(op2) + op2Off); |
| | 1679 | } |
| 1654 | 1680 | } |
| 1655 | 1681 | else |
| 1656 | 1682 | { |
| … |
… |
OpMINUSCULong::operator()(char *res, const char *op1, const char *op2)
|
| 1820 | 1846 | |
| 1821 | 1847 | if (isNull(longOp1)) |
| 1822 | 1848 | { |
| 1823 | | longRes = longOp1; |
| | 1849 | if (treatNullAsIdentity) |
| | 1850 | { |
| | 1851 | longRes = longOp2; |
| | 1852 | } |
| | 1853 | else |
| | 1854 | { |
| | 1855 | longRes = longOp1; |
| | 1856 | } |
| 1824 | 1857 | } |
| 1825 | 1858 | else if (isNull(longOp2)) |
| 1826 | 1859 | { |
| 1827 | | longRes = longOp2; |
| | 1860 | if (treatNullAsIdentity) |
| | 1861 | { |
| | 1862 | longRes = longOp1; |
| | 1863 | } |
| | 1864 | else |
| | 1865 | { |
| | 1866 | longRes = longOp2; |
| | 1867 | } |
| | 1868 | |
| 1828 | 1869 | } |
| 1829 | 1870 | else |
| 1830 | 1871 | { |
| … |
… |
OpDIVCULong::operator()(char *res, const char *op1, const char *op2)
|
| 1854 | 1895 | |
| 1855 | 1896 | if (isNull(longOp1)) |
| 1856 | 1897 | { |
| 1857 | | longRes = longOp1; |
| | 1898 | if (treatNullAsIdentity) |
| | 1899 | { |
| | 1900 | longRes = longOp2; |
| | 1901 | } |
| | 1902 | else |
| | 1903 | { |
| | 1904 | longRes = longOp1; |
| | 1905 | } |
| 1858 | 1906 | } |
| 1859 | 1907 | else if (isNull(longOp2)) |
| 1860 | 1908 | { |
| 1861 | | longRes = longOp2; |
| | 1909 | if (treatNullAsIdentity) |
| | 1910 | { |
| | 1911 | longRes = longOp1; |
| | 1912 | } |
| | 1913 | else |
| | 1914 | { |
| | 1915 | longRes = longOp2; |
| | 1916 | } |
| 1862 | 1917 | } |
| 1863 | 1918 | else |
| 1864 | 1919 | { |
| … |
… |
OpMODCULong::operator()(char *res, const char *op1, const char *op2)
|
| 1895 | 1950 | |
| 1896 | 1951 | if (isNull(longOp1)) |
| 1897 | 1952 | { |
| 1898 | | longRes = longOp1; |
| | 1953 | if (treatNullAsIdentity) |
| | 1954 | { |
| | 1955 | longRes = longOp2; |
| | 1956 | } |
| | 1957 | else |
| | 1958 | { |
| | 1959 | longRes = longOp1; |
| | 1960 | } |
| 1899 | 1961 | } |
| 1900 | 1962 | else if (isNull(longOp2)) |
| 1901 | 1963 | { |
| 1902 | | longRes = longOp2; |
| | 1964 | if (treatNullAsIdentity) |
| | 1965 | { |
| | 1966 | longRes = longOp1; |
| | 1967 | } |
| | 1968 | else |
| | 1969 | { |
| | 1970 | longRes = longOp2; |
| | 1971 | } |
| 1903 | 1972 | } |
| 1904 | 1973 | else |
| 1905 | 1974 | { |
| … |
… |
OpMULTCULong::operator()(char *res, const char *op1, const char *op2)
|
| 1936 | 2005 | |
| 1937 | 2006 | if (isNull(longOp1)) |
| 1938 | 2007 | { |
| 1939 | | longRes = longOp1; |
| | 2008 | if (treatNullAsIdentity) |
| | 2009 | { |
| | 2010 | longRes = longOp2; |
| | 2011 | } |
| | 2012 | else |
| | 2013 | { |
| | 2014 | longRes = longOp1; |
| | 2015 | } |
| 1940 | 2016 | } |
| 1941 | 2017 | else if (isNull(longOp2)) |
| 1942 | 2018 | { |
| 1943 | | longRes = longOp2; |
| | 2019 | if (treatNullAsIdentity) |
| | 2020 | { |
| | 2021 | longRes = longOp1; |
| | 2022 | } |
| | 2023 | else |
| | 2024 | { |
| | 2025 | longRes = longOp2; |
| | 2026 | } |
| 1944 | 2027 | } |
| 1945 | 2028 | else |
| 1946 | 2029 | { |
| … |
… |
OpANDCULong::operator()(char *res, const char *op1, const char *op2)
|
| 1978 | 2061 | |
| 1979 | 2062 | if (isNull(longOp1)) |
| 1980 | 2063 | { |
| 1981 | | longRes = longOp1; |
| | 2064 | if (treatNullAsIdentity) |
| | 2065 | { |
| | 2066 | longRes = longOp2; |
| | 2067 | } |
| | 2068 | else |
| | 2069 | { |
| | 2070 | longRes = longOp1; |
| | 2071 | } |
| 1982 | 2072 | } |
| 1983 | 2073 | else if (isNull(longOp2)) |
| 1984 | 2074 | { |
| 1985 | | longRes = longOp2; |
| | 2075 | if (treatNullAsIdentity) |
| | 2076 | { |
| | 2077 | longRes = longOp1; |
| | 2078 | } |
| | 2079 | else |
| | 2080 | { |
| | 2081 | longRes = longOp2; |
| | 2082 | } |
| 1986 | 2083 | } |
| 1987 | 2084 | else |
| 1988 | 2085 | { |
| … |
… |
OpANDBool::operator()(char *res, const char *op1, const char *op2)
|
| 2014 | 2111 | |
| 2015 | 2112 | if (isNull(*(op1 + op1Off))) |
| 2016 | 2113 | { |
| 2017 | | *(res + resOff) = *(op1 + op1Off); |
| | 2114 | if (treatNullAsIdentity) |
| | 2115 | { |
| | 2116 | *(res + resOff) = *(op2 + op2Off); |
| | 2117 | } |
| | 2118 | else |
| | 2119 | { |
| | 2120 | *(res + resOff) = *(op1 + op1Off); |
| | 2121 | } |
| 2018 | 2122 | } |
| 2019 | 2123 | else if (isNull(*(op2 + op2Off))) |
| 2020 | 2124 | { |
| 2021 | | *(res + resOff) = *(op2 + op2Off); |
| | 2125 | if (treatNullAsIdentity) |
| | 2126 | { |
| | 2127 | *(res + resOff) = *(op1 + op1Off); |
| | 2128 | } |
| | 2129 | else |
| | 2130 | { |
| | 2131 | *(res + resOff) = *(op2 + op2Off); |
| | 2132 | } |
| 2022 | 2133 | } |
| 2023 | 2134 | else |
| 2024 | 2135 | { |
| … |
… |
OpORCULong::operator()(char *res, const char *op1, const char *op2)
|
| 2053 | 2164 | |
| 2054 | 2165 | if (isNull(longOp1)) |
| 2055 | 2166 | { |
| 2056 | | longRes = longOp1; |
| | 2167 | if (treatNullAsIdentity) |
| | 2168 | { |
| | 2169 | longRes = longOp2; |
| | 2170 | } |
| | 2171 | else |
| | 2172 | { |
| | 2173 | longRes = longOp1; |
| | 2174 | } |
| 2057 | 2175 | } |
| 2058 | 2176 | else if (isNull(longOp2)) |
| 2059 | 2177 | { |
| 2060 | | longRes = longOp2; |
| | 2178 | if (treatNullAsIdentity) |
| | 2179 | { |
| | 2180 | longRes = longOp1; |
| | 2181 | } |
| | 2182 | else |
| | 2183 | { |
| | 2184 | longRes = longOp2; |
| | 2185 | } |
| 2061 | 2186 | } |
| 2062 | 2187 | else |
| 2063 | 2188 | { |
| … |
… |
OpORBool::operator()(char *res, const char *op1, const char *op2)
|
| 2089 | 2214 | |
| 2090 | 2215 | if (isNull(*(op1 + op1Off))) |
| 2091 | 2216 | { |
| 2092 | | *(res + resOff) = *(op1 + op1Off); |
| | 2217 | if (treatNullAsIdentity) |
| | 2218 | { |
| | 2219 | *(res + resOff) = *(op2 + op2Off); |
| | 2220 | } |
| | 2221 | else |
| | 2222 | { |
| | 2223 | *(res + resOff) = *(op1 + op1Off); |
| | 2224 | } |
| 2093 | 2225 | } |
| 2094 | 2226 | else if (isNull(*(op2 + op2Off))) |
| 2095 | 2227 | { |
| 2096 | | *(res + resOff) = *(op2 + op2Off); |
| | 2228 | if (treatNullAsIdentity) |
| | 2229 | { |
| | 2230 | *(res + resOff) = *(op1 + op1Off); |
| | 2231 | } |
| | 2232 | else |
| | 2233 | { |
| | 2234 | *(res + resOff) = *(op2 + op2Off); |
| | 2235 | } |
| 2097 | 2236 | } |
| 2098 | 2237 | else |
| 2099 | 2238 | { |
| … |
… |
OpXORCULong::operator()(char *res, const char *op1, const char *op2)
|
| 2128 | 2267 | |
| 2129 | 2268 | if (isNull(longOp1)) |
| 2130 | 2269 | { |
| 2131 | | longRes = longOp1; |
| | 2270 | if (treatNullAsIdentity) |
| | 2271 | { |
| | 2272 | longRes = longOp2; |
| | 2273 | } |
| | 2274 | else |
| | 2275 | { |
| | 2276 | longRes = longOp1; |
| | 2277 | } |
| 2132 | 2278 | } |
| 2133 | 2279 | else if (isNull(longOp2)) |
| 2134 | 2280 | { |
| 2135 | | longRes = longOp2; |
| | 2281 | if (treatNullAsIdentity) |
| | 2282 | { |
| | 2283 | longRes = longOp1; |
| | 2284 | } |
| | 2285 | else |
| | 2286 | { |
| | 2287 | longRes = longOp2; |
| | 2288 | } |
| 2136 | 2289 | } |
| 2137 | 2290 | else |
| 2138 | 2291 | { |
| … |
… |
OpXORBool::operator()(char *res, const char *op1, const char *op2)
|
| 2156 | 2309 | |
| 2157 | 2310 | if (isNull(*(op1 + op1Off))) |
| 2158 | 2311 | { |
| 2159 | | *(res + resOff) = *(op1 + op1Off); |
| | 2312 | if (treatNullAsIdentity) |
| | 2313 | { |
| | 2314 | *(res + resOff) = *(op2 + op2Off); |
| | 2315 | } |
| | 2316 | else |
| | 2317 | { |
| | 2318 | *(res + resOff) = *(op1 + op1Off); |
| | 2319 | } |
| 2160 | 2320 | } |
| 2161 | 2321 | else if (isNull(*(op2 + op2Off))) |
| 2162 | 2322 | { |
| 2163 | | *(res + resOff) = *(op2 + op2Off); |
| | 2323 | if (treatNullAsIdentity) |
| | 2324 | { |
| | 2325 | *(res + resOff) = *(op1 + op1Off); |
| | 2326 | } |
| | 2327 | else |
| | 2328 | { |
| | 2329 | *(res + resOff) = *(op2 + op2Off); |
| | 2330 | } |
| 2164 | 2331 | } |
| 2165 | 2332 | else |
| 2166 | 2333 | { |
| … |
… |
OpPLUSCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2189 | 2356 | |
| 2190 | 2357 | if (isNull(longOp1)) |
| 2191 | 2358 | { |
| 2192 | | longRes = longOp1; |
| | 2359 | if (treatNullAsIdentity) |
| | 2360 | { |
| | 2361 | longRes = longOp2; |
| | 2362 | } |
| | 2363 | else |
| | 2364 | { |
| | 2365 | longRes = longOp1; |
| | 2366 | } |
| 2193 | 2367 | } |
| 2194 | 2368 | else if (isNull(longOp2)) |
| 2195 | 2369 | { |
| 2196 | | longRes = longOp2; |
| | 2370 | if (treatNullAsIdentity) |
| | 2371 | { |
| | 2372 | longRes = longOp1; |
| | 2373 | } |
| | 2374 | else |
| | 2375 | { |
| | 2376 | longRes = longOp2; |
| | 2377 | } |
| 2197 | 2378 | } |
| 2198 | 2379 | else |
| 2199 | 2380 | { |
| … |
… |
OpMINUSCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2302 | 2483 | |
| 2303 | 2484 | if (isNull(longOp1)) |
| 2304 | 2485 | { |
| 2305 | | longRes = longOp1; |
| | 2486 | if (treatNullAsIdentity) |
| | 2487 | { |
| | 2488 | longRes = longOp2; |
| | 2489 | } |
| | 2490 | else |
| | 2491 | { |
| | 2492 | longRes = longOp1; |
| | 2493 | } |
| 2306 | 2494 | } |
| 2307 | 2495 | else if (isNull(longOp2)) |
| 2308 | 2496 | { |
| 2309 | | longRes = longOp2; |
| | 2497 | if (treatNullAsIdentity) |
| | 2498 | { |
| | 2499 | longRes = longOp1; |
| | 2500 | } |
| | 2501 | else |
| | 2502 | { |
| | 2503 | longRes = longOp2; |
| | 2504 | } |
| 2310 | 2505 | } |
| 2311 | 2506 | else |
| 2312 | 2507 | { |
| … |
… |
OpDIVCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2336 | 2531 | |
| 2337 | 2532 | if (isNull(longOp1)) |
| 2338 | 2533 | { |
| 2339 | | longRes = longOp1; |
| | 2534 | if (treatNullAsIdentity) |
| | 2535 | { |
| | 2536 | longRes = longOp2; |
| | 2537 | } |
| | 2538 | else |
| | 2539 | { |
| | 2540 | longRes = longOp1; |
| | 2541 | } |
| 2340 | 2542 | } |
| 2341 | 2543 | else if (isNull(longOp2)) |
| 2342 | 2544 | { |
| 2343 | | longRes = longOp2; |
| | 2545 | if (treatNullAsIdentity) |
| | 2546 | { |
| | 2547 | longRes = longOp1; |
| | 2548 | } |
| | 2549 | else |
| | 2550 | { |
| | 2551 | longRes = longOp2; |
| | 2552 | } |
| 2344 | 2553 | } |
| 2345 | 2554 | else |
| 2346 | 2555 | { |
| … |
… |
OpMODCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2377 | 2586 | |
| 2378 | 2587 | if (isNull(longOp1)) |
| 2379 | 2588 | { |
| 2380 | | longRes = longOp1; |
| | 2589 | if (treatNullAsIdentity) |
| | 2590 | { |
| | 2591 | longRes = longOp2; |
| | 2592 | } |
| | 2593 | else |
| | 2594 | { |
| | 2595 | longRes = longOp1; |
| | 2596 | } |
| 2381 | 2597 | } |
| 2382 | 2598 | else if (isNull(longOp2)) |
| 2383 | 2599 | { |
| 2384 | | longRes = longOp2; |
| | 2600 | if (treatNullAsIdentity) |
| | 2601 | { |
| | 2602 | longRes = longOp1; |
| | 2603 | } |
| | 2604 | else |
| | 2605 | { |
| | 2606 | longRes = longOp2; |
| | 2607 | } |
| 2385 | 2608 | } |
| 2386 | 2609 | else |
| 2387 | 2610 | { |
| … |
… |
OpMULTCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2418 | 2641 | |
| 2419 | 2642 | if (isNull(longOp1)) |
| 2420 | 2643 | { |
| 2421 | | longRes = longOp1; |
| | 2644 | if (treatNullAsIdentity) |
| | 2645 | { |
| | 2646 | longRes = longOp2; |
| | 2647 | } |
| | 2648 | else |
| | 2649 | { |
| | 2650 | longRes = longOp1; |
| | 2651 | } |
| 2422 | 2652 | } |
| 2423 | 2653 | else if (isNull(longOp2)) |
| 2424 | 2654 | { |
| 2425 | | longRes = longOp2; |
| | 2655 | if (treatNullAsIdentity) |
| | 2656 | { |
| | 2657 | longRes = longOp1; |
| | 2658 | } |
| | 2659 | else |
| | 2660 | { |
| | 2661 | longRes = longOp2; |
| | 2662 | } |
| 2426 | 2663 | } |
| 2427 | 2664 | else |
| 2428 | 2665 | { |
| … |
… |
OpANDCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2460 | 2697 | |
| 2461 | 2698 | if (isNull(longOp1)) |
| 2462 | 2699 | { |
| 2463 | | longRes = longOp1; |
| | 2700 | if (treatNullAsIdentity) |
| | 2701 | { |
| | 2702 | longRes = longOp2; |
| | 2703 | } |
| | 2704 | else |
| | 2705 | { |
| | 2706 | longRes = longOp1; |
| | 2707 | } |
| 2464 | 2708 | } |
| 2465 | 2709 | else if (isNull(longOp2)) |
| 2466 | 2710 | { |
| 2467 | | longRes = longOp2; |
| | 2711 | if (treatNullAsIdentity) |
| | 2712 | { |
| | 2713 | longRes = longOp1; |
| | 2714 | } |
| | 2715 | else |
| | 2716 | { |
| | 2717 | longRes = longOp2; |
| | 2718 | } |
| 2468 | 2719 | } |
| 2469 | 2720 | else |
| 2470 | 2721 | { |
| … |
… |
OpORCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2502 | 2753 | |
| 2503 | 2754 | if (isNull(longOp1)) |
| 2504 | 2755 | { |
| 2505 | | longRes = longOp1; |
| | 2756 | if (treatNullAsIdentity) |
| | 2757 | { |
| | 2758 | longRes = longOp2; |
| | 2759 | } |
| | 2760 | else |
| | 2761 | { |
| | 2762 | longRes = longOp1; |
| | 2763 | } |
| 2506 | 2764 | } |
| 2507 | 2765 | else if (isNull(longOp2)) |
| 2508 | 2766 | { |
| 2509 | | longRes = longOp2; |
| | 2767 | if (treatNullAsIdentity) |
| | 2768 | { |
| | 2769 | longRes = longOp1; |
| | 2770 | } |
| | 2771 | else |
| | 2772 | { |
| | 2773 | longRes = longOp2; |
| | 2774 | } |
| 2510 | 2775 | } |
| 2511 | 2776 | else |
| 2512 | 2777 | { |
| … |
… |
OpXORCLong::operator()(char *res, const char *op1, const char *op2)
|
| 2544 | 2809 | |
| 2545 | 2810 | if (isNull(longOp1)) |
| 2546 | 2811 | { |
| 2547 | | longRes = longOp1; |
| | 2812 | if (treatNullAsIdentity) |
| | 2813 | { |
| | 2814 | longRes = longOp2; |
| | 2815 | } |
| | 2816 | else |
| | 2817 | { |
| | 2818 | longRes = longOp1; |
| | 2819 | } |
| 2548 | 2820 | } |
| 2549 | 2821 | else if (isNull(longOp2)) |
| 2550 | 2822 | { |
| 2551 | | longRes = longOp2; |
| | 2823 | if (treatNullAsIdentity) |
| | 2824 | { |
| | 2825 | longRes = longOp1; |
| | 2826 | } |
| | 2827 | else |
| | 2828 | { |
| | 2829 | longRes = longOp2; |
| | 2830 | } |
| 2552 | 2831 | } |
| 2553 | 2832 | else |
| 2554 | 2833 | { |
| … |
… |
OpPLUSCDouble::operator()(char *res, const char *op1, const char *op2)
|
| 2578 | 2857 | |
| 2579 | 2858 | if (isNull(doubleOp1)) |
| 2580 | 2859 | { |
| 2581 | | doubleRes = doubleOp1; |
| | 2860 | if (treatNullAsIdentity) |
| | 2861 | { |
| | 2862 | doubleRes = doubleOp2; |
| | 2863 | } |
| | 2864 | else |
| | 2865 | { |
| | 2866 | doubleRes = doubleOp2; |
| | 2867 | } |
| 2582 | 2868 | } |
| 2583 | 2869 | else if (isNull(doubleOp2)) |
| 2584 | 2870 | { |
| 2585 | | doubleRes = doubleOp2; |
| | 2871 | if (treatNullAsIdentity) |
| | 2872 | { |
| | 2873 | doubleRes = doubleOp1; |
| | 2874 | } |
| | 2875 | else |
| | 2876 | { |
| | 2877 | doubleRes = doubleOp2; |
| | 2878 | } |
| 2586 | 2879 | } |
| 2587 | 2880 | else |
| 2588 | 2881 | { |
| … |
… |
OpMINUSCDouble::operator()(char *res, const char *op1, const char *op2)
|
| 2691 | 2984 | |
| 2692 | 2985 | if (isNull(doubleOp1)) |
| 2693 | 2986 | { |
| 2694 | | doubleRes = doubleOp1; |
| | 2987 | if (treatNullAsIdentity) |
| | 2988 | { |
| | 2989 | doubleRes = doubleOp2; |
| | 2990 | } |
| | 2991 | else |
| | 2992 | { |
| | 2993 | doubleRes = doubleOp2; |
| | 2994 | } |
| 2695 | 2995 | } |
| 2696 | 2996 | else if (isNull(doubleOp2)) |
| 2697 | 2997 | { |
| 2698 | | doubleRes = doubleOp2; |
| | 2998 | if (treatNullAsIdentity) |
| | 2999 | { |
| | 3000 | doubleRes = doubleOp1; |
| | 3001 | } |
| | 3002 | else |
| | 3003 | { |
| | 3004 | doubleRes = doubleOp2; |
| | 3005 | } |
| 2699 | 3006 | } |
| 2700 | 3007 | else |
| 2701 | 3008 | { |
| … |
… |
OpDIVCDouble::operator()(char *res, const char *op1, const char *op2)
|
| 2725 | 3032 | |
| 2726 | 3033 | if (isNull(doubleOp1)) |
| 2727 | 3034 | { |
| 2728 | | doubleRes = doubleOp1; |
| | 3035 | if (treatNullAsIdentity) |
| | 3036 | { |
| | 3037 | doubleRes = doubleOp2; |
| | 3038 | } |
| | 3039 | else |
| | 3040 | { |
| | 3041 | doubleRes = doubleOp2; |
| | 3042 | } |
| 2729 | 3043 | } |
| 2730 | 3044 | else if (isNull(doubleOp2)) |
| 2731 | 3045 | { |
| 2732 | | doubleRes = doubleOp2; |
| | 3046 | if (treatNullAsIdentity) |
| | 3047 | { |
| | 3048 | doubleRes = doubleOp1; |
| | 3049 | } |
| | 3050 | else |
| | 3051 | { |
| | 3052 | doubleRes = doubleOp2; |
| | 3053 | } |
| 2733 | 3054 | } |
| 2734 | 3055 | else |
| 2735 | 3056 | { |
| … |
… |
OpMULTCDouble::operator()(char *res, const char *op1, const char *op2)
|
| 2760 | 3081 | |
| 2761 | 3082 | if (isNull(doubleOp1)) |
| 2762 | 3083 | { |
| 2763 | | doubleRes = doubleOp1; |
| | 3084 | if (treatNullAsIdentity) |
| | 3085 | { |
| | 3086 | doubleRes = doubleOp2; |
| | 3087 | } |
| | 3088 | else |
| | 3089 | { |
| | 3090 | doubleRes = doubleOp2; |
| | 3091 | } |
| 2764 | 3092 | } |
| 2765 | 3093 | else if (isNull(doubleOp2)) |
| 2766 | 3094 | { |
| 2767 | | doubleRes = doubleOp2; |
| | 3095 | if (treatNullAsIdentity) |
| | 3096 | { |
| | 3097 | doubleRes = doubleOp1; |
| | 3098 | } |
| | 3099 | else |
| | 3100 | { |
| | 3101 | doubleRes = doubleOp2; |
| | 3102 | } |
| 2768 | 3103 | } |
| 2769 | 3104 | else |
| 2770 | 3105 | { |
| … |
… |
OpPLUSChar::operator()(char *res, const char *op1, const char *op2)
|
| 4618 | 4953 | { |
| 4619 | 4954 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4620 | 4955 | { |
| 4621 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 4956 | if (treatNullAsIdentity) |
| | 4957 | { |
| | 4958 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 4959 | } |
| | 4960 | else |
| | 4961 | { |
| | 4962 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 4963 | } |
| 4622 | 4964 | } |
| 4623 | 4965 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4624 | 4966 | { |
| 4625 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 4967 | if (treatNullAsIdentity) |
| | 4968 | { |
| | 4969 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 4970 | } |
| | 4971 | else |
| | 4972 | { |
| | 4973 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 4974 | } |
| 4626 | 4975 | } |
| 4627 | 4976 | else |
| 4628 | 4977 | { |
| … |
… |
OpMAX_BINARYChar::operator()(char *res, const char *op1, const char *op2)
|
| 4654 | 5003 | { |
| 4655 | 5004 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4656 | 5005 | { |
| 4657 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5006 | if (treatNullAsIdentity) |
| | 5007 | { |
| | 5008 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5009 | } |
| | 5010 | else |
| | 5011 | { |
| | 5012 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5013 | } |
| 4658 | 5014 | } |
| 4659 | 5015 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4660 | 5016 | { |
| 4661 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5017 | if (treatNullAsIdentity) |
| | 5018 | { |
| | 5019 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5020 | } |
| | 5021 | else |
| | 5022 | { |
| | 5023 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5024 | } |
| 4662 | 5025 | } |
| 4663 | 5026 | else if (*(unsigned char *)(const_cast<char *>(op1) + op1Off) > *(unsigned char *)(const_cast<char *>(op2) + op2Off)) |
| 4664 | 5027 | { |
| … |
… |
OpMIN_BINARYChar::operator()(char *res, const char *op1, const char *op2)
|
| 4693 | 5056 | { |
| 4694 | 5057 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4695 | 5058 | { |
| 4696 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5059 | if (treatNullAsIdentity) |
| | 5060 | { |
| | 5061 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op1Off); |
| | 5062 | } |
| | 5063 | else |
| | 5064 | { |
| | 5065 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5066 | } |
| 4697 | 5067 | } |
| 4698 | 5068 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4699 | 5069 | { |
| 4700 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5070 | if (treatNullAsIdentity) |
| | 5071 | { |
| | 5072 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5073 | } |
| | 5074 | else |
| | 5075 | { |
| | 5076 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5077 | } |
| 4701 | 5078 | } |
| 4702 | 5079 | else if (*(unsigned char *)(const_cast<char *>(op1) + op1Off) < * (unsigned char *)(const_cast<char *>(op2) + op2Off)) |
| 4703 | 5080 | { |
| … |
… |
OpMINUSChar::OpMINUSChar(const BaseType *newResType, const BaseType *newOp1Type,
|
| 4730 | 5107 | void |
| 4731 | 5108 | OpMINUSChar::operator()(char *res, const char *op1, const char *op2) |
| 4732 | 5109 | { |
| 4733 | | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| | 5110 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4734 | 5111 | { |
| 4735 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5112 | if (treatNullAsIdentity) |
| | 5113 | { |
| | 5114 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op1Off); |
| | 5115 | } |
| | 5116 | else |
| | 5117 | { |
| | 5118 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5119 | } |
| 4736 | 5120 | } |
| 4737 | 5121 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4738 | 5122 | { |
| 4739 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5123 | if (treatNullAsIdentity) |
| | 5124 | { |
| | 5125 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5126 | } |
| | 5127 | else |
| | 5128 | { |
| | 5129 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5130 | } |
| 4740 | 5131 | } |
| 4741 | 5132 | else |
| 4742 | 5133 | { |
| … |
… |
OpDIVChar::operator()(char *res, const char *op1, const char *op2)
|
| 4762 | 5153 | { |
| 4763 | 5154 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4764 | 5155 | { |
| 4765 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5156 | if (treatNullAsIdentity) |
| | 5157 | { |
| | 5158 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op1Off); |
| | 5159 | } |
| | 5160 | else |
| | 5161 | { |
| | 5162 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5163 | } |
| 4766 | 5164 | } |
| 4767 | 5165 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4768 | 5166 | { |
| 4769 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5167 | if (treatNullAsIdentity) |
| | 5168 | { |
| | 5169 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5170 | } |
| | 5171 | else |
| | 5172 | { |
| | 5173 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5174 | } |
| 4770 | 5175 | } |
| 4771 | 5176 | else |
| 4772 | 5177 | { |
| … |
… |
OpMODChar::operator()(char *res, const char *op1, const char *op2)
|
| 4799 | 5204 | { |
| 4800 | 5205 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4801 | 5206 | { |
| 4802 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5207 | if (treatNullAsIdentity) |
| | 5208 | { |
| | 5209 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op1Off); |
| | 5210 | } |
| | 5211 | else |
| | 5212 | { |
| | 5213 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5214 | } |
| 4803 | 5215 | } |
| 4804 | | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| | 5216 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4805 | 5217 | { |
| 4806 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5218 | if (treatNullAsIdentity) |
| | 5219 | { |
| | 5220 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5221 | } |
| | 5222 | else |
| | 5223 | { |
| | 5224 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5225 | } |
| 4807 | 5226 | } |
| 4808 | 5227 | else |
| 4809 | 5228 | { |
| … |
… |
OpMULTChar::operator()(char *res, const char *op1, const char *op2)
|
| 4836 | 5255 | { |
| 4837 | 5256 | if (isNull(*(unsigned char *)(const_cast<char *>(op1) + op1Off))) |
| 4838 | 5257 | { |
| 4839 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5258 | if (treatNullAsIdentity) |
| | 5259 | { |
| | 5260 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op1Off); |
| | 5261 | } |
| | 5262 | else |
| | 5263 | { |
| | 5264 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5265 | } |
| 4840 | 5266 | } |
| 4841 | | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| | 5267 | else if (isNull(*(unsigned char *)(const_cast<char *>(op2) + op2Off))) |
| 4842 | 5268 | { |
| 4843 | | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5269 | if (treatNullAsIdentity) |
| | 5270 | { |
| | 5271 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op1) + op1Off); |
| | 5272 | } |
| | 5273 | else |
| | 5274 | { |
| | 5275 | *(unsigned char *)(res + resOff) = *(unsigned char *)(const_cast<char *>(op2) + op2Off); |
| | 5276 | } |
| 4844 | 5277 | } |
| 4845 | 5278 | else |
| 4846 | 5279 | { |
| … |
… |
void OpPLUSComplex::operator()(char *res, const char *op1, const char *op2)
|
| 5317 | 5750 | |
| 5318 | 5751 | if (isNull(op1Re)) |
| 5319 | 5752 | { |
| 5320 | | resRe = op1Re; |
| | 5753 | if (treatNullAsIdentity) |
| | 5754 | { |
| | 5755 | resRe = op2Re; |
| | 5756 | } |
| | 5757 | else |
| | 5758 | { |
| | 5759 | resRe = op1Re; |
| | 5760 | } |
| 5321 | 5761 | } |
| 5322 | 5762 | else if (isNull(op2Re)) |
| 5323 | 5763 | { |
| 5324 | | resRe = op2Re; |
| | 5764 | if (treatNullAsIdentity) |
| | 5765 | { |
| | 5766 | resRe = op1Re; |
| | 5767 | } |
| | 5768 | else |
| | 5769 | { |
| | 5770 | resRe = op2Re; |
| | 5771 | } |
| 5325 | 5772 | } |
| 5326 | 5773 | else |
| 5327 | 5774 | { |
| … |
… |
void OpMINUSComplex::operator()(char *res, const char *op1, const char *op2)
|
| 5580 | 6027 | |
| 5581 | 6028 | if (isNull(op1Re)) |
| 5582 | 6029 | { |
| 5583 | | resRe = op1Re; |
| | 6030 | if (treatNullAsIdentity) |
| | 6031 | { |
| | 6032 | resRe = op2Re; |
| | 6033 | } |
| | 6034 | else |
| | 6035 | { |
| | 6036 | resRe = op1Re; |
| | 6037 | } |
| 5584 | 6038 | } |
| 5585 | 6039 | else if (isNull(op2Re)) |
| 5586 | 6040 | { |
| 5587 | | resRe = op2Re; |
| | 6041 | if (treatNullAsIdentity) |
| | 6042 | { |
| | 6043 | resRe = op1Re; |
| | 6044 | } |
| | 6045 | else |
| | 6046 | { |
| | 6047 | resRe = op2Re; |
| | 6048 | } |
| 5588 | 6049 | } |
| 5589 | 6050 | else |
| 5590 | 6051 | { |
diff --git a/catalogmgr/ops.hh b/catalogmgr/ops.hh
index 6b9bf15d8..7d81f5a5c 100644
|
a
|
b
|
public:
|
| 875 | 875 | and offsets to result and operands (for structs). */ |
| 876 | 876 | BinaryOp(const BaseType *newResType, const BaseType *newOp1Type, |
| 877 | 877 | const BaseType *newOp2Type, size_t newResOff = 0, |
| 878 | | size_t newOp1Off = 0, size_t newOp2Off = 0); |
| | 878 | size_t newOp1Off = 0, size_t newOp2Off = 0, bool nullAsIdentity = false); |
| 879 | 879 | /*@ManMemo: operator to carry out operation on {\tt op1} and |
| 880 | 880 | {\tt op2} with result {\tt res}. */ |
| 881 | 881 | virtual void operator()(char *res, const char *op1, |
| … |
… |
protected:
|
| 893 | 893 | size_t resOff; |
| 894 | 894 | size_t op1Off; |
| 895 | 895 | size_t op2Off; |
| | 896 | |
| | 897 | bool treatNullAsIdentity; |
| 896 | 898 | }; |
| 897 | 899 | |
| 898 | 900 | //@ManMemo: Module: {\bf catalogif}. |
diff --git a/qlparser/qtbinaryinduce.cc b/qlparser/qtbinaryinduce.cc
index e8f079a91..138684e49 100644
|
a
|
b
|
QtBinaryInduce::computeOp(QtData *operand1, QtData *operand2)
|
| 77 | 77 | MDDObj *op1 = mdd1->getMDDObject(); |
| 78 | 78 | MDDObj *op2 = mdd2->getMDDObject(); |
| 79 | 79 | const BaseType *resultBaseType = (static_cast<MDDBaseType *>(const_cast<Type *>(dataStreamType.getType())))->getBaseType(); |
| 80 | | BinaryOp *myOp = Ops::getBinaryOp(opType, resultBaseType, op1->getCellType(), op2->getCellType()); |
| | 80 | BinaryOp *myOp = Ops::getBinaryOp(opType, resultBaseType, op1->getCellType(), op2->getCellType(), true); |
| 81 | 81 | try |
| 82 | 82 | { |
| 83 | 83 | returnValue = computeBinaryMDDOp(mdd1, mdd2, resultBaseType, myOp); |