2

I am trying to join two tables using flink scala table api. I have one table with two(a,b) columns and another table with one (c)column i want to join the two tables to a bigger table having three(a, b, c) columns. I simply want to join them i don't want to use any condition(Where clause) to join them. But Flink throws me an error to use Where clause, is it a way to join the table without any condition in the where clause? if i wan to use where clause what condition should i give?

Below is my command for joining two tables

val table_join = table1.join(table2).select("a,b,c").toDataset[res]

any help in the right direction is highly appreciated. Thank you.

Fabian Hueske
  • 18,707
  • 2
  • 44
  • 49

1 Answers1

3

Apache Flink's Table API join is an inner equi-join and requires at least one equality predicate.

Joins without predicates are cross products. Flink's Table API does not offer an operator for cross product, because cross products are very expensive to compute.

With Flink's DataSet API, cross products can be computed using cross operator or a map function with a Broadcast set.

Fabian Hueske
  • 18,707
  • 2
  • 44
  • 49
  • What you could do as a work around, though, is to assign an additional column which contains for each row the same value. If you join on this column, then you basically simulate a cross operation. – Till Rohrmann Jul 13 '15 at 08:22