Skip to content

Commit 1346e10

Browse files
committed
address review
1 parent 1441461 commit 1346e10

File tree

6 files changed

+11
-20
lines changed

6 files changed

+11
-20
lines changed

docs/en/sql-reference/data-types/time.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ sidebar_label: Time
66

77
# Time
88

9-
The `Time` data type is used to store a time-of-day value independent of any calendar date. It is ideal for representing daily schedules, event times, or any situation where only the time component (hours, minutes, seconds, and optionally fractions of a second) is important.
9+
The `Time` data type is used to store a time value independent of any calendar date. It is ideal for representing daily schedules, event times, or any situation where only the time component (hours, minutes, seconds) is important.
1010

1111
Syntax:
1212

1313
``` sql
14-
Time([timezone])
14+
Time()
1515
```
1616

1717
Supported range of values: \[-999:59:59, 999:59:59\].

docs/en/sql-reference/data-types/time64.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ sidebar_label: Time64
66

77
# Time64
88

9-
The Time64 data type allows storing time-of-day values with sub-second precision. Unlike DateTime64, it does not include a calendar date, but only represents time within a single day. The precision defines the resolution of stored values in fractional seconds.
9+
The Time64 data type allows storing time values with sub-second precision. Unlike DateTime64, it does not include a calendar date, but only represents time. The precision defines the resolution of stored values in fractional seconds.
1010

1111
Tick size (precision): 10<sup>-precision</sup> seconds. Valid range: [ 0 : 9 ].
1212
Typically, are used - 3 (milliseconds), 6 (microseconds), 9 (nanoseconds).
1313

1414
**Syntax:**
1515

1616
``` sql
17-
Time64(precision, [timezone])
17+
Time64(precision)
1818
```
1919

2020
Internally, Time64 stores data as an Int64 number of ticks since the start of the day (000:00:00.000000000). The tick resolution is determined by the precision parameter. Optionally, a time zone can be specified at the column level, which affects how time values are interpreted and displayed in text format.
2121

22-
Unlike DateTime64, Time64 does not store a date component, meaning that it only represents a time within a 24-hour cycle. See details in [Time](../../sql-reference/data-types/time.md).
22+
Unlike DateTime64, Time64 does not store a date component, meaning that it only represents time. See details in [Time](../../sql-reference/data-types/time.md).
2323

2424
Supported range of values: \[000:00:00, 999:59:59.99999999\]
2525

src/Common/DateLUTImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ class DateLUTImpl
13131313
if (unlikely(t < 0))
13141314
{
13151315
is_negative = true;
1316+
t = -t;
13161317
}
13171318
res.second = t % 60;
13181319
res.minute = t / 60 % 60;

src/Common/LocalTime.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <cstring>
55
#include <stdexcept>
66
#include <Common/DateLUT.h>
7+
#include <Common/DateLUTImpl.h>
78
#include <Common/LocalDate.h>
89

910
/**
@@ -23,9 +24,6 @@ class LocalTime
2324
unsigned char m_minute; /// Minutes (0-59)
2425
unsigned char m_second; /// Seconds (0-59)
2526

26-
/// Padding to fill the structure to 8 bytes and ensure safe invocation of `memcmp`.
27-
unsigned char pad[4] = {0};
28-
2927
/**
3028
* Initializes time from `time_t` and time zone.
3129
*
@@ -44,9 +42,6 @@ class LocalTime
4442
m_hour = components.hour;
4543
m_minute = components.minute;
4644
m_second = components.second;
47-
48-
// Initialize padding
49-
std::memset(pad, 0, sizeof(pad));
5045
}
5146

5247
/**
@@ -133,9 +128,6 @@ class LocalTime
133128
}
134129
else
135130
throw std::runtime_error("Cannot parse LocalTime: " + std::string(s, length));
136-
137-
// Initialize padding
138-
std::memset(pad, 0, sizeof(pad));
139131
}
140132

141133
// Helper function to compute the total seconds represented by the LocalTime.
@@ -170,9 +162,7 @@ class LocalTime
170162
*/
171163
LocalTime(bool is_negative_, uint64_t hour_, unsigned char minute_, unsigned char second_) /// NOLINT
172164
: is_negative(is_negative_), m_hour(hour_), m_minute(minute_), m_second(second_)
173-
{
174-
std::memset(pad, 0, sizeof(pad));
175-
}
165+
{}
176166

177167
/**
178168
* Constructor from a string.
@@ -191,9 +181,7 @@ class LocalTime
191181
* Default constructor initializes time to 0000:00:00.
192182
*/
193183
LocalTime() : m_hour(0), m_minute(0), m_second(0)
194-
{
195-
std::memset(pad, 0, sizeof(pad));
196-
}
184+
{}
197185

198186
/**
199187
* Constructor from data pointer and length.

src/Core/SortCursor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ class SortQueueVariants
797797
SortingQueueImpl<SpecializedSingleNullableColumnSortCursor<ColumnDecimal<Decimal128>>, strategy>,
798798
SortingQueueImpl<SpecializedSingleNullableColumnSortCursor<ColumnDecimal<Decimal256>>, strategy>,
799799
SortingQueueImpl<SpecializedSingleNullableColumnSortCursor<ColumnDecimal<DateTime64>>, strategy>,
800+
SortingQueueImpl<SpecializedSingleNullableColumnSortCursor<ColumnDecimal<Time64>>, strategy>,
800801

801802
SortingQueueImpl<SpecializedSingleNullableColumnSortCursor<ColumnVector<UUID>>, strategy>,
802803
SortingQueueImpl<SpecializedSingleNullableColumnSortCursor<ColumnVector<IPv4>>, strategy>,

src/IO/ReadHelpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <Common/StackTrace.h>
1313
#include <Common/formatIPv6.h>
1414
#include <Common/DateLUT.h>
15+
#include <Common/DateLUTImpl.h>
1516
#include <Common/LocalDate.h>
1617
#include <Common/LocalDateTime.h>
1718
#include <Common/transformEndianness.h>

0 commit comments

Comments
 (0)