Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

rewrite DP queries for SQL Server #7

Open
mokarian opened this issue Jan 30, 2019 · 0 comments
Open

rewrite DP queries for SQL Server #7

mokarian opened this issue Jan 30, 2019 · 0 comments

Comments

@mokarian
Copy link

The query rewriter on the example generated queries that are compatible with Vertica Database.
I know you mentioned in your paper and this repo that the query generated by this method (elastic sensitivity and FLEX) can be executed against any SQL database.
For example the Generated query in vertica is:

SELECT COUNT(*) + 20.0 * (CASE WHEN RAND() - 0.5 < 0 THEN -1.0 ELSE 1.0 END * LN(1 - 2 * ABS(RAND() - 0.5)))
  FROM (SELECT timezoneOffset
  FROM TSMC2014) t
  WHERE timezoneOffset = '540'

the SQL Server version of this would be (Difference in LN vs. LOG):

SELECT COUNT(*) + 20.0 * (CASE WHEN RAND() - 0.5 < 0 THEN -1.0 ELSE 1.0 END * LOG(1 - 2 * ABS(RAND() - 0.5)))
  FROM (SELECT timezoneOffset
  FROM TSMC2014) t
  WHERE timezoneOffset = '540'

similar for MOD(n,m) in vertical which is equivalent to n % m in SQL Server and perhaps there are more functions that are not compatible.

How can we get this working with SQL Server? In other words what is the most optimized way to make this code compatible with other SQL Databases (e.g. SQL Server)
Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant