Re: Re: How to force sorted merge join to broadcast join

2019-07-29 Thread Wenchen Fan
You can try EXPLAIN COST query and see if it works for you. On Mon, Jul 29, 2019 at 5:34 PM Rubén Berenguel wrote: > I think there is no way of doing that (at least don't remember one right > now). The closer I remember now, is you can run the SQL "ANALYZE TABLE > table_name COMPUTE STATISTIC" t

Re:Re: How to force sorted merge join to broadcast join

2019-07-29 Thread Rubén Berenguel
I think there is no way of doing that (at least don't remember one right now). The closer I remember now, is you can run the SQL "ANALYZE TABLE table_name COMPUTE STATISTIC" to compute them regardless of having a query (also hints the cost based optimiser if I remember correctly), but as far as dis

Re:Re: How to force sorted merge join to broadcast join

2019-07-29 Thread zhangliyun
thks! after using the syntax provided in the link, select /*+ BROADCAST (A) */ ... , i got what i want. but i want to ask beside using queryExecution.stringWithStats (dataframe api) to show the table statistics, is there any way to show the table statistics in explain xxx in spark sql command l

Re: How to force sorted merge join to broadcast join

2019-07-28 Thread Rubén Berenguel
Hi, I hope this answers your question. You can hint the broadcast in SQL as detailed here: https://jaceklaskowski.gitbooks.io/mastering-spark-sql/spark-sql-joins-broadcast.html (thanks Jacek :) ) I'd recommend creating a temporary table with the trimming you use in the join (for clarity). Also kee

How to force sorted merge join to broadcast join

2019-07-28 Thread zhangliyun
Hi all: i want to ask a question about broadcast join in spark sql. ``` select A.*,B.nsf_cards_ratio * 1.00 / A.nsf_on_entry as nsf_ratio_to_pop from B left join A on trim(A.country) = trim(B.cntry_code); ``` here A is a small table only 8 rows, but somehow the statistics of table A has