Thanks for your information Dian. It is not an urgent issue though. Maybe
revisit later :-)

Best,
tison.


Dian Fu <dian0511...@gmail.com> 于2019年9月30日周一 下午7:34写道:

> Hi tison,
>
> Actually there may be compatibility issues as the
> BatchTableEnvironment/StreamTableEnvironment under "api.java" are public
> interfaces.
>
> Regards,
> Dian
>
> 在 2019年9月30日,下午4:49,Zili Chen <wander4...@gmail.com> 写道:
>
> Hi Dian,
>
> What about rename api.java to japi if there is no unexpected compatibility
> issue? I think we can always avoid use a `.java.` in package names.
>
> Best,
> tison.
>
>
> Dian Fu <dian0511...@gmail.com> 于2019年9月26日周四 下午10:54写道:
>
>> Hi Nick,
>>
>> There is a package named "org.apache.flink.table.api.java" in flink and
>> so the import of "org.apache.flink.table.api._" causes "
>> org.apache.flink.table.api.java" imported. Then all the import of
>> package starting with "java" such as "import java.util.ArrayList" will try
>> to find the classes under "org.apache.flink.table.api.java" as Scala
>> uses relative import by default. So I think nothing is wrong here. This is
>> the behavior of Scala language. You just need to use prefix of "_root_" to
>> force using absolute import.
>>
>> Regards,
>> Dian
>>
>> 在 2019年9月26日,下午10:26,Nicholas Walton <nwal...@me.com> 写道:
>>
>> Dian
>>
>> That fixed the problem thanks you. It would appear that someone has taken
>> it upon themselves to redefine part of the Java standard library in
>> org.apache.flink.table.api._
>>
>> NIck
>>
>> On 26 Sep 2019, at 15:16, Dian Fu <dian0511...@gmail.com> wrote:
>>
>> Hi Nick,
>>
>> [error] ………………/src/main/scala/org/example/Job.scala:30:13: object util
>> is not a member of package org.apache.flink.table.api.java
>> [error] import java.util.ArrayList
>>
>>
>> The error message shows that it tries to find "util.ArrayList" under
>> package "org.apache.flink.table.api.java". So you can try one of the
>> following two solutions:
>> 1) Don't import "org.apache.flink.table.api._"
>> 2) Use absolute import: "import _root_.java.util.ArrayList"
>>
>> Regards,
>> Dian
>>
>> 在 2019年9月26日,下午10:04,Nicholas Walton <nwal...@me.com> 写道:
>>
>> I’ve shrunk the problem down to a minimal size. The code
>>
>> package org.example
>>
>> import org.apache.flink.table.api._
>> import org.apache.http.HttpHost
>>
>> import java.util.ArrayList
>>
>> object foo {
>>
>>   val httpHosts = new ArrayList[HttpHost]
>>   httpHosts.add(new HttpHost("samwise.local", 9200, "http"))
>>
>> }
>>
>> will not compile, but remove the import org.apache.flink.table.api._ and
>> all is well
>>
>> Nick
>>
>>
>> On 26 Sep 2019, at 12:53, Nicholas Walton <nwal...@me.com> wrote:
>>
>> I’m having a problem using ArrayList in Scala . The code is below
>>
>> import org.apache.flink.core.fs._
>> import org.apache.flink.streaming.api._
>> import org.apache.flink.streaming.api.scala._
>> import org.apache.flink.table.api._
>> import org.apache.flink.table.api.scala._
>> import org.apache.flink.table.sinks._
>> import org.apache.http.HttpHost
>> import org.slf4j.LoggerFactory
>>
>> import java.util.ArrayList
>>
>> object Job {
>>
>>   val httpHosts = new ArrayList[HttpHost]
>>   httpHosts.add(new HttpHost("samwise.local", 9200, "http"))
>>
>>     …..
>>
>> }
>>
>> Scala refuses to recognise ArrayList. The IDE InteliJ likewise flags
>> java.util as not existing, even though it recognises ArrayList and suggest
>> auto-insertion of the import java.utils.ArrayList statement. The
>> compilation errors are
>>
>> [error] ………………/src/main/scala/org/example/Job.scala:30:13: object util
>> is not a member of package org.apache.flink.table.api.java
>> [error] import java.util.ArrayList
>> [error]             ^
>> [error] ………………/src/main/scala/org/example/Job.scala:34:23: not found:
>> type ArrayList
>> [error]   val httpHosts = new ArrayList[HttpHost]
>> [error]                       ^
>> [error] two errors found
>> [error] (Compile / compileIncremental) Compilation failed
>>
>> Without the ArrayList reference the code compiles with no errors.
>>
>> The sbt build file, if it helps is,
>>
>> resolvers in ThisBuild ++= Seq("Apache Development Snapshot Repository"
>> at "https://repository.apache.org/content/repositories/snapshots/";,
>> Resolver.mavenLocal)
>>
>> name := "Flink MultiChannel Project"
>>
>> version := "0.1-SNAPSHOT"
>>
>> organization := "org.example"
>>
>> scalaVersion in ThisBuild := "2.11.0"
>>
>> val flinkVersion = "1.8.1"
>>
>> val flinkDependencies = Seq(
>>   "org.apache.flink" %% "flink-scala" % flinkVersion ,
>>   "org.apache.flink" %% "flink-table" % "1.7.2" ,
>>   "org.apache.flink" %% "flink-connector-elasticsearch" % flinkVersion,
>>   "org.apache.flink" %% "flink-streaming-scala" % flinkVersion,
>>   "org.apache.httpcomponents" % "httpclient" % "4.5.10",
>>   "org.apache.httpcomponents" % "httpcore" % "4.4.11")
>> // https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore
>>
>> lazy val root = (project in file(".")).
>>   settings(
>>     libraryDependencies ++= flinkDependencies)
>>
>> mainClass in assembly := Some("org.example.Job")
>>
>> // make run command include the provided dependencies
>> run in Compile := Defaults.runTask(fullClasspath in Compile, mainClass in
>> (Compile, run), runner in (Compile, run))
>>
>> // exclude Scala library from assembly
>> assemblyOption in assembly := (assemblyOption in
>> assembly).value.copy(includeScala = false)
>>
>>
>> TIA
>>
>> Nick
>>
>>
>>
>>
>>
>>
>

Reply via email to