Support Questions
Find answers, ask questions, and share your expertise

Exceeded maximum number of child expressions

Contributor

Hello

 

My colleague runs big SQLs through HUE interface on Impala (he knows only sql 🙂 ). Sometimes we get following error on hue interface. Does this error related with impala ? If yes, is there any way to fix that ?

 

AnalysisException: Exceeded the maximum number of child expressions (10000). Expression has 12061 children: CASE WHEN (longitude BETWEEN 28.4360479702 AND 28.4480394711) AND (latitude BETW...

 

Above error occured while he was running about 12000 lines of SQL  🙂

 

Best regards

 

1 REPLY 1

Master Collaborator

Yes, Impala is throwing that error. Impala has a few hard limitations on (1) the number of children an expression can have and (2) the depth of the expression tree.

 

You can typically work around the problem by rephrasing the huge expression as a join on a new table. For example, in your example, you'd have something like:

 

create table grid {

  lat_lower_bound double,

  lat_upper_bound double,

  long_lower_bound double,

  long_lower_bound

}

 

and then

 

select ... from original_table t, grid g

where

t.longitude between g.lat_lower_bound and g.lat_upper_bound

  and t.latitute between g.long_lower_bound and g.long_upper_bound