[ https://issues.apache.org/jira/browse/SPARK-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14052018#comment-14052018 ]
Alexander Albul commented on SPARK-2346: ---------------------------------------- Well, it depends actually. The link that you sent just show a limitation in postgress database that means that they have not an optimal lexer. >From other hand - Hive support any kind of table name. I found this bug >because i migrate from Shark to Spark SQL and some of my tests that had a >tables starting with numbers started to fail. > Register as table should not accept table names that start with numbers > ----------------------------------------------------------------------- > > Key: SPARK-2346 > URL: https://issues.apache.org/jira/browse/SPARK-2346 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 1.0.0 > Reporter: Alexander Albul > Priority: Minor > Labels: starter > Fix For: 1.1.0 > > > Looks like *org.apache.spark.sql.catalyst.SqlParser* cannot parse table names > when they start from numbers. > Steps to reproduce: > {code:title=Test.scala|borderStyle=solid} > case class Data(value: String) > object Test { > def main(args: Array[String]) { > val sc = new SparkContext("local", "sql") > val sqlSc = new SQLContext(sc) > import sqlSc._ > sc.parallelize(List(Data("one"), > Data("two"))).registerAsTable("123_table") > sql("SELECT * FROM '123_table'").collect().foreach(println) > } > } > {code} > And here is an exception: > {quote} > Exception in thread "main" java.lang.RuntimeException: [1.15] failure: ``('' > expected but "123_table" found > SELECT * FROM '123_table' > ^ > at scala.sys.package$.error(package.scala:27) > at org.apache.spark.sql.catalyst.SqlParser.apply(SqlParser.scala:47) > at org.apache.spark.sql.SQLContext.parseSql(SQLContext.scala:70) > at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:150) > at io.ubix.spark.Test$.main(Test.scala:24) > at io.ubix.spark.Test.main(Test.scala) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) > {quote} > When i am changing from 123_table to table_123 problem disappears. -- This message was sent by Atlassian JIRA (v6.2#6252)