Skip to content

Commit

Permalink
feat(flink): support translating typed null values
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman authored and cpcloud committed Sep 25, 2023
1 parent 43ff6e3 commit 83beb7e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ibis/backends/flink/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def _translate_interval(value, dtype):


_to_pyflink_types = {
dt.String: DataTypes.STRING(),
dt.Boolean: DataTypes.BOOLEAN(),
dt.Binary: DataTypes.BYTES(),
dt.Int8: DataTypes.TINYINT(),
dt.Int16: DataTypes.SMALLINT(),
dt.Int32: DataTypes.INT(),
Expand All @@ -258,6 +261,9 @@ def _translate_interval(value, dtype):
dt.Float16: DataTypes.FLOAT(),
dt.Float32: DataTypes.FLOAT(),
dt.Float64: DataTypes.DOUBLE(),
dt.Date: DataTypes.DATE(),
dt.Time: DataTypes.TIME(),
dt.Timestamp: DataTypes.TIMESTAMP(),
}


Expand All @@ -266,7 +272,9 @@ def translate_literal(op: ops.Literal) -> str:
dtype = op.dtype

if value is None:
return "NULL"
if dtype.is_null():
return "NULL"
return f"CAST(NULL AS {_to_pyflink_types[type(dtype)]!s})"

if dtype.is_boolean():
# TODO(chloeh13q): Flink supports a third boolean called "UNKNOWN"
Expand Down

1 comment on commit 83beb7e

@ibis-squawk-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 3.

Benchmark suite Current: 83beb7e Previous: b37804a Ratio
ibis/tests/benchmarks/test_benchmarks.py::test_compile_with_drops[bigquery] 35.06410744817264 iter/sec (stddev: 0.0003257334735220933) 130.02477424437095 iter/sec (stddev: 0.000247510166318326) 3.71
ibis/tests/benchmarks/test_benchmarks.py::test_compile[small-bigquery] 1362.666139215693 iter/sec (stddev: 0.00007982679893478541) 10602.847663506958 iter/sec (stddev: 0.00005834248372791223) 7.78
ibis/tests/benchmarks/test_benchmarks.py::test_compile[large-bigquery] 25.932246901509586 iter/sec (stddev: 0.0006507548913853837) 146.4406797920701 iter/sec (stddev: 0.00006932716190392247) 5.65
ibis/tests/benchmarks/test_benchmarks.py::test_compile[medium-bigquery] 60.966919092045245 iter/sec (stddev: 0.0010637681075288566) 603.5295570002766 iter/sec (stddev: 0.000035398257191080955) 9.90

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.