You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Srinivas Chamarthi <sr...@gmail.com> on 2014/11/09 00:26:15 UTC

Unresolved Attributes

I have an exception when I am trying to run a simple where clause query. I
can see the name attribute is present in the schema but somehow it still
throws the exception.

query = "select name from business where business_id=" + business_id

what am I doing wrong ?

thx
srinivas


Exception in thread "main"
org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Unresolved
attributes: 'name, tree:
Project ['name]
 Filter (business_id#1 = 'Ba1hXOqb3Yhix8bhE0k_WQ)
  Subquery business
   SparkLogicalPlan (ExistingRdd
[attributes#0,business_id#1,categories#2,city#3,full_address#4,hours#5,latitude#6,longitude#7,name#8,neighborhoods#9,open#10,review_count#11,stars#12,state#13,type#14],
MappedRDD[5] at map at JsonRDD.scala:38)

Re: Unresolved Attributes

Posted by Srinivas Chamarthi <sr...@gmail.com>.
ok I am answering my question here. looks like name has a reserved key word
or some special treatment. unless you use alias, it doesn't work. so use an
alias always with name attribute.

select a.name from xxx a where a.xxxx = 'yyyyy' // RIGHT
select name from xxxx where t ='yyyyyy' // doesn't work.

not sure if theres an issue already and already fixed in master.

I will raise an issue if someone else also confirms it.

thx
srinivas

On Sat, Nov 8, 2014 at 3:26 PM, Srinivas Chamarthi <
srinivas.chamarthi@gmail.com> wrote:

> I have an exception when I am trying to run a simple where clause query. I
> can see the name attribute is present in the schema but somehow it still
> throws the exception.
>
> query = "select name from business where business_id=" + business_id
>
> what am I doing wrong ?
>
> thx
> srinivas
>
>
> Exception in thread "main"
> org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Unresolved
> attributes: 'name, tree:
> Project ['name]
>  Filter (business_id#1 = 'Ba1hXOqb3Yhix8bhE0k_WQ)
>   Subquery business
>    SparkLogicalPlan (ExistingRdd
> [attributes#0,business_id#1,categories#2,city#3,full_address#4,hours#5,latitude#6,longitude#7,name#8,neighborhoods#9,open#10,review_count#11,stars#12,state#13,type#14],
> MappedRDD[5] at map at JsonRDD.scala:38)
>