Full outer join on more than two tables

Hi everyone,

I have three tables as below

  • FooTable (Id Int Primary Key, ColumnA Varchar) backed by a topic named FooTopic (partition = 6, replication factor = 3)
  • BarTable (Id Int Primary Key, ColumnB Varchar) backed by a topic named BarTopic (partition = 6, replication factor = 3)
  • BazTable (Id Int Primary Key, ColumnC Varchar) backed by a topic named BazTopic (partition = 6, replication factor = 3)

I wanted to create a table by using full outer join on the three tables above.

CREATE TABLE JOINED_TABLE 
	 AS SELECT RowKey as Id, foo.ColumnA as ColumnA, bar.ColumnB as ColumnB, baz.ColumnC as ColumnC 		 
	FROM 
		FooTable foo
			FULL OUTER JOIN BarTable bar ON bar.Id = foo.Id
			FULL OUTER JOIN BazTable baz ON baz.Id = foo.Id;

But I got an error as below

Could not determine output schema for query due to error: Cannot repartition a TABLE source. If this is a join, make sure that the criteria uses the TABLE's key column ROWKEY instead of [FOO_ID]
Statement: CREATE TABLE JOINED_TABLE WITH (KAFKA_TOPIC='JOINED_TABLE', PARTITIONS=6, REPLICAS=3) AS SELECT
  ROWKEY ID,
  FOO.COLUMNA COLUMNA,
  BAR.COLUMNB COLUMNB,
  BAZ.COLUMNC COLUMNC
FROM FOOTABLE FOO
FULL OUTER JOIN BARTABLE BAR ON ((BAR.ID = FOO.ID))
FULL OUTER JOIN BAZTABLE BAZ ON ((BAZ.ID = FOO.ID))
EMIT CHANGES;

Do you have any idea how to deal with this stuff?

Thanks,
Duy

This topic was automatically closed after 30 days. New replies are no longer allowed.