You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Mich Talebzadeh <mi...@gmail.com> on 2018/08/09 15:18:53 UTC

Getting compilation error in Array[TypeInformation]

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
<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.

Re: Getting compilation error in Array[TypeInformation]

Posted by Mich Talebzadeh <mi...@gmail.com>.
Thanks those suggestions helped

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<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 <tw...@apache.org> 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
> <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.
>
>
>
>
>

Re: Getting compilation error in Array[TypeInformation]

Posted by Timo Walther <tw...@apache.org>.
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.
>