Jerome Isaac Haltom created CALCITE-7778:
--------------------------------------------
Summary: JDBC adapter for MSSQL generates % for MOD without
preserving grouping, giving wrong results
Key: CALCITE-7778
URL: https://issues.apache.org/jira/browse/CALCITE-7778
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.42.0
Reporter: Jerome Isaac Haltom
MOD is generated as %, which binds less tightly, so the surrounding expression
regroups and the answer changes.
{code:sql}
select 100 / mod(11, 3)
{code}
comes out as
{code:sql}
SELECT 100 / 11 % 3
FROM (VALUES (0)) AS [t] ([ZERO])
{code}
SQL Server answers 0. The expression is 100 / 2, which is 50.
HiveSqlDialect translates MOD the same way and generates the same SQL.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)