Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1981#discussion_r63255457
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/table.scala
---
@@ -334,6 +335,156 @@ class Table(
* }}}
*/
def join(right: Table): Table = {
+ join(right, new Literal(true, TypeInformation.of(classOf[Boolean])),
JoinType.INNER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL join. The fields of the two
joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]].
+ *
+ * Example:
+ *
+ * {{{
+ * left.join(right, "a = b && c > 3")
+ * }}}
+ */
+ def join(right: Table, joinPredicate: String): Table = {
+ join(right, joinPredicate, JoinType.INNER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL join. The fields of the two
joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]].
+ *
+ * Example:
+ *
+ * {{{
+ * left.join(right, 'a === 'b && 'c > 3).select('a, 'b, 'd)
+ * }}}
+ */
+ def join(right: Table, joinPredicate: Expression): Table = {
+ join(right, joinPredicate, JoinType.INNER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL left outer join. The fields
of the two joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]] and
its [[TableConfig]] must
+ * have nullCheck enables.
+ *
+ * Example:
+ *
+ * {{{
+ * left.leftOuterJoin(right, "a = b && c > 3").select('a, 'b, 'd)
+ * }}}
+ */
+ def leftOuterJoin(right: Table, joinPredicate: String): Table = {
+ join(right, joinPredicate, JoinType.LEFT_OUTER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL left outer join. The fields
of the two joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]] and
its [[TableConfig]] must
+ * have nullCheck enables.
+ *
+ * Example:
+ *
+ * {{{
+ * left.leftOuterJoin(right, 'a === 'b && 'c > 3).select('a, 'b, 'd)
+ * }}}
+ */
+ def leftOuterJoin(right: Table, joinPredicate: Expression): Table = {
+ join(right, joinPredicate, JoinType.LEFT_OUTER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL right outer join. The fields
of the two joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]] and
its [[TableConfig]] must
+ * have nullCheck enables.
+ *
+ * Example:
+ *
+ * {{{
+ * left.rightOuterJoin(right, "a = b && c > 3").select('a, 'b, 'd)
+ * }}}
+ */
+ def rightOuterJoin(right: Table, joinPredicate: String): Table = {
+ join(right, joinPredicate, JoinType.RIGHT_OUTER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL right outer join. The fields
of the two joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]] and
its [[TableConfig]] must
+ * have nullCheck enables.
+ *
+ * Example:
+ *
+ * {{{
+ * left.rightOuterJoin(right, 'a === 'b && 'c > 3).select('a, 'b, 'd)
+ * }}}
+ */
+ def rightOuterJoin(right: Table, joinPredicate: Expression): Table = {
+ join(right, joinPredicate, JoinType.RIGHT_OUTER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL full outer join. The fields
of the two joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]] and
its [[TableConfig]] must
+ * have nullCheck enables.
+ *
+ * Example:
+ *
+ * {{{
+ * left.fullOuterJoin(right, "a = b && c > 3").select('a, 'b, 'd)
+ * }}}
+ */
+ def fullOuterJoin(right: Table, joinPredicate: String): Table = {
+ join(right, joinPredicate, JoinType.FULL_OUTER)
+ }
+
+ /**
+ * Joins two [[Table]]s. Similar to an SQL full outer join. The fields
of the two joined
+ * operations must not overlap, use [[as]] to rename fields if
necessary.
+ *
+ * Note: Both tables must be bound to the same [[TableEnvironment]] and
its [[TableConfig]] must
+ * have nullCheck enables.
+ *
+ * Example:
+ *
+ * {{{
+ * left.fullOuterJoin(right, 'a === 'b && 'c > 3).select('a, 'b, 'd)
+ * }}}
+ */
+ def fullOuterJoin(right: Table, joinPredicate: Expression): Table = {
+ join(right, joinPredicate, JoinType.FULL_OUTER)
+ }
+
+ private def flinkJoinTypeToCalcite(joinType: JoinType) = joinType match {
--- End diff --
I think you can also directly use Calcite's `JoinRelType` instead of
Flink's `JoinType`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---