You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Samay <sm...@gmail.com> on 2014/09/03 11:12:57 UTC

SparkSQL TPC-H query 3 joining multiple tables

Hi,

I am trying to run query 3 from the TPC-H benchmark using SparkSQL. But, I
am running into errors which I believe are because the parser does not
accept the JOIN syntax I am trying.

Below are the syntax which I tried and the error messages I am seeing .

Exception in thread "main" java.lang.RuntimeException: [1.159] failure:
``UNION'' expected but `join' found

    SELECT l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue,
o_orderdate, o_shippriority FROM customer c join orders o on c.c_custkey =
o.o_custkey join lineitem l on l.l_orderkey = o.o_orderkey WHERE
c_mktsegment = 'BUILDING' AND o_orderdate < '1995-03-15' AND l_shipdate >
'1995-03-15' GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY
revenue desc, o_orderdate LIMIT 10;

Exception in thread "main" java.lang.RuntimeException: [1.125] failure:
``UNION'' expected but `,' found

SELECT l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue,
o_orderdate, o_shippriority FROM customer c, orders o, lineitem l WHERE
l.l_orderkey = o.o_orderkey AND c.c_custkey = o.o_custkey AND c_mktsegment =
'BUILDING' AND o_orderdate < '1995-03-15' AND l_shipdate > '1995-03-15'
GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY revenue desc,
o_orderdate LIMIT 10;

The same syntax works when I join 2 tables (TPC-H query 12 for instance).
Any ideas as to what the issue is?

Thanks in advance,
Samay



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/SparkSQL-TPC-H-query-3-joining-multiple-tables-tp13344.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: SparkSQL TPC-H query 3 joining multiple tables

Posted by Michael Armbrust <mi...@databricks.com>.
Are you using SQLContext or HiveContext?  The default sql dialect in
HiveContext (HiveQL) is a little more complete and might be a better place
to start.


On Wed, Sep 3, 2014 at 2:12 AM, Samay <sm...@gmail.com> wrote:

> Hi,
>
> I am trying to run query 3 from the TPC-H benchmark using SparkSQL. But, I
> am running into errors which I believe are because the parser does not
> accept the JOIN syntax I am trying.
>
> Below are the syntax which I tried and the error messages I am seeing .
>
> Exception in thread "main" java.lang.RuntimeException: [1.159] failure:
> ``UNION'' expected but `join' found
>
>     SELECT l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue,
> o_orderdate, o_shippriority FROM customer c join orders o on c.c_custkey =
> o.o_custkey join lineitem l on l.l_orderkey = o.o_orderkey WHERE
> c_mktsegment = 'BUILDING' AND o_orderdate < '1995-03-15' AND l_shipdate >
> '1995-03-15' GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY
> revenue desc, o_orderdate LIMIT 10;
>
> Exception in thread "main" java.lang.RuntimeException: [1.125] failure:
> ``UNION'' expected but `,' found
>
> SELECT l_orderkey, sum(l_extendedprice * (1 - l_discount)) as revenue,
> o_orderdate, o_shippriority FROM customer c, orders o, lineitem l WHERE
> l.l_orderkey = o.o_orderkey AND c.c_custkey = o.o_custkey AND c_mktsegment
> =
> 'BUILDING' AND o_orderdate < '1995-03-15' AND l_shipdate > '1995-03-15'
> GROUP BY l_orderkey, o_orderdate, o_shippriority ORDER BY revenue desc,
> o_orderdate LIMIT 10;
>
> The same syntax works when I join 2 tables (TPC-H query 12 for instance).
> Any ideas as to what the issue is?
>
> Thanks in advance,
> Samay
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/SparkSQL-TPC-H-query-3-joining-multiple-tables-tp13344.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>