Custom date logic to extend effective range of date type #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Native date types in Clickhouse don't work for dates before 1900. This is fine for most use cases, but occasionally one may be interested in linking data that deals with dates before then - for instance historical census data.
This creates some custom logic to handle dates before then. Specifically:
days_since_epoch
that converts a string (in standard ISO-8601 format) into a signed integer representing the number of days since1970-01-01
(-ve days meaning days before this)ColumnExpression
to create a transform for parsing a date to an int of this typecll.AbsoluteDateDifferenceLevel
,cl.AbsoluteDateDifferenceAtThresholds
, andcl.DateOfBirthComparison
that all use this type under-the-hood, either with a pre-made integer column, or doing the parsing on-the-flyThis is treating dates as being in the proleptic Gregorian calendar.