ClickHouse / ClickHouse/ClickHouse

Lost Const column type for result replicate function

Open
#103,015 0 comments 0 reactions 0 assignees View on GitHub
comp-regular-function external potential bug
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

_No response_

### Describe what's wrong

When using two constant arguments for function **replicate**, result does not have Const type for column.
But function arrayWithConstant with same arguments have Const type.
https://fiddle.clickhouse.com/465fcc03-c02b-432a-a5d6-3ddf7a578fec

### Does it reproduce on the most recent release?

Yes

### How to reproduce

```sql
SELECT
[1, 2, 3] AS numbers,
'ClickHouse' AS placeHolder,
replicate(placeHolder, numbers) AS strings1,
arrayWithConstant(length(numbers), placeHolder) AS strings2,
toColumnTypeName(strings1) AS typeName_strings1,
toColumnTypeName(strings2) AS typeName_strings2
```

```
numbers: [1,2,3]
placeHolder: ClickHouse
strings1: ['ClickHouse','ClickHouse','ClickHouse']
strings2: ['ClickHouse','ClickHouse','ClickHouse']
typeName_strings1: Array(String)
typeName_strings2: Const(Array(String))
```

### Expected behavior

_No response_

### Error message and/or stacktrace

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.