Skip to content

Timeplus enterprise support ClickHouse functions and datatypes. #326

Open
@LiShuai-tp

Description

@LiShuai-tp

It is compatible with Timeplus Enterprise 2.8 and later. It is also backported to 2.7.
Connect to HTTP port 8123, which is compatible with clickhouse functions name and datatype name by default.

(base) ╭─timeplus@timeplus-OptiPlex-7000 ~
╰─$ echo "SELECT groupConcat(':')(number+1) FROM numbers(10) settings is_clickhouse_compatible = 1;" | curl http://localhost:3218 --data-binary @-

Code: 46. DB::Exception: Unknown function groupConcat: Or unknown aggregate function groupConcat. Maybe you meant: ['group_concat']. (UNKNOWN_FUNCTION) (version 2.9.9-rc.10)
(base) ╭─timeplus@timeplus-OptiPlex-7000 ~
╰─$ echo "SELECT groupConcat(':')(number+1) FROM numbers(10) settings is_clickhouse_compatible = 1;" | curl http://localhost:8123 --data-binary @-
1:2:3:4:5:6:7:8:9:10

If you connect to the server via TCP, which is not supported by default. You can first execute set is_clickhouse_compatible = 1;
example:

timeplusd :) SELECT toDecimal('3.1415926',2);
Received exception from server (version 2.9.9):
Code: 46. DB::Exception: Received from localhost:8463. DB::Exception: Unknown function toDecimal. Maybe you meant: ['to_decimal','to_decimal64']. (UNKNOWN_FUNCTION)

timeplusd :) set is_clickhouse_compatible = 1;
Ok.

timeplusd :) SELECT toDecimal('3.1415926',2);
┌─to_decimal('3.1415926', 2)─┐
│                       3.14                  │
└──────────────────┘

or add 'settings is_clickhouse_compatible = 1' after sql.This will make it compatible with CH functions and data types.
example:

timeplusd :) SELECT toTime(toDateTime64('1970-12-10 01:20:30.3000',3));

Received exception from server (version 2.9.9):
Code: 46. DB::Exception: Received from localhost:8463. DB::Exception: Unknown function toTime. Maybe you meant: ['to_time','uptime']. (UNKNOWN_FUNCTION)

timeplusd :) SELECT toTime(toDateTime64('1970-12-10 01:20:30.3000',3)) settings is_clickhouse_compatible = 1;

┌─__to_time(to_datetime64('1970-12-10 01:20:30.3000', 3))─┐
│                                     1970-01-02 01:20:30                           │
└──────────────────────────────────────┘

However, functions newly ported from CH after 2.8 may not be supported because they may not be added to the function map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions