Getting compilation error in Array[TypeInformation]

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

Getting compilation error in Array[TypeInformation]

Mich Talebzadeh
This is the code in Scala

    val tableEnv = TableEnvironment.getTableEnvironment(streamExecEnv)
    tableEnv.registerDataStream("priceTable", splitStream, 'key, 'ticker, 'timeissued, 'price)
    val result = tableEnv.scan("priceTable").filter('ticker === "VOD" && 'price > 99.0).select('key, 'ticker, 'timeissued, 'price)

    val fieldNames: Array[String] = Array("key", "ticker", "timeissued", "price")
    val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
    val sink: TableSink = new CsvTableSink(writeDirectory+fileName, fieldDelim = ",")
    tableEnv.registerTableSink("CsvSinkTable", fieldNames, fieldTypes, sink)
    result.insertInto("CsvSinkTable")


When compiling I get the following error

[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: class TypeInformation takes type parameters
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                           ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                    ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types

[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                  ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                                ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                                              ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:172: trait TableSink takes type parameters
[error]     val sink: TableSink = new CsvTableSink(writeDirectory+fileName, fieldDelim = ",")
[error]               ^
[error] 6 errors found


May be I am not importing the correct dependencies.

Thanks

Dr Mich Talebzadeh

 

LinkedIn  https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

http://talebzadehmich.wordpress.com


Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.

 

Reply | Threaded
Open this post in threaded view
|

Re: Getting compilation error in Array[TypeInformation]

Timo Walther
Hi Mich,

I strongly recommend to read a good Scala programming tutorial before writing on a mailing list.

As the error indicates you are missing generic parameters. If you don't know the parameter use `Array[TypeInformation[_]]` or `TableSink[_]`. For the types class you need to import the types class "org.apache.flink.table.api.Types".

Regards,
Timo


Am 09.08.18 um 17:18 schrieb Mich Talebzadeh:
This is the code in Scala

    val tableEnv = TableEnvironment.getTableEnvironment(streamExecEnv)
    tableEnv.registerDataStream("priceTable", splitStream, 'key, 'ticker, 'timeissued, 'price)
    val result = tableEnv.scan("priceTable").filter('ticker === "VOD" && 'price > 99.0).select('key, 'ticker, 'timeissued, 'price)

    val fieldNames: Array[String] = Array("key", "ticker", "timeissued", "price")
    val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
    val sink: TableSink = new CsvTableSink(writeDirectory+fileName, fieldDelim = ",")
    tableEnv.registerTableSink("CsvSinkTable", fieldNames, fieldTypes, sink)
    result.insertInto("CsvSinkTable")


When compiling I get the following error

[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: class TypeInformation takes type parameters
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                           ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                    ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types

[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                  ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                                ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                                              ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:172: trait TableSink takes type parameters
[error]     val sink: TableSink = new CsvTableSink(writeDirectory+fileName, fieldDelim = ",")
[error]               ^
[error] 6 errors found


May be I am not importing the correct dependencies.

Thanks

Dr Mich Talebzadeh

 

LinkedIn  https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

http://talebzadehmich.wordpress.com


Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.

 


Reply | Threaded
Open this post in threaded view
|

Re: Getting compilation error in Array[TypeInformation]

Mich Talebzadeh
Thanks those suggestions helped

Dr Mich Talebzadeh

 

LinkedIn  https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

http://talebzadehmich.wordpress.com


Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.

 



On Thu, 9 Aug 2018 at 16:41, Timo Walther <[hidden email]> wrote:
Hi Mich,

I strongly recommend to read a good Scala programming tutorial before writing on a mailing list.

As the error indicates you are missing generic parameters. If you don't know the parameter use `Array[TypeInformation[_]]` or `TableSink[_]`. For the types class you need to import the types class "org.apache.flink.table.api.Types".

Regards,
Timo


Am 09.08.18 um 17:18 schrieb Mich Talebzadeh:
This is the code in Scala

    val tableEnv = TableEnvironment.getTableEnvironment(streamExecEnv)
    tableEnv.registerDataStream("priceTable", splitStream, 'key, 'ticker, 'timeissued, 'price)
    val result = tableEnv.scan("priceTable").filter('ticker === "VOD" && 'price > 99.0).select('key, 'ticker, 'timeissued, 'price)

    val fieldNames: Array[String] = Array("key", "ticker", "timeissued", "price")
    val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
    val sink: TableSink = new CsvTableSink(writeDirectory+fileName, fieldDelim = ",")
    tableEnv.registerTableSink("CsvSinkTable", fieldNames, fieldTypes, sink)
    result.insertInto("CsvSinkTable")


When compiling I get the following error

[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: class TypeInformation takes type parameters
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                           ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                    ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types

[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                  ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                                ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:171: not found: value Types
[error]     val fieldTypes: Array[TypeInformation] = Array(Types.STRING, Types.STRING, Types.STRING, Types.Float)
[error]                                                                                              ^
[error] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:172: trait TableSink takes type parameters
[error]     val sink: TableSink = new CsvTableSink(writeDirectory+fileName, fieldDelim = ",")
[error]               ^
[error] 6 errors found


May be I am not importing the correct dependencies.

Thanks

Dr Mich Talebzadeh

 

LinkedIn  https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

http://talebzadehmich.wordpress.com


Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.