Skip to content

Commit

Permalink
Merge pull request #355 from MaximMoinat/fix-patterns
Browse files Browse the repository at this point in the history
Fixes replacement patters for spark and sqlite
  • Loading branch information
schuemie authored Jan 8, 2024
2 parents bd72fb4 + e2bd49e commit be3f6e3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions inst/csv/replacementPatterns.csv
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,13 @@ sqlite,"DATEADD(dd,@days,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch
sqlite,"DATEADD(day,@days,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@days)||' days')) AS REAL)"
sqlite,"DATEADD(m,@months,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@months)||' months')) AS REAL)"
sqlite,"DATEADD(mm,@months,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@months)||' months')) AS REAL)"
sqlite,"DATEADD(months,@months,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@months)||' months')) AS REAL)"
sqlite,"DATEADD(month,@months,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@months)||' months')) AS REAL)"
sqlite,"DATEADD(yy,@years,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@years)||' years')) AS REAL)"
sqlite,"DATEADD(yyyy,@years,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@years)||' years')) AS REAL)"
sqlite,"DATEADD(year,@years,@date)","CAST(STRFTIME('%s', DATETIME(@date, 'unixepoch', (@years)||' years')) AS REAL)"
sqlite,"DATEDIFF(d,@start,@end)","JULIANDAY(@end, 'unixepoch') - JULIANDAY(@start, 'unixepoch')"
sqlite,"DATEDIFF(dd,@start,@end)","JULIANDAY(@end, 'unixepoch') - JULIANDAY(@start, 'unixepoch')"
sqlite,"DATEDIFF(day,@start,@end)","JULIANDAY(@end, 'unixepoch') - JULIANDAY(@start, 'unixepoch')"
sqlite,"DATEDIFF(d,@start,@end)","(JULIANDAY(@end, 'unixepoch') - JULIANDAY(@start, 'unixepoch'))"
sqlite,"DATEDIFF(dd,@start,@end)","(JULIANDAY(@end, 'unixepoch') - JULIANDAY(@start, 'unixepoch'))"
sqlite,"DATEDIFF(day,@start,@end)","(JULIANDAY(@end, 'unixepoch') - JULIANDAY(@start, 'unixepoch'))"
sqlite,"DATEDIFF(year,@start, @end)","(STRFTIME('%Y', @end, 'unixepoch') - STRFTIME('%Y', @start, 'unixepoch'))"
sqlite,"DATEDIFF(yyyy,@start, @end)","(STRFTIME('%Y', @end, 'unixepoch') - STRFTIME('%Y', @start, 'unixepoch'))"
sqlite,"DATEDIFF(yy,@start, @end)","(STRFTIME('%Y', @end, 'unixepoch') - STRFTIME('%Y', @start, 'unixepoch'))"
Expand Down Expand Up @@ -1089,10 +1089,6 @@ spark,"DATEDIFF(dd,@start, @end)","datediff(@end,@start)"
spark,"DATEDIFF(day,@start, @end)","datediff(@end,@start)"
spark,"CONVERT(VARCHAR,@date,112)","@date"
spark,GETDATE(),CURRENT_DATE
spark,"+ LEFT(@str,@chars)","SUBSTR(@str,@chars)"
spark,"LEFT(@str,@chars)","SUBSTR(@str,@chars)"
spark,"+ RIGHT(@str,@chars)","|| SUBSTR(@str,-@chars)"
spark,"RIGHT(@str,@chars)","SUBSTR(@str,-@chars)"
spark,CAST(@a AS varchar(@b)) +,"SUBSTRING(CAST(@a AS string), 0, @b) ||"
spark,+ CAST(@a AS varchar(@b)),"|| SUBSTRING(CAST(@a AS string), 0, @b)"
spark,CAST(@a AS varchar) +,CAST(@a AS string) ||
Expand Down

0 comments on commit be3f6e3

Please sign in to comment.