Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking tests #10

Merged
merged 5 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/changes/changes_0.1.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tableau-connector 0.1.0, released 2021-01-04
# tableau-connector 0.1.0, released 2021-??-??

Code name: Green original tests

Expand All @@ -12,6 +12,7 @@ Note that this version is not considered production-ready, since it has only bee

* #1: Fixed conversion from pure-time type to Tableau-compatible timestamp.
* #7: Exclude calcs_data test.
* #11: Fixed a few functions and enabled tests for them.

## Documentation

Expand Down
34 changes: 23 additions & 11 deletions src/exasol_odbc/dialect.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<argument type='real' />
</function>
<function group='numeric' name='DIV' return-type='int'>
<formula>CASE WHEN %2 = 0 THEN NULL ELSE ( %1 / %2 ) END</formula>
<formula>CASE WHEN %2 = 0 THEN NULL ELSE DIV(%1,%2) END</formula>
<argument type='int' />
<argument type='int' />
</function>
Expand Down Expand Up @@ -230,23 +230,23 @@
<argument type='str' />
</function>
<function group='string' name='MID' return-type='str'>
<formula>&#10;(CASE WHEN (%2 IS NULL) OR %2 &lt; 1 THEN NULL&#10; ELSE {fn SUBSTRING(%1,{fn FLOOR(%2)},LENGTH(%1) - ({fn FLOOR(%2)}) + 1)} END)</formula>
<formula>MID(%1, CASE WHEN %2 = NULL THEN NULL WHEN %2 &lt; 0 THEN CEILING(%2) ELSE FLOOR(%2) END)</formula>
<argument type='str' />
<argument type='real' />
</function>
<function group='string' name='MID' return-type='str'>
<formula>&#10;(CASE WHEN (%2 IS NULL) OR %2 &lt; 1 THEN NULL&#10; ELSE {fn SUBSTRING(%1,%2,LENGTH(%1) - (%2) + 1)} END)</formula>
<formula>MID(%1, CASE WHEN %2 = NULL THEN NULL WHEN %2 &lt; 0 THEN CEILING(%2) ELSE FLOOR(%2) END)</formula>
<argument type='str' />
<argument type='int' />
</function>
<function group='string' name='MID' return-type='str'>
<formula>&#10;(CASE WHEN (%2 IS NULL) OR (%3 IS NULL) THEN NULL&#10; WHEN %3 &lt; 1 THEN &apos;&apos;&#10; WHEN %2 &lt; 1 THEN {fn SUBSTRING(%1,1,{fn FLOOR(%3)})}&#10; ELSE {fn SUBSTRING(%1,{fn FLOOR(%2)},{fn FLOOR(%3)})} END)</formula>
<formula>MID(%1, CASE WHEN %2 = NULL THEN NULL WHEN %2 &lt; 0 THEN CEILING(%2) ELSE FLOOR(%2) END, FLOOR(%3))</formula>
<argument type='str' />
<argument type='real' />
<argument type='real' />
</function>
<function group='string' name='MID' return-type='str'>
<formula>&#10;(CASE WHEN (%2 IS NULL) OR (%3 IS NULL) THEN NULL&#10; WHEN %3 &lt; 1 THEN &apos;&apos;&#10; WHEN %2 &lt; 1 THEN {fn SUBSTRING(%1,1,%3)}&#10; ELSE {fn SUBSTRING(%1,%2,%3)} END)</formula>
<formula>MID(%1, CASE WHEN %2 = NULL THEN NULL WHEN %2 &lt; 0 THEN CEILING(%2) ELSE FLOOR(%2) END, FLOOR(%3))</formula>
<argument type='str' />
<argument type='int' />
<argument type='int' />
Expand Down Expand Up @@ -289,6 +289,14 @@
<formula>UPPER(%1)</formula>
<argument type='str' />
</function>
<function group='string' name='SPACE' return-type='str'>
<formula>CASE WHEN %1 &lt; 1 THEN NULL WHEN %1 = 0 THEN &apos;&apos; ELSE REPEAT(&apos; &apos;,%1) END</formula>
AnastasiiaSergienko marked this conversation as resolved.
Show resolved Hide resolved
<argument type='int' />
</function>
<function group='string' name='SPACE' return-type='str'>
<formula>CASE WHEN %1 &lt; 1 THEN NULL WHEN %1 = 0 THEN &apos;&apos; ELSE REPEAT(&apos; &apos;,%1) END</formula>
<argument type='real' />
</function>
<function group='date' name='DAY' return-type='int'>
<formula>EXTRACT(DAY FROM %1)</formula>
<argument type='datetime' />
Expand Down Expand Up @@ -351,6 +359,10 @@
<formula>EXTRACT(YEAR FROM %1)</formula>
<argument type='datetime' />
</function>
<function group='date' name='ISDATE' return-type='bool'>
<formula>IS_DATE(%1)</formula>
<argument type='str' />
</function>
<function group='cast' name='DATE' return-type='date'>
<formula>(CAST(&apos;1900-01-01&apos; AS DATE) + CAST(%1 AS INTEGER))</formula>
<argument type='real' />
Expand All @@ -360,7 +372,7 @@
<argument type='int' />
</function>
<function group='cast' name='DATE' return-type='date'>
<formula>TRUNC(CAST(%1 AS DATE))</formula>
<formula>TRUNC(TO_DATE(%1))</formula>
<argument type='str' />
</function>
<function group='cast' name='DATE' return-type='date'>
Expand Down Expand Up @@ -432,7 +444,7 @@
<argument type='str' />
</function>
<function group='cast' name='STR' return-type='str'>
<formula>TO_CHAR(%1, &apos;Mon DD YYYY HH24:MI:SS&apos;)</formula>
<formula>TO_CHAR(%1)</formula>
AnastasiiaSergienko marked this conversation as resolved.
Show resolved Hide resolved
<argument type='datetime' />
</function>
<function group='logical' name='IFNULL' return-type='bool'>
Expand Down Expand Up @@ -952,16 +964,16 @@
<formula part='year'>CASE WHEN %2 IS NULL OR %3 IS NULL THEN CAST(NULL AS INTEGER) ELSE (EXTRACT(YEAR FROM %3) - EXTRACT(YEAR FROM %2)) END</formula>
<formula part='quarter'>FLOOR(MONTHS_BETWEEN(TRUNC( CAST(%3 AS DATE), &apos;Q&apos; ), TRUNC( CAST(%2 AS DATE), &apos;Q&apos; )) / 3)</formula>
<formula part='month'>FLOOR(MONTHS_BETWEEN(TRUNC( CAST(%3 AS DATE), &apos;MONTH&apos; ), TRUNC( CAST(TO_DATE(%2, &apos;YYYY-MM-DD&apos;) AS DATE), &apos;MONTH&apos; )))</formula>
<formula part='week'>ABS(FLOOR((DAYS_BETWEEN(%3, &apos;1995-01-01&apos;) - MOD(7 + TO_NUMBER(TO_CHAR(%3, &apos;D&apos;))- 1, 7) - DAYS_BETWEEN(%2, &apos;1995-01-01&apos;) + MOD(7 + TO_NUMBER(TO_CHAR(%2,&apos;D&apos;))- 1, 7))/7))</formula>
<formula part='week'>FLOOR((DAYS_BETWEEN(%3, &apos;1995-01-01&apos;) - MOD(7 + TO_NUMBER(TO_CHAR(%3, &apos;D&apos;))- 1, 7) - DAYS_BETWEEN(%2, &apos;1995-01-01&apos;) + MOD(7 + TO_NUMBER(TO_CHAR(%2,&apos;D&apos;))- 1, 7))/7)</formula>
chiaradiamarcelo marked this conversation as resolved.
Show resolved Hide resolved
<formula part='hour'>HOURS_BETWEEN(%3, %2)</formula>
<formula part='minute'>MINUTES_BETWEEN(%3, %2)</formula>
<formula part='second'>SECONDS_BETWEEN(%3, %2)</formula>
<formula part='second'>FLOOR(SECONDS_BETWEEN(%3, %2))</formula>
<argument type='localstr' />
<argument type='datetime' />
<argument type='datetime' />
</date-function>
<date-function name='DATEDIFF' return-type='int'>
<formula part='week'>ABS(FLOOR((DAYS_BETWEEN(%3, &apos;1995-01-01&apos;) - MOD(7 + TO_NUMBER(TO_CHAR(%3,&apos;D&apos;))- %4, 7) - DAYS_BETWEEN(%2, &apos;1995-01-01&apos;) + MOD(7 + TO_NUMBER(TO_CHAR(%2,&apos;D&apos;))- %4, 7))/7))</formula>
<formula part='week'>FLOOR((DAYS_BETWEEN(%3, &apos;1995-01-01&apos;) - MOD(7 + TO_NUMBER(TO_CHAR(%3,&apos;D&apos;))- %4, 7) - DAYS_BETWEEN(%2, &apos;1995-01-01&apos;) + MOD(7 + TO_NUMBER(TO_CHAR(%2,&apos;D&apos;))- %4, 7))/7)</formula>
AnastasiiaSergienko marked this conversation as resolved.
Show resolved Hide resolved
<argument type='localstr' />
<argument type='datetime' />
<argument type='datetime' />
Expand All @@ -984,7 +996,7 @@
<argument type='localstr' />
</date-function>
<date-function name='DATEPART' return-type='int'>
<formula>EXTRACT(%1 FROM %2)</formula>
<formula>CAST(EXTRACT(%1 FROM %2) AS DECIMAL(36,0))</formula>
<formula part='quarter'>CAST( FLOOR( TRUNC((EXTRACT(MONTH FROM %2) - 1) / 3 + 1 )) AS INTEGER)</formula>
<formula part='dayofyear'>TO_NUMBER(TO_CHAR(%2,&apos;DDD&apos;))</formula>
<formula part='weekday'>TO_NUMBER(TO_CHAR(%2,&apos;D&apos;))</formula>
Expand Down
21 changes: 7 additions & 14 deletions tdvt/config/exasol_odbc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,10 @@ LogicalQueryFormat = TESTV1
CommandLineOverride = -DConnectPluginsPath=..\src

[StandardTests]
#cast.str.date: incorrect results
#date.cast: incorrect results
#date.datediff.second: trailing 3 zeros
#date.datediff.sow.second: trailing 3 zeros
#date.datepart.second: trailing 3 zeros
#date.datepart.sow.second: trailing 3 zeros
#math.div: incorrect results
#string.split: not supported?
#string.space: incorrect results
#date.datediff.week: absolute value instead of expected
#date.datediff.sow.week: absolute value instead of expected
#string.mid: incorrect results
#string.isdate: not supported?
#calcs_data: not supported
ExpressionExclusions_Standard = cast.str.date,date.cast,date.datediff.second,date.datediff.sow.second,date.datepart.second,date.datepart.sow.second,math.div,string.space,string.split,date.datediff.week,date.datediff.sow.week,string.mid,string.isdate, calcs_data
#string.split: this function is not supported in Exasol
#string.space.int.constant and string.space.int.var: incorrect results, can't find the problem with thespace. Generated query works fine in the SQL client
ExpressionExclusions_Standard = string.split,calcs_data,string.space.int.constant,string.space.int.var

[LODTests]

Expand All @@ -36,3 +25,7 @@ TDS = cast_calcs.exasol_odbc.tds
PasswordFile = exasol_odbc_badpassword.password
TestPath = exprtests/pretest/
ExpectedMessage = authentication failed

[ConnectionTests]
CastCalcsTestEnabled = True
StaplesTestEnabled = True