FlinkSQL Filter Error With Float Column on flink-1.12.0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FlinkSQL Filter Error With Float Column on flink-1.12.0

jy l
Hi:
Flink SQL filter data throw an exception,
code:
def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val source = env.fromElements(
      (1.0f, 11.0f, 12.0f),
      (2.0f, 21.0f, 22.0f),
      (3.0f, 31.0f, 32.0f),
      (4.0f, 41.0f, 42.0f),
      (5.0f, 51.0f, 52.0f)
    )
    val settings = EnvironmentSettings.newInstance()
        .inStreamingMode()
        .useBlinkPlanner()
        .build()
    val tEnv = StreamTableEnvironment.create(env, settings)
    tEnv.createTemporaryView("myTable", source, $("id"), $("f1"), $("f2"))
    val query =
      """
        |select * from myTable where id in (1.0, 2.0, 3.0)
        |""".stripMargin
    tEnv.executeSql(query).print()
}

exception:
Exception in thread "main" java.lang.UnsupportedOperationException: class org.apache.calcite.sql.type.SqlTypeName: FLOAT
at org.apache.calcite.util.Util.needToImplement(Util.java:1075)
at org.apache.calcite.rex.RexLiteral.appendAsJava(RexLiteral.java:703)
at org.apache.calcite.rex.RexLiteral.toJavaString(RexLiteral.java:408)
at org.apache.calcite.rex.RexLiteral.computeDigest(RexLiteral.java:276)
at org.apache.calcite.rex.RexLiteral.<init>(RexLiteral.java:223)
at org.apache.calcite.rex.RexLiteral.toLiteral(RexLiteral.java:737)
at org.apache.calcite.rex.RexLiteral.lambda$printSarg$4(RexLiteral.java:710)
at org.apache.calcite.util.RangeSets$Printer.singleton(RangeSets.java:397)
at org.apache.calcite.util.RangeSets.forEach(RangeSets.java:237)
at org.apache.calcite.util.Sarg.lambda$printTo$0(Sarg.java:110)
at org.apache.calcite.linq4j.Ord.forEach(Ord.java:157)
at org.apache.calcite.util.Sarg.printTo(Sarg.java:106)
at org.apache.calcite.rex.RexLiteral.printSarg(RexLiteral.java:709)
at org.apache.calcite.rex.RexLiteral.lambda$appendAsJava$1(RexLiteral.java:652)
at org.apache.calcite.util.Util.asStringBuilder(Util.java:2502)

Why is that? How do i need to solve it?

thanks.
Reply | Threaded
Open this post in threaded view
|

Re: FlinkSQL Filter Error With Float Column on flink-1.12.0

Timo Walther
Hi,

it seems this is a bug that is located in the Apache Calcite code.

I will open an issue for it.

Thanks for reporting this.

Regards,
Timo


On 12.01.21 11:08, jy l wrote:

> Hi:
> Flink SQL filter data throw an exception,
> code:
> def main(args: Array[String]): Unit = {
>      val env = StreamExecutionEnvironment.getExecutionEnvironment
>      val source = env.fromElements(
>        (1.0f, 11.0f, 12.0f),
>        (2.0f, 21.0f, 22.0f),
>        (3.0f, 31.0f, 32.0f),
>        (4.0f, 41.0f, 42.0f),
>        (5.0f, 51.0f, 52.0f)
>      )
>      val settings = EnvironmentSettings.newInstance()
>          .inStreamingMode()
>          .useBlinkPlanner()
>          .build()
>      val tEnv = StreamTableEnvironment.create(env, settings)
>      tEnv.createTemporaryView("myTable", source, $("id"), $("f1"), $("f2"))
>      val query =
>        """
>          |select * from myTable where id in (1.0, 2.0, 3.0)
>          |""".stripMargin
>      tEnv.executeSql(query).print()
> }
>
> exception:
> Exception in thread "main" java.lang.UnsupportedOperationException:
> class org.apache.calcite.sql.type.SqlTypeName: FLOAT
> at org.apache.calcite.util.Util.needToImplement(Util.java:1075)
> at org.apache.calcite.rex.RexLiteral.appendAsJava(RexLiteral.java:703)
> at org.apache.calcite.rex.RexLiteral.toJavaString(RexLiteral.java:408)
> at org.apache.calcite.rex.RexLiteral.computeDigest(RexLiteral.java:276)
> at org.apache.calcite.rex.RexLiteral.<init>(RexLiteral.java:223)
> at org.apache.calcite.rex.RexLiteral.toLiteral(RexLiteral.java:737)
> at org.apache.calcite.rex.RexLiteral.lambda$printSarg$4(RexLiteral.java:710)
> at org.apache.calcite.util.RangeSets$Printer.singleton(RangeSets.java:397)
> at org.apache.calcite.util.RangeSets.forEach(RangeSets.java:237)
> at org.apache.calcite.util.Sarg.lambda$printTo$0(Sarg.java:110)
> at org.apache.calcite.linq4j.Ord.forEach(Ord.java:157)
> at org.apache.calcite.util.Sarg.printTo(Sarg.java:106)
> at org.apache.calcite.rex.RexLiteral.printSarg(RexLiteral.java:709)
> at
> org.apache.calcite.rex.RexLiteral.lambda$appendAsJava$1(RexLiteral.java:652)
> at org.apache.calcite.util.Util.asStringBuilder(Util.java:2502)
>
> Why is that? How do i need to solve it?
>
> thanks.

