[
https://issues.apache.org/jira/browse/SPARK-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Albul updated SPARK-2346:
-----------------------------------
Description:
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.
was:
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.
> Error parsing table names that starts from 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
> Labels: Parser, SQL
>
> 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)