Skip to content

Commit

Permalink
feat(flink): implement support for UUID literals
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman committed Aug 22, 2023
1 parent 8b16bde commit 518a3c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ibis/backends/flink/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
import math
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import TYPE_CHECKING

import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis.common.temporal import IntervalUnit
from ibis.util import convert_unit

if TYPE_CHECKING:
import ibis.expr.operations as ops

# For details on what precisions Flink SQL interval types support, see
# https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/table/types/#interval-year-to-month
# https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/table/types/#interval-day-to-second
Expand Down Expand Up @@ -284,4 +282,6 @@ def translate_literal(op: ops.Literal) -> str:
return f"TIME '{value}'"
elif dtype.is_interval():
return f"INTERVAL {_translate_interval(value, dtype)}"
elif dtype.is_uuid():
return translate_literal(ops.Literal(str(value), dtype=dt.str))
raise NotImplementedError(f"No translation rule for {dtype}")
2 changes: 2 additions & 0 deletions ibis/backends/tests/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"snowflake": "VARCHAR",
"trino": "varchar(32)" if SQLALCHEMY2 else "uuid",
"postgres": "uuid",
"flink": "CHAR(36) NOT NULL",
}

UUID_EXPECTED_VALUES = {
Expand All @@ -37,6 +38,7 @@
"mssql": TEST_UUID,
"dask": TEST_UUID,
"oracle": TEST_UUID,
"flink": TEST_UUID,
}

pytestmark = pytest.mark.notimpl(
Expand Down

0 comments on commit 518a3c9

Please sign in to comment.