Reply | Threaded
Open this post in threaded view
|

Re: FlinkSQL Filter Error With Float Column on flink-1.12.0

Timo Walther
See here: https://issues.apache.org/jira/browse/FLINK-20942

On 12.01.21 16:04, Timo Walther wrote:

> Hi,
>
> it seems this is a bug that is located in the Apache Calcite code.
>
> I will open an issue for it.
>
> Thanks for reporting this.
>
> Regards,
> Timo
>
>
> On 12.01.21 11:08, jy l wrote:
>> Hi:
>> Flink SQL filter data throw an exception,
>> code:
>> def main(args: Array[String]): Unit = {
>>      val env = StreamExecutionEnvironment.getExecutionEnvironment
>>      val source = env.fromElements(
>>        (1.0f, 11.0f, 12.0f),
>>        (2.0f, 21.0f, 22.0f),
>>        (3.0f, 31.0f, 32.0f),
>>        (4.0f, 41.0f, 42.0f),
>>        (5.0f, 51.0f, 52.0f)
>>      )
>>      val settings = EnvironmentSettings.newInstance()
>>          .inStreamingMode()
>>          .useBlinkPlanner()
>>          .build()
>>      val tEnv = StreamTableEnvironment.create(env, settings)
>>      tEnv.createTemporaryView("myTable", source, $("id"), $("f1"),
>> $("f2"))
>>      val query =
>>        """
>>          |select * from myTable where id in (1.0, 2.0, 3.0)
>>          |""".stripMargin
>>      tEnv.executeSql(query).print()
>> }
>>
>> exception:
>> Exception in thread "main" java.lang.UnsupportedOperationException:
>> class org.apache.calcite.sql.type.SqlTypeName: FLOAT
>> at org.apache.calcite.util.Util.needToImplement(Util.java:1075)
>> at org.apache.calcite.rex.RexLiteral.appendAsJava(RexLiteral.java:703)
>> at org.apache.calcite.rex.RexLiteral.toJavaString(RexLiteral.java:408)
>> at org.apache.calcite.rex.RexLiteral.computeDigest(RexLiteral.java:276)
>> at org.apache.calcite.rex.RexLiteral.<init>(RexLiteral.java:223)
>> at org.apache.calcite.rex.RexLiteral.toLiteral(RexLiteral.java:737)
>> at
>> org.apache.calcite.rex.RexLiteral.lambda$printSarg$4(RexLiteral.java:710)
>> at
>> org.apache.calcite.util.RangeSets$Printer.singleton(RangeSets.java:397)
>> at org.apache.calcite.util.RangeSets.forEach(RangeSets.java:237)
>> at org.apache.calcite.util.Sarg.lambda$printTo$0(Sarg.java:110)
>> at org.apache.calcite.linq4j.Ord.forEach(Ord.java:157)
>> at org.apache.calcite.util.Sarg.printTo(Sarg.java:106)
>> at org.apache.calcite.rex.RexLiteral.printSarg(RexLiteral.java:709)
>> at
>> org.apache.calcite.rex.RexLiteral.lambda$appendAsJava$1(RexLiteral.java:652)
>>
>> at org.apache.calcite.util.Util.asStringBuilder(Util.java:2502)
>>
>> Why is that? How do i need to solve it?
>>
>> thanks.
>