Skip to content

Commit

Permalink
Using CAST instead of type conversion because it has higher performance
Browse files Browse the repository at this point in the history
Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
  • Loading branch information
Yury-Fridlyand committed Nov 19, 2021
1 parent d62d23f commit 96ac3ca
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions sql-jdbc/src/TableauConnector/opensearch_sql_jdbc/dialect.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -65,81 +65,81 @@
</function>

<function group='operator' name='==' return-type='bool'>
<formula>(TIMESTAMP(%1) = TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) = CAST(%2 as TIMESTAMP))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='==' return-type='bool'>
<formula>(TIMESTAMP(%1) = TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) = CAST(%2 as TIMESTAMP))</formula>
<argument type='datetime' />
<argument type='date' />
</function>
<function group='operator' name='!=' return-type='bool'>
<formula>(TIMESTAMP(%1) &lt;&gt; TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &lt;&gt; CAST(%2 as TIMESTAMP))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='!=' return-type='bool'>
<formula>(TIMESTAMP(%1) &lt;&gt; TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &lt;&gt; CAST(%2 as TIMESTAMP))</formula>
<argument type='datetime' />
<argument type='date' />
</function>
<function group='operator' name='&gt;=' return-type='bool'>
<formula>(TIMESTAMP(%1) &gt;= TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &gt;= CAST(%2 as TIMESTAMP))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='&gt;=' return-type='bool'>
<formula>(TIMESTAMP(%1) &gt;= TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &gt;= CAST(%2 as TIMESTAMP))</formula>
<argument type='datetime' />
<argument type='date' />
</function>
<function group='operator' name='&lt;=' return-type='bool'>
<formula>(TIMESTAMP(%1) &lt;= TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &lt;= CAST(%2 as TIMESTAMP))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='&lt;=' return-type='bool'>
<formula>(TIMESTAMP(%1) &lt;= TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &lt;= CAST(%2 as TIMESTAMP))</formula>
<argument type='datetime' />
<argument type='date' />
</function>
<function group='operator' name='&gt;' return-type='bool'>
<formula>(TIMESTAMP(%1) &gt; TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &gt; CAST(%2 as TIMESTAMP))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='&gt;' return-type='bool'>
<formula>(TIMESTAMP(%1) &gt; TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &gt; CAST(%2 as TIMESTAMP))</formula>
<argument type='datetime' />
<argument type='date' />
</function>
<function group='operator' name='&lt;' return-type='bool'>
<formula>(TIMESTAMP(%1) &lt; TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &lt; CAST(%2 as TIMESTAMP))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='&lt;' return-type='bool'>
<formula>(TIMESTAMP(%1) &lt; TIMESTAMP(%2))</formula>
<formula>(CAST(%1 as TIMESTAMP) &lt; CAST(%2 as TIMESTAMP))</formula>
<argument type='datetime' />
<argument type='date' />
</function>

<function group='operator' name='-' return-type='real'>
<!-- 86400 as it represents seconds in a day -->
<formula>((TO_DAYS(TIMESTAMP(%1)) - TO_DAYS(TIMESTAMP(%2))) + ((TIME_TO_SEC(TIMESTAMP(%1)) - TIME_TO_SEC(TIMESTAMP(%2))) / 86400.0))</formula>
<formula>((TO_DAYS(CAST(%1 as TIMESTAMP)) - TO_DAYS(CAST(%2 as TIMESTAMP))) + ((TIME_TO_SEC(CAST(%1 as TIMESTAMP)) - TIME_TO_SEC(CAST(%2 as TIMESTAMP))) / 86400.0))</formula>
<argument type='date' />
<argument type='datetime' />
</function>
<function group='operator' name='-' return-type='real'>
<!-- 86400 as it represents seconds in a day -->
<formula>((TO_DAYS(TIMESTAMP(%1)) - TO_DAYS(TIMESTAMP(%2))) + ((TIME_TO_SEC(TIMESTAMP(%1)) - TIME_TO_SEC(TIMESTAMP(%2))) / 86400.0))</formula>
<formula>((TO_DAYS(CAST(%1 as TIMESTAMP)) - TO_DAYS(CAST(%2 as TIMESTAMP))) + ((TIME_TO_SEC(CAST(%1 as TIMESTAMP)) - TIME_TO_SEC(CAST(%2 as TIMESTAMP))) / 86400.0))</formula>
<argument type='datetime' />
<argument type='date' />
</function>
<function group='operator' name='-' return-type='real'>
<!-- 86400 as it represents seconds in a day -->
<formula>((TO_DAYS(TIMESTAMP(%1)) - TO_DAYS(TIMESTAMP(%2))) + ((TIME_TO_SEC(TIMESTAMP(%1)) - TIME_TO_SEC(TIMESTAMP(%2))) / 86400.0))</formula>
<formula>((TO_DAYS(CAST(%1 as TIMESTAMP)) - TO_DAYS(CAST(%2 as TIMESTAMP))) + ((TIME_TO_SEC(CAST(%1 as TIMESTAMP)) - TIME_TO_SEC(CAST(%2 as TIMESTAMP))) / 86400.0))</formula>
<argument type='datetime' />
<argument type='datetime' />
</function>
Expand Down

0 comments on commit 96ac3ca

Please sign in to comment.