Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.expression.Expression.cast#

Expression.cast(data_type: pyflink.table.types.DataType) → pyflink.table.expression.Expression[source]#

Returns a new value being cast to type type. A cast error throws an exception and fails the job. When performing a cast operation that may fail, like STRING to INT, one should rather use try_cast, in order to handle errors. If “table.exec.legacy-cast-behaviour” is enabled, cast behaves like try_cast.

E.g. lit(“4”).cast(DataTypes.INT()) returns 42; lit(null).cast(DataTypes.STRING()) returns NULL of type STRING; lit(“non-number”).cast(DataTypes.INT()) throws an exception and fails the job.

New in version 1.12.0.

previous

pyflink.table.expression.Expression.alias

next

pyflink.table.expression.Expression.try_cast

Show Source

Created using Sphinx 4.5.0.