Comments (4)
So you need f('01/13/2024') -> null (DateTime64)
because it's the incorrect date, because of your internal requirements.
from clickhouse.
For more context: parseDateTime64BestEffort
is not a great way to deal with arbitrary strings with known format, e.g.:
select parseDateTimeOrNull('01/13/2024', '%d/%m/%Y') -- null, as expected
select parseDateTime64BestEffortOrNull('01/12/2024') -- 2024-12-01, as expected
select parseDateTime64BestEffortOrNull('01/13/2024') -- 2024-01-13, welp
And toDateTime64
seems to be a bad choice, since it behaves more like a cast, not an actual parser. For example:
select toDateTime64('2024-13-01', 3) -- 1900-01-01 ?
select toDateTime64('2024-ab-cd ::::::::', 3) -- 1900-01-05 15:51:50.000 ?
from clickhouse.
There is parseDateTime64BestEffort
and parseDateTime64BestEffortUS
SELECT parseDateTime64BestEffortUSOrNull('01/13/2024')
┌─parseDateTime64BestEffortUSOrNull('01/13/2024')─┐
1. │ 2024-01-13 00:00:00.000 │
└─────────────────────────────────────────────────┘
from clickhouse.
Hi @den-crane, thanks for the response! I'm not sure we're on the same page, so let me clarify - in cases like '01/13/2024'
, functions parseDateTime64BestEffortOrNull('01/13/2024')
and parseDateTime64BestEffortUSOrNull('01/13/2024')
behave the same, as the US
only modifies the order of the formats, and uses non-US version as a fallback. We actually want the parser with US format to never execute, and return null on the us-like dates (or ideally - return null on any formats other than '%d/%m/%Y'
) .
from clickhouse.
Related Issues (20)
- Unexpected return type from equals: Grouping sets and predicate pushdown HOT 1
- OPTIMIZE TABLE: When to use it? HOT 6
- session_timezone is not reflected in X-ClickHouse-Timezone HOT 8
- What options exist for storing metadata when using S3 as a primary disk? HOT 2
- Docker container with image of clickhouse/clickhouse-server immediately exits on WSL2 with Ubuntu 24.04 HOT 3
- Add UUID to the system.columns HOT 1
- INSERT INTO from cli client loading data from large local file on fast host has socket connection problem/errors out HOT 1
- Casting a Map to an Array of Tuple
- GPU support HOT 2
- how to download clickhouse a single stable binary HOT 3
- Error with enable new analyzer: "Not found column __table1.name in block" HOT 7
- Missing past releases Documentation HOT 1
- Keep a legend inside a graph pane on dashboards
- Function initCap treats an apostrophe as a word separator HOT 1
- JSON read/import fails when a value is "-" and schema reflect datetime, not a string as expected
- Cancellable tasks in ThreadPools
- Replacing-AggregatingMergeTree? HOT 4
- `os_user` and `client_hostname` are not set in the Suggest query in clickhouse-client
- unification of is_deleted for RMT with LWD-based _row_exists HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clickhouse.