[jira] [Created] (FLINK-11919) Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "FROM user" at line 1, column 17.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-11919) Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "FROM user" at line 1, column 17.

Shang Yuanchun (Jira)
thinktothings created FLINK-11919:
-------------------------------------

             Summary: Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "FROM user" at line 1, column 17.
                 Key: FLINK-11919
                 URL: https://issues.apache.org/jira/browse/FLINK-11919
             Project: Flink
          Issue Type: Bug
          Components: API / Table SQL
    Affects Versions: 1.7.2
         Environment: os: mac 0.14.3 

java: 1.8.0_191

scala: 2.11.12

code: https://github.com/opensourceteams/flink-maven-scala/blob/master/src/main/scala/com/opensourceteams/module/bigdata/flink/example/sql/user/Run.scala

 
            Reporter: thinktothings
         Attachments: image-2019-03-14-17-41-43-840.png

Register table name, can not use user, use other names, such as user1 can be normal

 

 

===========================================================

package com.opensourceteams.module.bigdata.flink.example.tableapi.test

import org.apache.flink.api.scala.ExecutionEnvironment
import org.apache.flink.table.api.scala._
import org.apache.flink.api.scala._
import org.apache.flink.table.api.TableEnvironment

object Run {



 def main(args: Array[String]): Unit = {


 //得到批环境
 val env = ExecutionEnvironment.getExecutionEnvironment


 val dataSet = env.fromElements(("小明",15,"男"),("小李",25,"女"))

 //得到Table环境
 val tableEnv = TableEnvironment.getTableEnvironment(env)
 //注册table
 tableEnv.registerDataSet("user",dataSet,'name,'age,'sex)



 tableEnv.sqlQuery(s"select name,age FROM user")
 .first(100).print()


 }

}

 

===========================================================

 

Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "FROM user" at line 1, column 17.
Was expecting one of:
 <EOF>
 "ORDER" ...
 "LIMIT" ...
 "OFFSET" ...
 "FETCH" ...
 "FROM" <IDENTIFIER> ...
 "FROM" <QUOTED_IDENTIFIER> ...
 "FROM" <BACK_QUOTED_IDENTIFIER> ...
 "FROM" <BRACKET_QUOTED_IDENTIFIER> ...
 "FROM" <UNICODE_QUOTED_IDENTIFIER> ...
 "FROM" "LATERAL" ...
 "FROM" "(" ...
 "FROM" "UNNEST" ...
 "FROM" "TABLE" ...
 "," ...
 "AS" ...
 <IDENTIFIER> ...
 <QUOTED_IDENTIFIER> ...
 <BACK_QUOTED_IDENTIFIER> ...
 <BRACKET_QUOTED_IDENTIFIER> ...
 <UNICODE_QUOTED_IDENTIFIER> ...
 "." ...
 "NOT" ...
 "IN" ...
 "<" ...
 "<=" ...
 ">" ...
 ">=" ...
 "=" ...
 "<>" ...
 "!=" ...
 "BETWEEN" ...
 "LIKE" ...
 "SIMILAR" ...
 "+" ...
 "-" ...
 "*" ...
 "/" ...
 "%" ...
 "||" ...
 "AND" ...
 "OR" ...
 "IS" ...
 "MEMBER" ...
 "SUBMULTISET" ...
 "CONTAINS" ...
 "OVERLAPS" ...
 "EQUALS" ...
 "PRECEDES" ...
 "SUCCEEDS" ...
 "MULTISET" ...
 "[" ...
 "UNION" ...
 "INTERSECT" ...
 "EXCEPT" ...
 "MINUS" ...
 "(" ...
 
 at org.apache.flink.table.calcite.FlinkPlannerImpl.parse(FlinkPlannerImpl.scala:94)
 at org.apache.flink.table.api.TableEnvironment.sqlQuery(TableEnvironment.scala:743)
 at com.opensourceteams.module.bigdata.flink.example.tableapi.test.Run$.main(Run.scala:28)
 at com.opensourceteams.module.bigdata.flink.example.tableapi.test.Run.main(Run.scala)

 

 

=======================================================

 

 

!image-2019-03-14-17-41-43-840.png!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)