Skip to content

Unexpected exception behavior with brace expansion and table function #88920

@allegrinisante

Description

@allegrinisante

Company or project name

No response

Describe the unexpected behaviour

While importing files using the file table function, ClickHouse behaves differently when importing a single file or the same file twice using brace expansion.

ClickHouse throws a parsing exception when importing a single file, but not with multiple files with brace expansion.

Which ClickHouse versions are affected?

25.8, but should also apply to previous versions.

How to reproduce


SELECT version()

Query id: 7d0ecc42-0d70-48f8-86be-6bfeec055091

Connecting to localhost:9000 as user default.

Connected to ClickHouse server version 25.8.1.

   ┌─version()───┐

1. │ 25.8.1.3085 │

   └─────────────┘

CREATE TABLE test

(

    `ts` DateTime64(9, 'UTC')

)

ORDER BY tuple();

# insert nr.1 - With a single file ClickHouse throws a parsing exception

INSERT INTO test (ts) SELECT ts

FROM file(`output.parquet`)

Received exception from server (version 25.8.1):

Code: 6. DB::Exception: Received from localhost:9000. DB::Exception: Cannot parse string '2020-01-01 14:00:00+00:00' as DateTime64(9, 'UTC'): syntax error at position 19 (parsed just '2020-01-01 14:00:00'): while converting column `ts` from type String to type DateTime64(9, 'UTC'): (in file/uri /Users/s.allegrini/Desktop/python_test/user_files/output.parquet): While executing ParquetBlockInputFormat: While executing File. (CANNOT_PARSE_TEXT)

# insert nr.2 - With brace expression ClickHouse doesn't throw the exception

INSERT INTO test (ts) SELECT ts

FROM file(`{output.parquet,output.parquet}`)

0 rows in set. Elapsed: 0.003 sec. 

# checking the data

SELECT *

FROM test

Query id: 069f2963-a680-4a47-9547-247f46443dc6

   ┌────────────────────────────ts─┐

1. │ 1970-01-01 00:00:00.000000000 │

2. │ 1970-01-01 00:00:00.000000000 │

   └───────────────────────────────┘

Expected behavior

Always throw the exception

Error message and/or stacktrace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unexpected behaviourResult is unexpected, but not entirely wrong at the same time.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions