pingcap / pingcap/tiflash

FunctionDateFormat should accept non-constant format string argument

Open
#1,038 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/compute component/expression severity/moderate type/bug
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

FunctionFromUnixTime use FunctionDateFormat to format DateTime result.

In MySQL and TiDB, FROM_UNIXTIME can take a column as format string(the second argument), while FunctionDateFormat cannot take a non-constant column as format string. Therefore, if you are trying to push a function like FROM_UNIXTIME(1, col) down to TiFlash, there will be an error Argument at index 1 for function dateFormat must be constant.

To be compatible with TiDB, we should fix it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how FunctionFromUnixTime calls FunctionDateFormat and where the constant-format restriction produces the reported error. Verify behavior for FROM_UNIXTIME(1, col) against TiDB; done means a non-constant column format is accepted without the dateFormat constant-argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.