Transform from Table to DS

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

Transform from Table to DS

Andres Angel
Hello guys I'm working on Java environment and I have a sample code as:

Table schemafit = tenv.sqlQuery("Here is my query");

I need to turn this into a DS to print and any other transformation then I doing a sort of:

DataStream<Row> resultSet = tenv.toAppendStream(schemafit, Row.class);

resultSet.print();

However, (please any help) I'm getting the error: 

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/scala/typeutils/CaseClassTypeInfo
at org.apache.flink.table.codegen.CodeGenUtils$.fieldAccessorFor(CodeGenUtils.scala:246)
at org.apache.flink.table.codegen.CodeGenerator.generateFieldAccess(CodeGenerator.scala:1217)
at org.apache.flink.table.codegen.CodeGenerator.generateInputAccess(CodeGenerator.scala:1165)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$3.apply(CodeGenerator.scala:286)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$3.apply(CodeGenerator.scala:269)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofInt.foreach(ArrayOps.scala:234)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.mutable.ArrayOps$ofInt.map(ArrayOps.scala:234)
at org.apache.flink.table.codegen.CodeGenerator.generateConverterResultExpression(CodeGenerator.scala:269)
at org.apache.flink.table.plan.nodes.datastream.StreamScan$class.generateConversionProcessFunction(StreamScan.scala:111)
at org.apache.flink.table.plan.nodes.datastream.StreamScan$class.convertToInternalRow(StreamScan.scala:74)
at org.apache.flink.table.plan.nodes.datastream.DataStreamScan.convertToInternalRow(DataStreamScan.scala:39)
at org.apache.flink.table.plan.nodes.datastream.DataStreamScan.translateToPlan(DataStreamScan.scala:82)
at org.apache.flink.table.plan.nodes.datastream.DataStreamJoin.translateToPlan(DataStreamJoin.scala:103)
at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.translateToPlan(DataStreamCalc.scala:97)
at org.apache.flink.table.api.StreamTableEnvironment.translateToCRow(StreamTableEnvironment.scala:969)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:896)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:866)
at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:202)
at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:156)
at consumer.trconsumer.main(trconsumer.java:116)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.scala.typeutils.CaseClassTypeInfo
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 24 more
Reply | Threaded
Open this post in threaded view
|

Re: Transform from Table to DS

Caizhi Weng
Hi Andres,

Can you print your entire code (including the import section) in this post? It might be that this Exception has something to do with your import. If you are coding in a Java environment then you should import StreamTableEnvironment.java not StreamTableEnvironment.scala.

Andres Angel <[hidden email]> 于2019年7月24日周三 上午12:01写道:
Hello guys I'm working on Java environment and I have a sample code as:

Table schemafit = tenv.sqlQuery("Here is my query");

I need to turn this into a DS to print and any other transformation then I doing a sort of:

DataStream<Row> resultSet = tenv.toAppendStream(schemafit, Row.class);

resultSet.print();

However, (please any help) I'm getting the error: 

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/scala/typeutils/CaseClassTypeInfo
at org.apache.flink.table.codegen.CodeGenUtils$.fieldAccessorFor(CodeGenUtils.scala:246)
at org.apache.flink.table.codegen.CodeGenerator.generateFieldAccess(CodeGenerator.scala:1217)
at org.apache.flink.table.codegen.CodeGenerator.generateInputAccess(CodeGenerator.scala:1165)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$3.apply(CodeGenerator.scala:286)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$3.apply(CodeGenerator.scala:269)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofInt.foreach(ArrayOps.scala:234)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.mutable.ArrayOps$ofInt.map(ArrayOps.scala:234)
at org.apache.flink.table.codegen.CodeGenerator.generateConverterResultExpression(CodeGenerator.scala:269)
at org.apache.flink.table.plan.nodes.datastream.StreamScan$class.generateConversionProcessFunction(StreamScan.scala:111)
at org.apache.flink.table.plan.nodes.datastream.StreamScan$class.convertToInternalRow(StreamScan.scala:74)
at org.apache.flink.table.plan.nodes.datastream.DataStreamScan.convertToInternalRow(DataStreamScan.scala:39)
at org.apache.flink.table.plan.nodes.datastream.DataStreamScan.translateToPlan(DataStreamScan.scala:82)
at org.apache.flink.table.plan.nodes.datastream.DataStreamJoin.translateToPlan(DataStreamJoin.scala:103)
at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.translateToPlan(DataStreamCalc.scala:97)
at org.apache.flink.table.api.StreamTableEnvironment.translateToCRow(StreamTableEnvironment.scala:969)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:896)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:866)
at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:202)
at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:156)
at consumer.trconsumer.main(trconsumer.java:116)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.scala.typeutils.CaseClassTypeInfo
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 24 more
Reply | Threaded
Open this post in threaded view
|

