Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-28526

Fail to lateral join with UDTF from Table with timstamp column

    XMLWordPrintableJSON

Details

    Description

      The bug can be reproduced with the following test

          def test_flink(self):
              env = StreamExecutionEnvironment.get_execution_environment()
              t_env = StreamTableEnvironment.create(env)
              table = t_env.from_descriptor(
                  TableDescriptor.for_connector("filesystem")
                  .schema(
                      Schema.new_builder()
                      .column("name", DataTypes.STRING())
                      .column("cost", DataTypes.INT())
                      .column("distance", DataTypes.INT())
                      .column("time", DataTypes.TIMESTAMP(3))
                      .watermark("time", "`time` - INTERVAL '60' SECOND")
                      .build()
                  )
                  .format("csv")
                  .option("path", "./input.csv")
                  .build()
              )
      
              @udtf(result_types=DataTypes.INT())
              def table_func(row: Row):
                  return row.cost + row.distance
      
              table = table.join_lateral(table_func.alias("cost_times_distance"))
      
              table.execute().print()
      

      It causes the following exception

      E       pyflink.util.exceptions.TableException: org.apache.flink.table.api.TableException: Unsupported Python SqlFunction CAST.
      E       	at org.apache.flink.table.planner.plan.nodes.exec.utils.CommonPythonUtil.createPythonFunctionInfo(CommonPythonUtil.java:146)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.utils.CommonPythonUtil.createPythonFunctionInfo(CommonPythonUtil.java:429)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.utils.CommonPythonUtil.createPythonFunctionInfo(CommonPythonUtil.java:135)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecPythonCorrelate.extractPythonTableFunctionInfo(CommonExecPythonCorrelate.java:133)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecPythonCorrelate.createPythonOneInputTransformation(CommonExecPythonCorrelate.java:106)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecPythonCorrelate.translateToPlanInternal(CommonExecPythonCorrelate.java:95)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase.translateToPlan(ExecNodeBase.java:148)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.ExecEdge.translateToPlan(ExecEdge.java:249)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecSink.translateToPlanInternal(StreamExecSink.java:136)
      E       	at org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase.translateToPlan(ExecNodeBase.java:148)
      E       	at org.apache.flink.table.planner.delegation.StreamPlanner.$anonfun$translateToPlan$1(StreamPlanner.scala:79)
      E       	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
      E       	at scala.collection.Iterator.foreach(Iterator.scala:937)
      E       	at scala.collection.Iterator.foreach$(Iterator.scala:937)
      E       	at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
      E       	at scala.collection.IterableLike.foreach(IterableLike.scala:70)
      E       	at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
      E       	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
      E       	at scala.collection.TraversableLike.map(TraversableLike.scala:233)
      E       	at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
      E       	at scala.collection.AbstractTraversable.map(Traversable.scala:104)
      E       	at org.apache.flink.table.planner.delegation.StreamPlanner.translateToPlan(StreamPlanner.scala:78)
      E       	at org.apache.flink.table.planner.delegation.PlannerBase.translate(PlannerBase.scala:181)
      E       	at org.apache.flink.table.api.internal.TableEnvironmentImpl.translate(TableEnvironmentImpl.java:1656)
      E       	at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeQueryOperation(TableEnvironmentImpl.java:828)
      E       	at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:1317)
      E       	at org.apache.flink.table.api.internal.TableImpl.execute(TableImpl.java:605)
      E       	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      E       	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      E       	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      E       	at java.lang.reflect.Method.invoke(Method.java:498)
      E       	at org.apache.flink.api.python.shaded.py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
      E       	at org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
      E       	at org.apache.flink.api.python.shaded.py4j.Gateway.invoke(Gateway.java:282)
      E       	at org.apache.flink.api.python.shaded.py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
      E       	at org.apache.flink.api.python.shaded.py4j.commands.CallCommand.execute(CallCommand.java:79)
      E       	at org.apache.flink.api.python.shaded.py4j.GatewayConnection.run(GatewayConnection.java:238)
      E       	at java.lang.Thread.run(Thread.java:748)
      

      Attachments

        Issue Links

          Activity

            People

              dianfu Dian Fu
              sxnan Xuannan Su
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: