Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clickhouse_client: add querying more types to tests #45

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# UUID
- name: The system.users table contain UUID value
register: result
community.clickhouse.clickhouse_client:
Expand All @@ -8,7 +9,7 @@
that:
- result.result[0] != []


# Decimal & DateTime
- name: Create table with Decimal and DateTime columns
community.clickhouse.clickhouse_client:
execute: CREATE TABLE decimal_datetime (x Decimal(12,4), y DateTime) ENGINE = Memory
Expand All @@ -27,7 +28,7 @@
that:
- result.result == [[4.01, '2019-01-01T00:00:00']]


# Map
- name: Create table with Map column
community.clickhouse.clickhouse_client:
execute: CREATE TABLE map (x Map(String, UInt64)) ENGINE = Memory
Expand All @@ -46,17 +47,69 @@
that:
- result.result[0][0]['a'] == 1


# FixedString
- name: Create table with FixedString column
community.clickhouse.clickhouse_client:
execute: CREATE TABLE fixed_string (fs FixedString(2)) ENGINE = Memory

- name: Insert FixedString
community.clickhouse.clickhouse_client:
execute: "INSERT INTO fixed_string VALUES ('a')"

- name: Select FixedString
register: result
community.clickhouse.clickhouse_client:
execute: "SELECT * FROM fixed_string"

- name: Check the ret vals
ansible.builtin.assert:
that:
- result.result[0][0] == "a"


# Enum
- name: Create table with Enum column
community.clickhouse.clickhouse_client:
execute: "CREATE TABLE t_enum (e Enum('hello' = 1, 'world' = 2)) ENGINE = Memory"

- name: Insert Enum
community.clickhouse.clickhouse_client:
execute: "INSERT INTO t_enum VALUES ('hello'), ('world')"

- name: Select Enum
register: result
community.clickhouse.clickhouse_client:
execute: "SELECT * FROM t_enum"

- name: Check the ret vals
ansible.builtin.assert:
that:
- result.result == [['hello'], ['world']]

- name: Select Enum with cast
register: result
community.clickhouse.clickhouse_client:
execute: "SELECT CAST(e, 'Int8') FROM t_enum"

- name: Check the ret vals
ansible.builtin.assert:
that:
- result.result == [[1], [2]]


# Test version dependent features
- name: Get server version
register: srv
community.clickhouse.clickhouse_info:
limit: version


- name: Test Point column
- name: Types supported since version 23.*
when: srv['version']['year'] >= 23
block:

# Point
- name: Create table with Point column
community.clickhouse.clickhouse_client:
execute: CREATE TABLE geo_point (p Point) ENGINE = Memory
Expand Down
Loading