Re: Transform from Table to DS

Andres Angel
This has been fixed now, something weird is that according to the documentation , I might include around 4 maven packages to properly work along with the TABLE/SQL API https://ci.apache.org/projects/flink/flink-docs-stable/dev/table/ .

However , I solved my issue working without :

<!--        <dependency>-->
<!--            <groupId>org.apache.flink</groupId>-->
<!--            <artifactId>flink-table-planner_2.11</artifactId>-->
<!--            <version>1.8.0</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.apache.flink</groupId>-->
<!--            <artifactId>flink-table-common</artifactId>-->
<!--            <version>1.8.0</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.apache.flink</groupId>-->
<!--            <artifactId>flink-table-api-java-bridge_2.11</artifactId>-->
<!--            <version>1.8.0</version>-->
<!--        </dependency>-->


I just leave:

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table_2.11</artifactId>
            <version>1.6.1</version>
        </dependency>

Thanks so much

On Tue, Jul 23, 2019 at 9:54 PM Caizhi Weng <[hidden email]> wrote:
Hi Andres,

Can you print your entire code (including the import section) in this post? It might be that this Exception has something to do with your import. If you are coding in a Java environment then you should import StreamTableEnvironment.java not StreamTableEnvironment.scala.

Andres Angel <[hidden email]> 于2019年7月24日周三 上午12:01写道:
Hello guys I'm working on Java environment and I have a sample code as:

Table schemafit = tenv.sqlQuery("Here is my query");

I need to turn this into a DS to print and any other transformation then I doing a sort of:

DataStream<Row> resultSet = tenv.toAppendStream(schemafit, Row.class);

resultSet.print();

However, (please any help) I'm getting the error: 

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/scala/typeutils/CaseClassTypeInfo
at org.apache.flink.table.codegen.CodeGenUtils$.fieldAccessorFor(CodeGenUtils.scala:246)
at org.apache.flink.table.codegen.CodeGenerator.generateFieldAccess(CodeGenerator.scala:1217)
at org.apache.flink.table.codegen.CodeGenerator.generateInputAccess(CodeGenerator.scala:1165)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$3.apply(CodeGenerator.scala:286)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$3.apply(CodeGenerator.scala:269)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofInt.foreach(ArrayOps.scala:234)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.mutable.ArrayOps$ofInt.map(ArrayOps.scala:234)
at org.apache.flink.table.codegen.CodeGenerator.generateConverterResultExpression(CodeGenerator.scala:269)
at org.apache.flink.table.plan.nodes.datastream.StreamScan$class.generateConversionProcessFunction(StreamScan.scala:111)
at org.apache.flink.table.plan.nodes.datastream.StreamScan$class.convertToInternalRow(StreamScan.scala:74)
at org.apache.flink.table.plan.nodes.datastream.DataStreamScan.convertToInternalRow(DataStreamScan.scala:39)
at org.apache.flink.table.plan.nodes.datastream.DataStreamScan.translateToPlan(DataStreamScan.scala:82)
at org.apache.flink.table.plan.nodes.datastream.DataStreamJoin.translateToPlan(DataStreamJoin.scala:103)
at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.translateToPlan(DataStreamCalc.scala:97)
at org.apache.flink.table.api.StreamTableEnvironment.translateToCRow(StreamTableEnvironment.scala:969)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:896)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:866)
at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:202)
at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:156)
at consumer.trconsumer.main(trconsumer.java:116)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.scala.typeutils.CaseClassTypeInfo
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 24 more