Skip to content

Fixed handling of DateTime64 columns#90

Open
MrDoe wants to merge 28 commits into
Octonica:masterfrom
MrDoe:master
Open

Fixed handling of DateTime64 columns#90
MrDoe wants to merge 28 commits into
Octonica:masterfrom
MrDoe:master

Conversation

@MrDoe
Copy link
Copy Markdown
Contributor

@MrDoe MrDoe commented Mar 13, 2024

I fixed two major problems concerning the handling of DateTime64 data:

  • Unix timezones from the server, e.g. 'Europe/Berlin' couldn't be converted to Windows timezones like 'W. European Standard Time' when using a Windows client
  • Due to wrong DST calculations, the time of DateTimeOffset columns before 01-01-1970 was sometimes shifted and the displayed timezone offset was wrong, too. I noticed this after reading a table containing birthdates. Even the month or year was sometimes wrong, if someone was born at the end of a month or year.
    I couldn't get this to work correctly with standard .NET functions, so I integrated the NodaTime library for this.
    The problem is, that the Windows timezone database does not have historical data, only data enough to cover more recent times. So the timezones with DST have no dynamic adjustment rules before 1970-01-01. NodaTime however does include the necessary historic data to do the DST calculations right.
    See NodaTime Blog for a more deeper explanation.

Note:

  • I removed support for netcoreapp3.1 and net6.0, because I didn't want to install these legacy frameworks on my PC. Don't merge the respective line in the .csproj file, if you still want to support them.
  • The tests for DateTime and DateTime64 are still failing, because they need to be rewritten for NodaTime data types.

@victor-sushko victor-sushko self-assigned this Mar 14, 2024
MrDoe and others added 25 commits March 22, 2024 11:40
- Subproject-Commits in ClickSphere_API und ClickHouseClient geändert
- Aktualisiere Paketreferenzen in ClickSphere_API.csproj:
  - `Microsoft.AspNetCore.OpenApi` auf `9.0.1`
  - `Microsoft.AspNetCore.Authentication.JwtBearer` auf `9.0.1`
  - `System.Configuration.ConfigurationManager` auf `9.0.1`
  - `TimeZoneConverter` auf `7.0.0`
  - `Swashbuckle.AspNetCore.Swagger` auf `7.2.0`
  - `Swashbuckle.AspNetCore.SwaggerGen` auf `7.2.0`
  - `Swashbuckle.AspNetCore.SwaggerUI` auf `7.2.0`
  - `OllamaSharp` auf `5.0.6`
- Aktualisiere `NodaTime` in Octonica.ClickHouseClient.csproj auf `3.2.1`
Copilot AI review requested due to automatic review settings January 13, 2026 08:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors code style across multiple files in the ClickHouse client library, converting traditional if-else statements and multi-line expressions to more concise expression-bodied members, ternary operators, and switch expressions. The changes also include minor improvements such as target-typed new expressions, collection expressions, range operators, and updated import ordering to follow standard conventions (System namespaces before project namespaces).

Changes:

  • Converted traditional control flow statements to expression-bodied members and ternary operators
  • Replaced multi-line if-else chains with switch expressions and pattern matching
  • Applied modern C# syntax features (target-typed new, collection expressions, range operators)
  • Reordered using statements to follow conventions (System namespaces first)

Reviewed changes

Copilot reviewed 162 out of 186 changed files in this pull request and generated no comments.

Show a summary per file
File Description
FunctionHelper.cs Expanded lambda expressions to use explicit return statements
ConstantReadOnlyList.cs Converted methods to use ternary operators and added braces
CommonUtils.cs Added braces to single-line if statements and simplified assignments
CertificateHelper.cs Updated to use collection expressions and target-typed new
CertificateHelper.Net5.0.cs Added internal access modifier
VariantTypeInfo.cs Converted if-else chains to ternary operators throughout
VariantTableColumn.cs Simplified GetValue method with ternary operator
UuidTypeInfo.cs Converted methods to use ternary operators and updated imports
UInt8TypeInfo.cs Simplified column writer creation with ternary operators
Multiple TableColumn files Converted TryReinterpret methods to use ternary operators
Multiple TypeInfo files Converted parameter writers to use ternary operators and updated imports
NullableTypeInfo.cs Extensive conversion to ternary operators and switch expressions
LowCardinalityTypeInfo.cs Converted methods to ternary operators and switch expressions
IClickHouseColumnTypeInfo.cs Converted methods to switch expressions
IClickHouseColumnTypeDescriptor.cs Changed TimeZone property type from TimeZoneInfo to DateTimeZone

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants