You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by sn...@apache.org on 2023/09/11 20:07:39 UTC
[flink] branch release-1.18 updated: [FLINK-32999][connectors/hbase] Remove HBase connector code from main repo (#23343)
This is an automated email from the ASF dual-hosted git repository.
snuyanzin pushed a commit to branch release-1.18
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.18 by this push:
new 53981d81d37 [FLINK-32999][connectors/hbase] Remove HBase connector code from main repo (#23343)
53981d81d37 is described below
commit 53981d81d378770f8a1f87717c5d80b35e4010d7
Author: Ferenc Csaky <fe...@pm.me>
AuthorDate: Mon Sep 11 22:07:31 2023 +0200
[FLINK-32999][connectors/hbase] Remove HBase connector code from main repo (#23343)
---------
Co-authored-by: Sergey Nuyanzin <se...@aiven.io>
---
docs/content.zh/docs/connectors/table/hbase.md | 394 -----
docs/content/docs/connectors/table/hbase.md | 421 -----
docs/setup_docs.sh | 1 +
.../e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5 | 16 +-
.../f7a4e6fa-e7de-48c9-a61e-c13e83f0c72e | 107 +-
.../flink-architecture-tests-production/pom.xml | 15 -
flink-architecture-tests/pom.xml | 21 -
.../3ba92d3a-6609-4295-92ed-f2fe207ee2b3 | 0
.../ffbddcc3-857a-4af7-a6b5-fcf71e2cc191 | 0
.../archunit-violations/stored.rules | 4 -
flink-connectors/flink-connector-hbase-1.4/pom.xml | 413 -----
.../hbase1/HBase1DynamicTableFactory.java | 181 --
.../hbase1/sink/HBaseDynamicTableSink.java | 115 --
.../hbase1/source/AbstractTableInputFormat.java | 320 ----
.../hbase1/source/HBaseDynamicTableSource.java | 78 -
.../hbase1/source/HBaseRowDataInputFormat.java | 97 --
.../org.apache.flink.table.factories.Factory | 16 -
.../architecture/TestCodeArchitectureTest.java | 40 -
.../connector/hbase1/HBaseConnectorITCase.java | 504 ------
.../hbase1/HBaseDynamicTableFactoryTest.java | 397 -----
.../flink/connector/hbase1/HBaseTablePlanTest.java | 138 --
.../flink/connector/hbase1/util/HBaseTestBase.java | 270 ---
.../util/HBaseTestingClusterAutoStarter.java | 181 --
.../java/org/slf4j/impl/Log4jLoggerAdapter.java | 22 -
.../src/test/resources/archunit.properties | 31 -
.../src/test/resources/hbase-site.xml | 29 -
.../src/test/resources/log4j2-test.properties | 28 -
.../flink/connector/hbase1/HBaseTablePlanTest.xml | 36 -
.../346fff47-b126-4f8c-ba73-799d99856912 | 0
.../ac3990d6-8d39-4299-8765-3ae2f91d76af | 0
.../archunit-violations/stored.rules | 4 -
flink-connectors/flink-connector-hbase-2.2/pom.xml | 487 ------
.../hbase2/HBase2DynamicTableFactory.java | 183 --
.../hbase2/sink/HBaseDynamicTableSink.java | 116 --
.../hbase2/source/AbstractTableInputFormat.java | 318 ----
.../hbase2/source/HBaseDynamicTableSource.java | 126 --
.../source/HBaseRowDataAsyncLookupFunction.java | 223 ---
.../hbase2/source/HBaseRowDataInputFormat.java | 100 --
.../org.apache.flink.table.factories.Factory | 16 -
.../architecture/TestCodeArchitectureTest.java | 40 -
.../connector/hbase2/HBaseConnectorITCase.java | 558 ------
.../hbase2/HBaseDynamicTableFactoryTest.java | 426 -----
.../flink/connector/hbase2/HBaseTablePlanTest.java | 138 --
.../HBaseRowDataAsyncLookupFunctionTest.java | 111 --
.../flink/connector/hbase2/util/HBaseTestBase.java | 270 ---
.../util/HBaseTestingClusterAutoStarter.java | 160 --
.../java/org/slf4j/impl/Log4jLoggerAdapter.java | 22 -
.../src/test/resources/archunit.properties | 31 -
.../src/test/resources/hbase-site.xml | 29 -
.../src/test/resources/log4j2-test.properties | 28 -
.../flink/connector/hbase2/HBaseTablePlanTest.xml | 36 -
.../f8f77b71-7087-4b3f-88c5-29588fadcc52 | 0
.../fd028eab-0e49-4e91-9c40-477a55f378f2 | 0
.../archunit-violations/stored.rules | 4 -
.../flink-connector-hbase-base/pom.xml | 235 ---
.../connector/hbase/options/HBaseWriteOptions.java | 163 --
.../hbase/sink/HBaseMutationConverter.java | 45 -
.../connector/hbase/sink/HBaseSinkFunction.java | 259 ---
.../hbase/sink/RowDataToMutationConverter.java | 58 -
.../source/AbstractHBaseDynamicTableSource.java | 140 --
.../hbase/source/HBaseRowDataLookupFunction.java | 189 --
.../connector/hbase/source/TableInputSplit.java | 90 -
.../hbase/table/HBaseConnectorOptions.java | 126 --
.../hbase/table/HBaseConnectorOptionsUtil.java | 134 --
.../hbase/util/HBaseConfigurationUtil.java | 215 ---
.../flink/connector/hbase/util/HBaseSerde.java | 531 ------
.../util/HBaseStronglyIncreasingTsGenerator.java | 47 -
.../connector/hbase/util/HBaseTableSchema.java | 394 -----
.../flink/connector/hbase/util/HBaseTypeUtils.java | 229 ---
.../architecture/TestCodeArchitectureTest.java | 40 -
.../hbase/util/HBaseConfigLoadingTest.java | 174 --
.../flink/connector/hbase/util/HBaseSerdeTest.java | 166 --
.../HBaseStronglyIncreasingTsGeneratorTest.java | 44 -
.../org.junit.jupiter.api.extension.Extension | 16 -
.../src/test/resources/archunit.properties | 31 -
.../src/test/resources/hbase-site.xml | 29 -
.../src/test/resources/log4j2-test.properties | 28 -
.../flink-sql-connector-hbase-1.4/pom.xml | 166 --
.../src/main/resources/META-INF/NOTICE | 31 -
.../resources/META-INF/licenses/LICENSE.protobuf | 32 -
.../src/main/resources/hbase-default.xml | 1558 -----------------
.../flink-sql-connector-hbase-2.2/pom.xml | 170 --
.../src/main/resources/META-INF/NOTICE | 62 -
.../resources/META-INF/licenses/LICENSE.protobuf | 32 -
.../src/main/resources/hbase-default.xml | 1817 --------------------
flink-connectors/pom.xml | 5 -
.../flink-end-to-end-tests-hbase/pom.xml | 264 ---
.../flink/tests/util/hbase/HBaseResource.java | 79 -
.../tests/util/hbase/HBaseResourceFactory.java | 37 -
.../util/hbase/LocalStandaloneHBaseResource.java | 246 ---
.../hbase/LocalStandaloneHBaseResourceFactory.java | 28 -
.../tests/util/hbase/SQLClientHBaseITCase.java | 243 ---
.../src/test/resources/hbase_e2e.sql | 56 -
.../src/test/resources/log4j2-test.properties | 28 -
flink-end-to-end-tests/pom.xml | 1 -
...modules-defining-excess-dependencies.modulelist | 2 -
tools/ci/stage.sh | 5 -
97 files changed, 23 insertions(+), 15523 deletions(-)
diff --git a/docs/content.zh/docs/connectors/table/hbase.md b/docs/content.zh/docs/connectors/table/hbase.md
deleted file mode 100644
index a3f80468a4b..00000000000
--- a/docs/content.zh/docs/connectors/table/hbase.md
+++ /dev/null
@@ -1,394 +0,0 @@
----
-title: HBase
-weight: 9
-type: docs
-aliases:
- - /zh/dev/table/connectors/hbase.html
----
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-# HBase SQL 连接器
-
-{{< label "Scan Source: Bounded" >}}
-{{< label "Lookup Source: Sync Mode" >}}
-{{< label "Sink: Batch" >}}
-{{< label "Sink: Streaming Upsert Mode" >}}
-
-HBase 连接器支持读取和写入 HBase 集群。本文档介绍如何使用 HBase 连接器基于 HBase 进行 SQL 查询。
-
-HBase 连接器在 upsert 模式下运行,可以使用 DDL 中定义的主键与外部系统交换更新操作消息。但是主键只能基于 HBase 的 rowkey 字段定义。如果没有声明主键,HBase 连接器默认取 rowkey 作为主键。
-
-依赖
-------------
-
-{{< sql_download_table "hbase" >}}
-
-HBase 连接器不是二进制发行版的一部分,请查阅[这里]({{< ref "docs/dev/configuration/overview" >}})了解如何在集群运行中引用 HBase 连接器。
-
-如何使用 HBase 表
-----------------
-
-所有 HBase 表的列簇必须定义为 ROW 类型,字段名对应列簇名(column family),嵌套的字段名对应列限定符名(column qualifier)。用户只需在表结构中声明查询中使用的的列簇和列限定符。除了 ROW 类型的列,剩下的原子数据类型字段(比如,STRING, BIGINT)将被识别为 HBase 的 rowkey,一张表中只能声明一个 rowkey。rowkey 字段的名字可以是任意的,如果是保留关键字,需要用反引号。
-
-```sql
--- 在 Flink SQL 中注册 HBase 表 "mytable"
-CREATE TABLE hTable (
- rowkey INT,
- family1 ROW<q1 INT>,
- family2 ROW<q2 STRING, q3 BIGINT>,
- family3 ROW<q4 DOUBLE, q5 BOOLEAN, q6 STRING>,
- PRIMARY KEY (rowkey) NOT ENFORCED
-) WITH (
- 'connector' = 'hbase-1.4',
- 'table-name' = 'mytable',
- 'zookeeper.quorum' = 'localhost:2181'
-);
-
--- 用 ROW(...) 构造函数构造列簇,并往 HBase 表写数据。
--- 假设 "T" 的表结构是 [rowkey, f1q1, f2q2, f2q3, f3q4, f3q5, f3q6]
-INSERT INTO hTable
-SELECT rowkey, ROW(f1q1), ROW(f2q2, f2q3), ROW(f3q4, f3q5, f3q6) FROM T;
-
--- 从 HBase 表扫描数据
-SELECT rowkey, family1, family3.q4, family3.q6 FROM hTable;
-
--- temporal join HBase 表,将 HBase 表作为维表
-SELECT * FROM myTopic
-LEFT JOIN hTable FOR SYSTEM_TIME AS OF myTopic.proctime
-ON myTopic.key = hTable.rowkey;
-```
-
-连接器参数
-----------------
-
-<table class="table table-bordered">
- <thead>
- <tr>
- <th class="text-left" style="width: 25%">参数</th>
- <th class="text-center" style="width: 10%">是否必选</th>
- <th class="text-center" style="width: 10%">默认值</th>
- <th class="text-center" style="width: 10%">数据类型</th>
- <th class="text-center" style="width: 45%">描述</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><h5>connector</h5></td>
- <td>必选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>指定使用的连接器, 支持的值如下 :
- <ul>
- <li><code>hbase-1.4</code>: 连接 HBase 1.4.x 集群</li>
- <li><code>hbase-2.2</code>: 连接 HBase 2.2.x 集群</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><h5>table-name</h5></td>
- <td>必选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>连接的 HBase 表名。默认该表在 "default" 命名空间下,指定命名空间下的表需要使用 "namespace:table"。</td>
- </tr>
- <tr>
- <td><h5>zookeeper.quorum</h5></td>
- <td>必选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>HBase Zookeeper quorum 信息。</td>
- </tr>
- <tr>
- <td><h5>zookeeper.znode.parent</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">/hbase</td>
- <td>String</td>
- <td>HBase 集群的 Zookeeper 根目录。</td>
- </tr>
- <tr>
- <td><h5>null-string-literal</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">null</td>
- <td>String</td>
- <td>当字符串值为 <code>null</code> 时的存储形式,默认存成 "null" 字符串。HBase 的 source 和 sink 的编解码将所有数据类型(除字符串外)将 <code>null</code> 值以空字节来存储。</td>
- </tr>
- <tr>
- <td><h5>sink.buffer-flush.max-size</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">2mb</td>
- <td>MemorySize</td>
- <td>写入的参数选项。每次写入请求缓存行的最大大小。它能提升写入 HBase 数据库的性能,但是也可能增加延迟。设置为 "0" 关闭此选项。
- </td>
- </tr>
- <tr>
- <td><h5>sink.buffer-flush.max-rows</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">1000</td>
- <td>Integer</td>
- <td>写入的参数选项。 每次写入请求缓存的最大行数。它能提升写入 HBase 数据库的性能,但是也可能增加延迟。设置为 "0" 关闭此选项。
- </td>
- </tr>
- <tr>
- <td><h5>sink.buffer-flush.interval</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">1s</td>
- <td>Duration</td>
- <td>写入的参数选项。刷写缓存行的间隔。它能提升写入 HBase 数据库的性能,但是也可能增加延迟。设置为 "0" 关闭此选项。注意:"sink.buffer-flush.max-size" 和 "sink.buffer-flush.max-rows" 同时设置为 "0",刷写选项整个异步处理缓存行为。
- </td>
- </tr>
- <tr>
- <td><h5>sink.parallelism</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Integer</td>
- <td>为 HBase sink operator 定义并行度。默认情况下,并行度由框架决定,和链在一起的上游 operator 一样。</td>
- </tr>
- <tr>
- <td><h5>lookup.async</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">false</td>
- <td>Boolean</td>
- <td>是否启用异步查找。如果为真,查找将是异步的。注意:异步方式只支持 hbase-2.2 连接器</td>
- </tr>
- <tr>
- <td><h5>lookup.cache</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">NONE</td>
- <td><p>枚举类型</p>可选值: NONE, PARTIAL</td>
- <td>维表的缓存策略。 目前支持 NONE(不缓存)和 PARTIAL(只在外部数据库中查找数据时缓存)。</td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.max-rows</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Long</td>
- <td>查找缓存的最大行数,超过这个值,最旧的行将过期。使用该配置时 "lookup.cache" 必须设置为 "PARTIAL”。</td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.expire-after-write</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Duration</td>
- <td>在记录写入缓存后该记录的最大保留时间。
- 使用该配置时 "lookup.cache" 必须设置为 "PARTIAL”。</td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.expire-after-access</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Duration</td>
- <td>在缓存中的记录被访问后该记录的最大保留时间。
- 使用该配置时 "lookup.cache" 必须设置为 "PARTIAL”。</td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.cache-missing-key</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">true</td>
- <td>Boolean</td>
- <td>是否缓存维表中不存在的键,默认为true。
- 使用该配置时 "lookup.cache" 必须设置为 "PARTIAL”。</td>
- </tr>
- <tr>
- <td><h5>lookup.max-retries</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">3</td>
- <td>Integer</td>
- <td>查找数据库失败时的最大重试次数。</td>
- </tr>
- <tr>
- <td><h5>properties.*</h5></td>
- <td>可选</td>
- <td style="word-wrap: break-word;">(无)</td>
- <td>String</td>
- <td>
- 可以设置任意 HBase 的配置项。后缀名必须匹配在 <a href="http://hbase.apache.org/2.3/book.html#hbase_default_configurations">HBase 配置文档</a> 中定义的配置键。Flink 将移除 "properties." 配置键前缀并将变换后的配置键和值传入底层的 HBase 客户端。
- 例如您可以设置 <code>'properties.hbase.security.authentication' = 'kerberos'</code> 等kerberos认证参数。
- </td>
- </tr>
- </tbody>
-</table>
-
-### 已弃用的配置
-这些弃用配置已经被上述的新配置代替,而且最终会被弃用。请优先考虑使用新配置。
-<table>
- <thead>
- <tr>
- <th class="text-left" style="width: 25%">Option</th>
- <th class="text-left" style="width: 8%">Required</th>
- <th class="text-left" style="width: 8%">Forwarded</th>
- <th class="text-left" style="width: 7%">Default</th>
- <th class="text-left" style="width: 10%">Type</th>
- <th class="text-left" style="width: 42%">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><h5>lookup.cache.max-rows</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Integer</td>
- <td>请配置 "lookup.cache" = "PARTIAL" 并使用 "lookup.partial-cache.max-rows" 代替</td>
- </tr>
- <tr>
- <td><h5>lookup.cache.ttl</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Duration</td>
- <td>请配置 "lookup.cache" = "PARTIAL" 并使用 "lookup.partial-cache.expire-after-write" 代替</td>
- </tr>
- </tbody>
-<table>
-
-
-
-数据类型映射表
-----------------
-
-HBase 以字节数组存储所有数据。在读和写过程中要序列化和反序列化数据。
-
-Flink 的 HBase 连接器利用 HBase(Hadoop) 的工具类 `org.apache.hadoop.hbase.util.Bytes` 进行字节数组和 Flink 数据类型转换。
-
-Flink 的 HBase 连接器将所有数据类型(除字符串外)`null` 值编码成空字节。对于字符串类型,`null` 值的字面值由`null-string-literal`选项值决定。
-
-数据类型映射表如下:
-
-<table class="table table-bordered">
- <thead>
- <tr>
- <th class="text-left">Flink 数据类型</th>
- <th class="text-left">HBase 转换</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>CHAR / VARCHAR / STRING</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(String s)
-String toString(byte[] b)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>BOOLEAN</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(boolean b)
-boolean toBoolean(byte[] b)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>BINARY / VARBINARY</code></td>
- <td>返回 <code>byte[]</code>。</td>
- </tr>
- <tr>
- <td><code>DECIMAL</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(BigDecimal v)
-BigDecimal toBigDecimal(byte[] b)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>TINYINT</code></td>
- <td>
-{{< highlight "java" >}}
-new byte[] { val }
-bytes[0] // returns first and only byte from bytes
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>SMALLINT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(short val)
-short toShort(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>INT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(int val)
-int toInt(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>BIGINT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(long val)
-long toLong(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>FLOAT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(float val)
-float toFloat(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>DOUBLE</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(double val)
-double toDouble(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>DATE</code></td>
- <td>从 1970-01-01 00:00:00 UTC 开始的天数,int 值。</td>
- </tr>
- <tr>
- <td><code>TIME</code></td>
- <td>从 1970-01-01 00:00:00 UTC 开始天的毫秒数,int 值。</td>
- </tr>
- <tr>
- <td><code>TIMESTAMP</code></td>
- <td>从 1970-01-01 00:00:00 UTC 开始的毫秒数,long 值。</td>
- </tr>
- <tr>
- <td><code>ARRAY</code></td>
- <td>不支持</td>
- </tr>
- <tr>
- <td><code>MAP / MULTISET</code></td>
- <td>不支持</td>
- </tr>
- <tr>
- <td><code>ROW</code></td>
- <td>不支持</td>
- </tr>
- </tbody>
-</table>
-
-{{< top >}}
diff --git a/docs/content/docs/connectors/table/hbase.md b/docs/content/docs/connectors/table/hbase.md
deleted file mode 100644
index 4c2b37b5f53..00000000000
--- a/docs/content/docs/connectors/table/hbase.md
+++ /dev/null
@@ -1,421 +0,0 @@
----
-title: HBase
-weight: 9
-type: docs
-aliases:
- - /dev/table/connectors/hbase.html
----
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-# HBase SQL Connector
-
-{{< label "Scan Source: Bounded" >}}
-{{< label "Lookup Source: Sync Mode" >}}
-{{< label "Sink: Batch" >}}
-{{< label "Sink: Streaming Upsert Mode" >}}
-
-The HBase connector allows for reading from and writing to an HBase cluster. This document describes how to setup the HBase Connector to run SQL queries against HBase.
-
-HBase always works in upsert mode for exchange changelog messages with the external system using a primary key defined on the DDL. The primary key must be defined on the HBase rowkey field (rowkey field must be declared). If the PRIMARY KEY clause is not declared, the HBase connector will take rowkey as the primary key by default.
-
-Dependencies
-------------
-
-{{< sql_download_table "hbase" >}}
-
-The HBase connector is not part of the binary distribution.
-See how to link with it for cluster execution [here]({{< ref "docs/dev/configuration/overview" >}}).
-
-
-How to use HBase table
-----------------
-
-All the column families in HBase table must be declared as ROW type, the field name maps to the column family name, and the nested field names map to the column qualifier names. There is no need to declare all the families and qualifiers in the schema, users can declare what’s used in the query. Except the ROW type fields, the single atomic type field (e.g. STRING, BIGINT) will be recognized as HBase rowkey. The rowkey field can be arbitrary name, but should be quoted using backticks if [...]
-
-```sql
--- register the HBase table 'mytable' in Flink SQL
-CREATE TABLE hTable (
- rowkey INT,
- family1 ROW<q1 INT>,
- family2 ROW<q2 STRING, q3 BIGINT>,
- family3 ROW<q4 DOUBLE, q5 BOOLEAN, q6 STRING>,
- PRIMARY KEY (rowkey) NOT ENFORCED
-) WITH (
- 'connector' = 'hbase-1.4',
- 'table-name' = 'mytable',
- 'zookeeper.quorum' = 'localhost:2181'
-);
-
--- use ROW(...) construction function construct column families and write data into the HBase table.
--- assuming the schema of "T" is [rowkey, f1q1, f2q2, f2q3, f3q4, f3q5, f3q6]
-INSERT INTO hTable
-SELECT rowkey, ROW(f1q1), ROW(f2q2, f2q3), ROW(f3q4, f3q5, f3q6) FROM T;
-
--- scan data from the HBase table
-SELECT rowkey, family1, family3.q4, family3.q6 FROM hTable;
-
--- temporal join the HBase table as a dimension table
-SELECT * FROM myTopic
-LEFT JOIN hTable FOR SYSTEM_TIME AS OF myTopic.proctime
-ON myTopic.key = hTable.rowkey;
-```
-
-Connector Options
-----------------
-
-<table class="table table-bordered">
- <thead>
- <tr>
- <th class="text-left" style="width: 25%">Option</th>
- <th class="text-center" style="width: 8%">Required</th>
- <th class="text-center" style="width: 8%">Forwarded</th>
- <th class="text-center" style="width: 7%">Default</th>
- <th class="text-center" style="width: 10%">Type</th>
- <th class="text-center" style="width: 42%">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><h5>connector</h5></td>
- <td>required</td>
- <td>no</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>Specify what connector to use, valid values are:
- <ul>
- <li><code>hbase-1.4</code>: connect to HBase 1.4.x cluster</li>
- <li><code>hbase-2.2</code>: connect to HBase 2.2.x cluster</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><h5>table-name</h5></td>
- <td>required</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>The name of HBase table to connect. By default, the table is in 'default' namespace. To assign the table a specified namespace you need to use 'namespace:table'.</td>
- </tr>
- <tr>
- <td><h5>zookeeper.quorum</h5></td>
- <td>required</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>The HBase Zookeeper quorum.</td>
- </tr>
- <tr>
- <td><h5>zookeeper.znode.parent</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">/hbase</td>
- <td>String</td>
- <td>The root dir in Zookeeper for HBase cluster.</td>
- </tr>
- <tr>
- <td><h5>null-string-literal</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">null</td>
- <td>String</td>
- <td>Representation for null values for string fields. HBase source and sink encodes/decodes empty bytes as null values for all types except string type.</td>
- </tr>
- <tr>
- <td><h5>sink.buffer-flush.max-size</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">2mb</td>
- <td>MemorySize</td>
- <td>Writing option, maximum size in memory of buffered rows for each writing request.
- This can improve performance for writing data to HBase database, but may increase the latency.
- Can be set to <code>'0'</code> to disable it.
- </td>
- </tr>
- <tr>
- <td><h5>sink.buffer-flush.max-rows</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">1000</td>
- <td>Integer</td>
- <td>Writing option, maximum number of rows to buffer for each writing request.
- This can improve performance for writing data to HBase database, but may increase the latency.
- Can be set to <code>'0'</code> to disable it.
- </td>
- </tr>
- <tr>
- <td><h5>sink.buffer-flush.interval</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">1s</td>
- <td>Duration</td>
- <td>Writing option, the interval to flush any buffered rows.
- This can improve performance for writing data to HBase database, but may increase the latency.
- Can be set to <code>'0'</code> to disable it. Note, both <code>'sink.buffer-flush.max-size'</code> and <code>'sink.buffer-flush.max-rows'</code>
- can be set to <code>'0'</code> with the flush interval set allowing for complete async processing of buffered actions.
- </td>
- </tr>
- <tr>
- <td><h5>sink.parallelism</h5></td>
- <td>optional</td>
- <td>no</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Integer</td>
- <td>Defines the parallelism of the HBase sink operator. By default, the parallelism is determined by the framework using the same parallelism of the upstream chained operator.</td>
- </tr>
- <tr>
- <td><h5>lookup.async</h5></td>
- <td>optional</td>
- <td>no</td>
- <td style="word-wrap: break-word;">false</td>
- <td>Boolean</td>
- <td>Whether async lookup are enabled. If true, the lookup will be async. Note, async only supports hbase-2.2 connector.</td>
- </tr>
- <tr>
- <td><h5>lookup.cache</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">NONE</td>
- <td><p>Enum</p>Possible values: NONE, PARTIAL</td>
- <td>The cache strategy for the lookup table. Currently supports NONE (no caching) and PARTIAL (caching entries on lookup operation in external database).</td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.max-rows</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Long</td>
- <td>The max number of rows of lookup cache, over this value, the oldest rows will be expired.
- "lookup.cache" must be set to "PARTIAL" to use this option.</td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.expire-after-write</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Duration</td>
- <td>The max time to live for each rows in lookup cache after writing into the cache
- "lookup.cache" must be set to "PARTIAL" to use this option. </td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.expire-after-access</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Duration</td>
- <td>The max time to live for each rows in lookup cache after accessing the entry in the cache.
- "lookup.cache" must be set to "PARTIAL" to use this option. </td>
- </tr>
- <tr>
- <td><h5>lookup.partial-cache.cache-missing-key</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">true</td>
- <td>Boolean</td>
- <td>Whether to store an empty value into the cache if the lookup key doesn't match any rows in the table.
- "lookup.cache" must be set to "PARTIAL" to use this option.</td>
- </tr>
- <tr>
- <td><h5>lookup.max-retries</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">3</td>
- <td>Integer</td>
- <td>The max retry times if lookup database failed.</td>
- </tr>
- <tr>
- <td><h5>properties.*</h5></td>
- <td>optional</td>
- <td>no</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>String</td>
- <td>
- This can set and pass arbitrary HBase configurations. Suffix names must match the configuration key defined in <a href="http://hbase.apache.org/2.3/book.html#hbase_default_configurations">HBase Configuration documentation</a>. Flink will remove the "properties." key prefix and pass the transformed key and values to the underlying HBaseClient. For example, you can add a kerberos authentication parameter <code>'properties.hbase.security.authentication' = 'kerberos'</code>.
- </td>
- </tr>
- </tbody>
-</table>
-
-### Deprecated Options
-These deprecated options has been replaced by new options listed above and will be removed eventually. Please consider using new options first.
-<table>
- <thead>
- <tr>
- <th class="text-left" style="width: 25%">Option</th>
- <th class="text-left" style="width: 8%">Required</th>
- <th class="text-left" style="width: 8%">Forwarded</th>
- <th class="text-left" style="width: 7%">Default</th>
- <th class="text-left" style="width: 10%">Type</th>
- <th class="text-left" style="width: 42%">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><h5>lookup.cache.max-rows</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Integer</td>
- <td>Please set "lookup.cache" = "PARTIAL" and use "lookup.partial-cache.max-rows" instead.</td>
- </tr>
- <tr>
- <td><h5>lookup.cache.ttl</h5></td>
- <td>optional</td>
- <td>yes</td>
- <td style="word-wrap: break-word;">(none)</td>
- <td>Duration</td>
- <td>Please set "lookup.cache" = "PARTIAL" and use "lookup.partial-cache.expire-after-write" instead.</td>
- </tr>
- </tbody>
-<table>
-
-
-
-Data Type Mapping
-----------------
-
-HBase stores all data as byte arrays. The data needs to be serialized and deserialized during read and write operation
-
-When serializing and de-serializing, Flink HBase connector uses utility class `org.apache.hadoop.hbase.util.Bytes` provided by HBase (Hadoop) to convert Flink Data Types to and from byte arrays.
-
-Flink HBase connector encodes `null` values to empty bytes, and decode empty bytes to `null` values for all data types except string type. For string type, the null literal is determined by `null-string-literal` option.
-
-The data type mappings are as follows:
-
-<table class="table table-bordered">
- <thead>
- <tr>
- <th class="text-left">Flink SQL type</th>
- <th class="text-left">HBase conversion</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>CHAR / VARCHAR / STRING</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(String s)
-String toString(byte[] b)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>BOOLEAN</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(boolean b)
-boolean toBoolean(byte[] b)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>BINARY / VARBINARY</code></td>
- <td>Returns <code>byte[]</code> as is.</td>
- </tr>
- <tr>
- <td><code>DECIMAL</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(BigDecimal v)
-BigDecimal toBigDecimal(byte[] b)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>TINYINT</code></td>
- <td>
-{{< highlight "java" >}}
-new byte[] { val }
-bytes[0] // returns first and only byte from bytes
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>SMALLINT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(short val)
-short toShort(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>INT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(int val)
-int toInt(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>BIGINT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(long val)
-long toLong(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>FLOAT</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(float val)
-float toFloat(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>DOUBLE</code></td>
- <td>
-{{< highlight "java" >}}
-byte[] toBytes(double val)
-double toDouble(byte[] bytes)
-{{< /highlight >}}
- </td>
- </tr>
- <tr>
- <td><code>DATE</code></td>
- <td>Stores the number of days since epoch as int value.</td>
- </tr>
- <tr>
- <td><code>TIME</code></td>
- <td>Stores the number of milliseconds of the day as int value.</td>
- </tr>
- <tr>
- <td><code>TIMESTAMP</code></td>
- <td>Stores the milliseconds since epoch as long value.</td>
- </tr>
- <tr>
- <td><code>ARRAY</code></td>
- <td>Not supported</td>
- </tr>
- <tr>
- <td><code>MAP / MULTISET</code></td>
- <td>Not supported</td>
- </tr>
- <tr>
- <td><code>ROW</code></td>
- <td>Not supported</td>
- </tr>
- </tbody>
-</table>
-
-{{< top >}}
diff --git a/docs/setup_docs.sh b/docs/setup_docs.sh
index 2e11ed8a8f7..11302bb489a 100755
--- a/docs/setup_docs.sh
+++ b/docs/setup_docs.sh
@@ -53,6 +53,7 @@ integrate_connector_docs gcp-pubsub v3.0
integrate_connector_docs mongodb v1.0
integrate_connector_docs opensearch v1.0
integrate_connector_docs kafka v3.0
+integrate_connector_docs hbase v3.0
cd ..
rm -rf tmp
diff --git a/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5 b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
index d58a98f436c..3b8c1531bbc 100644
--- a/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
+++ b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
@@ -7,8 +7,8 @@ Method <org.apache.flink.runtime.blob.BlobInputStream.read()> calls method <org.
Method <org.apache.flink.runtime.blob.BlobInputStream.read([B, int, int)> calls method <org.apache.flink.runtime.blob.BlobKey.getHash()> in (BlobInputStream.java:163)
Method <org.apache.flink.runtime.blob.BlobOutputStream.receiveAndCheckPutResponse(java.io.InputStream, java.security.MessageDigest, org.apache.flink.runtime.blob.BlobKey$BlobType)> calls method <org.apache.flink.runtime.blob.BlobKey.getHash()> in (BlobOutputStream.java:155)
Method <org.apache.flink.runtime.blob.BlobUtils.checkAndDeleteCorruptedBlobs(java.nio.file.Path, org.slf4j.Logger)> calls method <org.apache.flink.runtime.blob.BlobKey.getHash()> in (BlobUtils.java:514)
-Method <org.apache.flink.runtime.blob.FileSystemBlobStore.get(java.lang.String, java.io.File, org.apache.flink.runtime.blob.BlobKey)> calls method <org.apache.flink.runtime.blob.BlobKey.getHash()> in (FileSystemBlobStore.java:133)
-Method <org.apache.flink.runtime.executiongraph.Execution.finishPartitionsAndUpdateConsumers()> calls method <org.apache.flink.runtime.executiongraph.ExecutionVertex.finishPartitionsIfNeeded()> in (Execution.java:981)
+Method <org.apache.flink.runtime.blob.FileSystemBlobStore.get(java.lang.String, java.io.File, org.apache.flink.runtime.blob.BlobKey)> calls method <org.apache.flink.runtime.blob.BlobKey.getHash()> in (FileSystemBlobStore.java:129)
+Method <org.apache.flink.runtime.executiongraph.Execution.finishPartitionsAndUpdateConsumers()> calls method <org.apache.flink.runtime.executiongraph.ExecutionVertex.finishPartitionsIfNeeded()> in (Execution.java:985)
Method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedHaServicesWithLeadershipControl.grantDispatcherLeadership()> calls method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedLeaderService.grantLeadership()> in (EmbeddedHaServicesWithLeadershipControl.java:83)
Method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedHaServicesWithLeadershipControl.grantJobMasterLeadership(org.apache.flink.api.common.JobID)> calls method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedLeaderService.grantLeadership()> in (EmbeddedHaServicesWithLeadershipControl.java:95)
Method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedHaServicesWithLeadershipControl.grantResourceManagerLeadership()> calls method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedLeaderService.grantLeadership()> in (EmbeddedHaServicesWithLeadershipControl.java:109)
@@ -16,12 +16,12 @@ Method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedHaServi
Method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedHaServicesWithLeadershipControl.revokeJobMasterLeadership(org.apache.flink.api.common.JobID)> calls method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedLeaderService.revokeLeadership()> in (EmbeddedHaServicesWithLeadershipControl.java:89)
Method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedHaServicesWithLeadershipControl.revokeResourceManagerLeadership()> calls method <org.apache.flink.runtime.highavailability.nonha.embedded.EmbeddedLeaderService.revokeLeadership()> in (EmbeddedHaServicesWithLeadershipControl.java:102)
Method <org.apache.flink.runtime.io.network.partition.ResourceManagerPartitionTrackerImpl.listDataSets()> calls method <org.apache.flink.runtime.io.network.partition.DataSetMetaInfo.withNumRegisteredPartitions(int, int)> in (ResourceManagerPartitionTrackerImpl.java:286)
-Method <org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator$DeferrableCoordinator.closeAsync(long)> calls method <org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator$QuiesceableContext.quiesce()> in (RecreateOnResetOperatorCoordinator.java:349)
+Method <org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator$DeferrableCoordinator.closeAsync(long)> calls method <org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator$QuiesceableContext.quiesce()> in (RecreateOnResetOperatorCoordinator.java:354)
Method <org.apache.flink.runtime.taskexecutor.TaskManagerConfiguration.fromConfiguration(org.apache.flink.configuration.Configuration, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, java.lang.String, java.io.File)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateDefaultSlotResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, int)> in (TaskManagerConfiguration.java:244)
Method <org.apache.flink.runtime.taskexecutor.TaskManagerConfiguration.fromConfiguration(org.apache.flink.configuration.Configuration, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, java.lang.String, java.io.File)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateTotalAvailableResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec)> in (TaskManagerConfiguration.java:246)
-Method <org.apache.flink.runtime.taskexecutor.TaskManagerServices.createTaskSlotTable(int, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, long, int, java.util.concurrent.Executor)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateDefaultSlotResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, int)> in (TaskManagerServices.java:417)
-Method <org.apache.flink.runtime.taskexecutor.TaskManagerServices.createTaskSlotTable(int, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, long, int, java.util.concurrent.Executor)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateTotalAvailableResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec)> in (TaskManagerServices.java:415)
-Method <org.apache.flink.streaming.api.operators.SourceOperator$1$1.asClassLoader()> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getRuntimeContext()> in (SourceOperator.java:293)
-Method <org.apache.flink.streaming.api.operators.SourceOperator$1$1.registerReleaseHookIfAbsent(java.lang.String, java.lang.Runnable)> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getRuntimeContext()> in (SourceOperator.java:299)
+Method <org.apache.flink.runtime.taskexecutor.TaskManagerServices.createTaskSlotTable(int, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, long, int, java.util.concurrent.Executor)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateDefaultSlotResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, int)> in (TaskManagerServices.java:429)
+Method <org.apache.flink.runtime.taskexecutor.TaskManagerServices.createTaskSlotTable(int, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, long, int, java.util.concurrent.Executor)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateTotalAvailableResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec)> in (TaskManagerServices.java:427)
+Method <org.apache.flink.streaming.api.operators.SourceOperator$1$1.asClassLoader()> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getRuntimeContext()> in (SourceOperator.java:295)
+Method <org.apache.flink.streaming.api.operators.SourceOperator$1$1.registerReleaseHookIfAbsent(java.lang.String, java.lang.Runnable)> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getRuntimeContext()> in (SourceOperator.java:301)
Method <org.apache.flink.streaming.runtime.tasks.SourceOperatorStreamTask.init()> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getSourceReader()> in (SourceOperatorStreamTask.java:95)
-Method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxExecutorImpl.isIdle()> calls method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.isDefaultActionAvailable()> in (MailboxExecutorImpl.java:63)
+Method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxExecutorImpl.isIdle()> calls method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.isDefaultActionAvailable()> in (MailboxExecutorImpl.java:63)
\ No newline at end of file
diff --git a/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/f7a4e6fa-e7de-48c9-a61e-c13e83f0c72e b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/f7a4e6fa-e7de-48c9-a61e-c13e83f0c72e
index 7adf22ac9f3..c4bf362a8ea 100644
--- a/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/f7a4e6fa-e7de-48c9-a61e-c13e83f0c72e
+++ b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/f7a4e6fa-e7de-48c9-a61e-c13e83f0c72e
@@ -197,9 +197,9 @@ Constructor <org.apache.flink.connector.file.table.ColumnarRowIterator.<init>(or
Constructor <org.apache.flink.connector.file.table.FileSystemOutputFormat$Builder.<init>()> calls constructor <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig.<init>(java.lang.String, java.lang.String)> in (FileSystemOutputFormat.java:216)
Constructor <org.apache.flink.connector.file.table.FileSystemOutputFormat.<init>(org.apache.flink.connector.file.table.FileSystemFactory, org.apache.flink.connector.file.table.TableMetaStoreFactory, boolean, boolean, org.apache.flink.core.fs.Path, [Ljava.lang.String;, boolean, java.util.LinkedHashMap, org.apache.flink.connector.file.table.OutputFormatFactory, org.apache.flink.connector.file.table.PartitionComputer, org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig [...]
Constructor <org.apache.flink.connector.file.table.FileSystemOutputFormat.<init>(org.apache.flink.connector.file.table.FileSystemFactory, org.apache.flink.connector.file.table.TableMetaStoreFactory, boolean, boolean, org.apache.flink.core.fs.Path, [Ljava.lang.String;, boolean, java.util.LinkedHashMap, org.apache.flink.connector.file.table.OutputFormatFactory, org.apache.flink.connector.file.table.PartitionComputer, org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig [...]
-Constructor <org.apache.flink.connector.file.table.FileSystemTableSink$TableRollingPolicy.<init>(boolean, long, long, long)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (FileSystemTableSink.java:576)
-Constructor <org.apache.flink.connector.file.table.FileSystemTableSink$TableRollingPolicy.<init>(boolean, long, long, long)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (FileSystemTableSink.java:577)
-Constructor <org.apache.flink.connector.file.table.FileSystemTableSink$TableRollingPolicy.<init>(boolean, long, long, long)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (FileSystemTableSink.java:578)
+Constructor <org.apache.flink.connector.file.table.FileSystemTableSink$TableRollingPolicy.<init>(boolean, long, long, long)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (FileSystemTableSink.java:593)
+Constructor <org.apache.flink.connector.file.table.FileSystemTableSink$TableRollingPolicy.<init>(boolean, long, long, long)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (FileSystemTableSink.java:594)
+Constructor <org.apache.flink.connector.file.table.FileSystemTableSink$TableRollingPolicy.<init>(boolean, long, long, long)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (FileSystemTableSink.java:595)
Constructor <org.apache.flink.connector.file.table.PartitionTempFileManager.<init>(org.apache.flink.connector.file.table.FileSystemFactory, org.apache.flink.core.fs.Path, int, int)> calls constructor <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig.<init>(java.lang.String, java.lang.String)> in (PartitionTempFileManager.java:71)
Constructor <org.apache.flink.connector.file.table.PartitionTempFileManager.<init>(org.apache.flink.connector.file.table.FileSystemFactory, org.apache.flink.core.fs.Path, int, int, org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig)> has parameter of type <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig> in (PartitionTempFileManager.java:0)
Constructor <org.apache.flink.connector.file.table.RowDataPartitionComputer.<init>(java.lang.String, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;)> has parameter of type <[Lorg.apache.flink.table.types.DataType;> in (RowDataPartitionComputer.java:0)
@@ -268,7 +268,6 @@ Field <org.apache.flink.connector.file.table.stream.compact.CompactBucketWriter$
Field <org.apache.flink.connector.file.table.stream.compact.CompactBucketWriter$Factory.factory> has generic type <org.apache.flink.util.function.SupplierWithException<org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter<T, java.lang.String>, java.io.IOException>> with type argument depending on <org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter> in (CompactBucketWriter.java:0)
Field <org.apache.flink.connector.file.table.stream.compact.CompactBucketWriter.bucketWriter> has type <org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter> in (CompactBucketWriter.java:0)
Field <org.apache.flink.connector.file.table.stream.compact.CompactBucketWriter.writer> has type <org.apache.flink.streaming.api.functions.sink.filesystem.InProgressFileWriter> in (CompactBucketWriter.java:0)
-Field <org.apache.flink.connector.hbase.util.HBaseSerde.reusedFamilyRows> has type <[Lorg.apache.flink.table.data.GenericRowData;> in (HBaseSerde.java:0)
Field <org.apache.flink.connector.print.table.PrintTableSinkFactory$RowDataPrintFunction.writer> has type <org.apache.flink.api.common.functions.util.PrintSinkOutputWriter> in (PrintTableSinkFactory.java:0)
Method <org.apache.flink.connector.base.sink.throwable.FatalExceptionClassifier.withRootCauseOfType(java.lang.Class, java.util.function.Function)> calls method <org.apache.flink.util.ExceptionUtils.findThrowable(java.lang.Throwable, java.lang.Class)> in (FatalExceptionClassifier.java:60)
Method <org.apache.flink.connector.base.source.hybrid.HybridSource$HybridSourceBuilder.addSource(org.apache.flink.connector.base.source.hybrid.HybridSource$SourceFactory, org.apache.flink.api.connector.source.Boundedness)> calls method <org.apache.flink.api.java.ClosureCleaner.clean(java.lang.Object, org.apache.flink.api.common.ExecutionConfig$ClosureCleanerLevel, boolean)> in (HybridSource.java:246)
@@ -436,7 +435,7 @@ Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.c
Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.compact(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.OutputStreamBasedCompactingFileWriter.asOutputStream()> in (CompactService.java:120)
Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.compact(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> gets field <org.apache.flink.streaming.api.functions.sink.filesystem.CompactingFileWriter$Type.OUTPUT_STREAM> in (CompactService.java:115)
Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.compact(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> gets field <org.apache.flink.streaming.api.functions.sink.filesystem.CompactingFileWriter$Type.RECORD_WISE> in (CompactService.java:110)
-Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.compact(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> references method <org.apache.flink.streaming.api.functions.sink.filesystem.RecordWiseCompactingFileWriter.write(java.lang.Object)> in (CompactService.java:114)
+Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.compact(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> references method <org.apache.flink.streaming.api.functions.sink.filesystem.RecordWiseCompactingFileWriter.write(java.lang.Object)> in (CompactService.java:111)
Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.getCompactingPath(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter$PendingFile.commitAfterRecovery()> in (CompactService.java:151)
Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.getCompactingPath(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter.recoverPendingFile(org.apache.flink.streaming.api.functions.sink.filesystem.InProgressFileWriter$PendingFileRecoverable)> in (CompactService.java:151)
Method <org.apache.flink.connector.file.sink.compactor.operator.CompactService.getCompactingPath(org.apache.flink.connector.file.sink.compactor.operator.CompactorRequest)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.InProgressFileWriter$PendingFileRecoverable.getPath()> in (CompactService.java:144)
@@ -670,15 +669,15 @@ Method <org.apache.flink.connector.file.table.FileSystemOutputFormat$Builder.bui
Method <org.apache.flink.connector.file.table.FileSystemOutputFormat$Builder.build()> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (FileSystemOutputFormat.java:291)
Method <org.apache.flink.connector.file.table.FileSystemOutputFormat$Builder.build()> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (FileSystemOutputFormat.java:292)
Method <org.apache.flink.connector.file.table.FileSystemOutputFormat$Builder.setOutputFileConfig(org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig)> has parameter of type <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig> in (FileSystemOutputFormat.java:0)
-Method <org.apache.flink.connector.file.table.FileSystemTableSink$TableBucketAssigner.getBucketId(org.apache.flink.table.data.RowData, org.apache.flink.streaming.api.functions.sink.filesystem.BucketAssigner$Context)> calls method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (FileSystemTableSink.java:549)
-Method <org.apache.flink.connector.file.table.FileSystemTableSink.createBatchSink(org.apache.flink.streaming.api.datastream.DataStream, org.apache.flink.table.connector.sink.DynamicTableSink$Context, int, boolean)> calls method <org.apache.flink.api.dag.Transformation.setParallelism(int, boolean)> in (FileSystemTableSink.java:191)
+Method <org.apache.flink.connector.file.table.FileSystemTableSink$TableBucketAssigner.getBucketId(org.apache.flink.table.data.RowData, org.apache.flink.streaming.api.functions.sink.filesystem.BucketAssigner$Context)> calls method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (FileSystemTableSink.java:566)
+Method <org.apache.flink.connector.file.table.FileSystemTableSink.createBatchSink(org.apache.flink.streaming.api.datastream.DataStream, org.apache.flink.table.connector.sink.DynamicTableSink$Context, int, boolean)> calls method <org.apache.flink.api.dag.Transformation.setParallelism(int, boolean)> in (FileSystemTableSink.java:208)
Method <org.apache.flink.connector.file.table.FileSystemTableSink.createBatchSink(org.apache.flink.streaming.api.datastream.DataStream, org.apache.flink.table.connector.sink.DynamicTableSink$Context, int, boolean)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig.builder()> in (FileSystemTableSink.java:189)
-Method <org.apache.flink.connector.file.table.FileSystemTableSink.createStreamingSink(org.apache.flink.table.connector.ProviderContext, org.apache.flink.streaming.api.datastream.DataStream, org.apache.flink.table.connector.sink.DynamicTableSink$Context, int, boolean)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig.builder()> in (FileSystemTableSink.java:216)
-Method <org.apache.flink.connector.file.table.FileSystemTableSink.toStagingPath()> calls method <org.apache.flink.util.Preconditions.checkState(boolean, java.lang.Object)> in (FileSystemTableSink.java:363)
-Method <org.apache.flink.connector.file.table.FileSystemTableSource.listPartitions()> calls method <org.apache.flink.table.utils.PartitionPathUtils.searchPartSpecAndPaths(org.apache.flink.core.fs.FileSystem, org.apache.flink.core.fs.Path, int)> in (FileSystemTableSource.java:314)
+Method <org.apache.flink.connector.file.table.FileSystemTableSink.createStreamingSink(org.apache.flink.table.connector.ProviderContext, org.apache.flink.streaming.api.datastream.DataStream, org.apache.flink.table.connector.sink.DynamicTableSink$Context, int, boolean)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig.builder()> in (FileSystemTableSink.java:233)
+Method <org.apache.flink.connector.file.table.FileSystemTableSink.toStagingPath()> calls method <org.apache.flink.util.Preconditions.checkState(boolean, java.lang.Object)> in (FileSystemTableSink.java:380)
+Method <org.apache.flink.connector.file.table.FileSystemTableSource.listPartitions()> calls method <org.apache.flink.table.utils.PartitionPathUtils.searchPartSpecAndPaths(org.apache.flink.core.fs.FileSystem, org.apache.flink.core.fs.Path, int)> in (FileSystemTableSource.java:328)
Method <org.apache.flink.connector.file.table.FileSystemTableSource.paths()> has return type <[Lorg.apache.flink.core.fs.Path;> in (FileSystemTableSource.java:0)
-Method <org.apache.flink.connector.file.table.FileSystemTableSource.paths()> references method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (FileSystemTableSource.java:281)
-Method <org.apache.flink.connector.file.table.FileSystemTableSource.wrapBulkFormat(org.apache.flink.table.connector.source.ScanTableSource$ScanContext, org.apache.flink.connector.file.src.reader.BulkFormat, org.apache.flink.table.types.DataType, java.util.List, java.util.List)> calls method <org.apache.flink.util.CollectionUtil.entry(java.lang.Object, java.lang.Object)> in (FileSystemTableSource.java:246)
+Method <org.apache.flink.connector.file.table.FileSystemTableSource.paths()> references method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (FileSystemTableSource.java:295)
+Method <org.apache.flink.connector.file.table.FileSystemTableSource.wrapBulkFormat(org.apache.flink.table.connector.source.ScanTableSource$ScanContext, org.apache.flink.connector.file.src.reader.BulkFormat, org.apache.flink.table.types.DataType, java.util.List, java.util.List)> calls method <org.apache.flink.util.CollectionUtil.entry(java.lang.Object, java.lang.Object)> in (FileSystemTableSource.java:248)
Method <org.apache.flink.connector.file.table.GroupedPartitionWriter.write(java.lang.Object)> calls method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (GroupedPartitionWriter.java:62)
Method <org.apache.flink.connector.file.table.LimitableBulkFormat.globalNumberRead()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (LimitableBulkFormat.java:0)
Method <org.apache.flink.connector.file.table.PartitionFieldExtractor.$deserializeLambda$(java.lang.invoke.SerializedLambda)> calls method <org.apache.flink.table.utils.PartitionPathUtils.extractPartitionSpecFromPath(org.apache.flink.core.fs.Path)> in (PartitionFieldExtractor.java:39)
@@ -745,9 +744,9 @@ Method <org.apache.flink.connector.file.table.stream.AbstractStreamingWriter.pro
Method <org.apache.flink.connector.file.table.stream.AbstractStreamingWriter.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> has parameter of type <org.apache.flink.streaming.runtime.streamrecord.StreamRecord> in (AbstractStreamingWriter.java:0)
Method <org.apache.flink.connector.file.table.stream.AbstractStreamingWriter.snapshotState(org.apache.flink.runtime.state.StateSnapshotContext)> calls method <org.apache.flink.streaming.api.functions.sink.filesystem.StreamingFileSinkHelper.snapshotState(long)> in (AbstractStreamingWriter.java:129)
Method <org.apache.flink.connector.file.table.stream.PartitionCommitTrigger.create(boolean, org.apache.flink.api.common.state.OperatorStateStore, org.apache.flink.configuration.Configuration, java.lang.ClassLoader, java.util.List, org.apache.flink.streaming.runtime.tasks.ProcessingTimeService)> has parameter of type <org.apache.flink.streaming.runtime.tasks.ProcessingTimeService> in (PartitionCommitTrigger.java:0)
-Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.commitPartitions(long)> calls method <org.apache.flink.table.utils.PartitionPathUtils.extractPartitionSpecFromPath(org.apache.flink.core.fs.Path)> in (PartitionCommitter.java:165)
-Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.commitPartitions(long)> calls method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (PartitionCommitter.java:170)
-Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> calls method <org.apache.flink.streaming.runtime.streamrecord.StreamRecord.getValue()> in (PartitionCommitter.java:138)
+Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.commitPartitions(long)> calls method <org.apache.flink.table.utils.PartitionPathUtils.extractPartitionSpecFromPath(org.apache.flink.core.fs.Path)> in (PartitionCommitter.java:167)
+Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.commitPartitions(long)> calls method <org.apache.flink.table.utils.PartitionPathUtils.generatePartitionPath(java.util.LinkedHashMap)> in (PartitionCommitter.java:172)
+Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> calls method <org.apache.flink.streaming.runtime.streamrecord.StreamRecord.getValue()> in (PartitionCommitter.java:140)
Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> has generic parameter type <org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.connector.file.table.stream.PartitionCommitInfo>> with type argument depending on <org.apache.flink.streaming.runtime.streamrecord.StreamRecord> in (PartitionCommitter.java:0)
Method <org.apache.flink.connector.file.table.stream.PartitionCommitter.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> has parameter of type <org.apache.flink.streaming.runtime.streamrecord.StreamRecord> in (PartitionCommitter.java:0)
Method <org.apache.flink.connector.file.table.stream.PartitionTimeCommitPredicate.isPartitionCommittable(org.apache.flink.connector.file.table.stream.PartitionCommitPredicate$PredicateContext)> calls method <org.apache.flink.table.utils.PartitionPathUtils.extractPartitionValues(org.apache.flink.core.fs.Path)> in (PartitionTimeCommitPredicate.java:71)
@@ -799,84 +798,6 @@ Method <org.apache.flink.connector.file.table.stream.compact.CompactOperator.pro
Method <org.apache.flink.connector.file.table.stream.compact.CompactOperator.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> has generic parameter type <org.apache.flink.streaming.runtime.streamrecord.StreamRecord<org.apache.flink.connector.file.table.stream.compact.CompactMessages$CoordinatorOutput>> with type argument depending on <org.apache.flink.streaming.runtime.streamrecord.StreamRecord> in (CompactOperator.java:0)
Method <org.apache.flink.connector.file.table.stream.compact.CompactOperator.processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord)> has parameter of type <org.apache.flink.streaming.runtime.streamrecord.StreamRecord> in (CompactOperator.java:0)
Method <org.apache.flink.connector.file.table.utils.CompactFileUtils.doSingleFileMove(org.apache.flink.core.fs.FileSystem, org.apache.flink.core.fs.Path, org.apache.flink.core.fs.Path)> calls method <org.apache.flink.util.IOUtils.copyBytes(java.io.InputStream, java.io.OutputStream, boolean)> in (CompactFileUtils.java:117)
-Method <org.apache.flink.connector.hbase.sink.HBaseSinkFunction.open(org.apache.flink.configuration.Configuration)> calls constructor <org.apache.flink.util.concurrent.ExecutorThreadFactory.<init>(java.lang.String)> in (HBaseSinkFunction.java:127)
-Method <org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource.getCache()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (AbstractHBaseDynamicTableSource.java:0)
-Method <org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource.getHBaseTableSchema()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (AbstractHBaseDynamicTableSource.java:0)
-Method <org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource.getLookupRuntimeProvider(org.apache.flink.table.connector.source.LookupTableSource$LookupContext)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (AbstractHBaseDynamicTableSource.java:79)
-Method <org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource.getLookupRuntimeProvider(org.apache.flink.table.connector.source.LookupTableSource$LookupContext)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (AbstractHBaseDynamicTableSource.java:82)
-Method <org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource.getLookupRuntimeProvider(org.apache.flink.table.connector.source.LookupTableSource$LookupContext)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (AbstractHBaseDynamicTableSource.java:85)
-Method <org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource.getMaxRetryTimes()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (AbstractHBaseDynamicTableSource.java:0)
-Method <org.apache.flink.connector.hbase.source.HBaseRowDataLookupFunction.getHTableName()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseRowDataLookupFunction.java:0)
-Method <org.apache.flink.connector.hbase.util.HBaseConfigurationUtil.deserializeWritable(org.apache.hadoop.io.Writable, [B)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (HBaseConfigurationUtil.java:173)
-Method <org.apache.flink.connector.hbase.util.HBaseConfigurationUtil.deserializeWritable(org.apache.hadoop.io.Writable, [B)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (HBaseConfigurationUtil.java:174)
-Method <org.apache.flink.connector.hbase.util.HBaseConfigurationUtil.serializeWritable(org.apache.hadoop.io.Writable)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean)> in (HBaseConfigurationUtil.java:155)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.convertToRow(org.apache.hadoop.hbase.client.Result, org.apache.flink.table.data.GenericRowData, [Lorg.apache.flink.table.data.GenericRowData;)> has parameter of type <[Lorg.apache.flink.table.data.GenericRowData;> in (HBaseSerde.java:0)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createDeleteMutation(org.apache.flink.table.data.RowData)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (HBaseSerde.java:163)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createFieldDecoder(org.apache.flink.table.types.logical.LogicalType)> calls method <org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision(org.apache.flink.table.types.logical.LogicalType)> in (HBaseSerde.java:480)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createFieldDecoder(org.apache.flink.table.types.logical.LogicalType)> calls method <org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision(org.apache.flink.table.types.logical.LogicalType)> in (HBaseSerde.java:498)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createFieldEncoder(org.apache.flink.table.types.logical.LogicalType)> calls method <org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision(org.apache.flink.table.types.logical.LogicalType)> in (HBaseSerde.java:369)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createFieldEncoder(org.apache.flink.table.types.logical.LogicalType)> calls method <org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision(org.apache.flink.table.types.logical.LogicalType)> in (HBaseSerde.java:387)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createGet(java.lang.Object)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (HBaseSerde.java:210)
-Method <org.apache.flink.connector.hbase.util.HBaseSerde.createPutMutation(org.apache.flink.table.data.RowData)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (HBaseSerde.java:131)
-Method <org.apache.flink.connector.hbase.util.HBaseStronglyIncreasingTsGenerator.getCurrentSystemTimeNano()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseStronglyIncreasingTsGenerator.java:0)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.addColumn(java.lang.String, java.lang.String, java.lang.Class)> calls method <org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType(org.apache.flink.api.common.typeinfo.TypeInformation)> in (HBaseTableSchema.java:68)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.addColumn(java.lang.String, java.lang.String, java.lang.Class)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:67)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.addColumn(java.lang.String, java.lang.String, org.apache.flink.table.types.DataType)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:73)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.addColumn(java.lang.String, java.lang.String, org.apache.flink.table.types.DataType)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:74)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.addColumn(java.lang.String, java.lang.String, org.apache.flink.table.types.DataType)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:75)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.convertToDataType()> calls method <org.apache.flink.shaded.guava31.com.google.common.collect.Streams.zip(java.util.stream.Stream, java.util.stream.Stream, java.util.function.BiFunction)> in (HBaseTableSchema.java:283)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.convertToDataType()> calls method <org.apache.flink.shaded.guava31.com.google.common.collect.Streams.zip(java.util.stream.Stream, java.util.stream.Stream, java.util.function.BiFunction)> in (HBaseTableSchema.java:298)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.fromDataType(org.apache.flink.table.types.DataType)> calls method <org.apache.flink.table.types.utils.TypeConversions.fromLogicalToDataType(org.apache.flink.table.types.logical.LogicalType)> in (HBaseTableSchema.java:335)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.fromDataType(org.apache.flink.table.types.DataType)> calls method <org.apache.flink.table.types.utils.TypeConversions.fromLogicalToDataType(org.apache.flink.table.types.logical.LogicalType)> in (HBaseTableSchema.java:338)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.getQualifierDataTypes(java.lang.String)> has return type <[Lorg.apache.flink.table.types.DataType;> in (HBaseTableSchema.java:0)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.getRowDataType([Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;)> has parameter of type <[Lorg.apache.flink.table.types.DataType;> in (HBaseTableSchema.java:0)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.getRowKeyTypeInfo()> calls method <org.apache.flink.table.types.utils.TypeConversions.fromDataTypeToLegacyInfo(org.apache.flink.table.types.DataType)> in (HBaseTableSchema.java:241)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.setRowKey(java.lang.String, java.lang.Class)> calls method <org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType(org.apache.flink.api.common.typeinfo.TypeInformation)> in (HBaseTableSchema.java:102)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.setRowKey(java.lang.String, java.lang.Class)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:101)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.setRowKey(java.lang.String, org.apache.flink.table.types.DataType)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:107)
-Method <org.apache.flink.connector.hbase.util.HBaseTableSchema.setRowKey(java.lang.String, org.apache.flink.table.types.DataType)> calls method <org.apache.flink.util.Preconditions.checkNotNull(java.lang.Object, java.lang.String)> in (HBaseTableSchema.java:108)
-Method <org.apache.flink.connector.hbase.util.HBaseTypeUtils.isSupportedType(org.apache.flink.table.types.logical.LogicalType)> calls method <org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision(org.apache.flink.table.types.logical.LogicalType)> in (HBaseTypeUtils.java:190)
-Method <org.apache.flink.connector.hbase.util.HBaseTypeUtils.isSupportedType(org.apache.flink.table.types.logical.LogicalType)> calls method <org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision(org.apache.flink.table.types.logical.LogicalType)> in (HBaseTypeUtils.java:201)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> calls method <org.apache.flink.table.connector.source.lookup.LookupOptions$LookupCacheType.equals(java.lang.Object)> in (HBase1DynamicTableFactory.java:98)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions$LookupCacheType.PARTIAL> in (HBase1DynamicTableFactory.java:97)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.CACHE_TYPE> in (HBase1DynamicTableFactory.java:96)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.MAX_RETRIES> in (HBase1DynamicTableFactory.java:102)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.CACHE_TYPE> in (HBase1DynamicTableFactory.java:157)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.MAX_RETRIES> in (HBase1DynamicTableFactory.java:158)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_CACHE_MISSING_KEY> in (HBase1DynamicTableFactory.java:161)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_ACCESS> in (HBase1DynamicTableFactory.java:159)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_WRITE> in (HBase1DynamicTableFactory.java:160)
-Method <org.apache.flink.connector.hbase1.HBase1DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_MAX_ROWS> in (HBase1DynamicTableFactory.java:162)
-Method <org.apache.flink.connector.hbase1.sink.HBaseDynamicTableSink.getConfiguration()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase1.sink.HBaseDynamicTableSink.getHBaseTableSchema()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase1.sink.HBaseDynamicTableSink.getTableName()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase1.sink.HBaseDynamicTableSink.getWriteOptions()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase1.source.AbstractTableInputFormat.createInputSplits(int)> has return type <[Lorg.apache.flink.core.io.InputSplit;> in (AbstractTableInputFormat.java:0)
-Method <org.apache.flink.connector.hbase1.source.AbstractTableInputFormat.getConnection()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (AbstractTableInputFormat.java:0)
-Method <org.apache.flink.connector.hbase1.source.AbstractTableInputFormat.getInputSplitAssigner([Lorg.apache.flink.core.io.InputSplit;)> has parameter of type <[Lorg.apache.flink.core.io.InputSplit;> in (AbstractTableInputFormat.java:0)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> calls method <org.apache.flink.table.connector.source.lookup.LookupOptions$LookupCacheType.equals(java.lang.Object)> in (HBase2DynamicTableFactory.java:99)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions$LookupCacheType.PARTIAL> in (HBase2DynamicTableFactory.java:98)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.CACHE_TYPE> in (HBase2DynamicTableFactory.java:97)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.createDynamicTableSource(org.apache.flink.table.factories.DynamicTableFactory$Context)> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.MAX_RETRIES> in (HBase2DynamicTableFactory.java:103)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.CACHE_TYPE> in (HBase2DynamicTableFactory.java:159)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.MAX_RETRIES> in (HBase2DynamicTableFactory.java:160)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_CACHE_MISSING_KEY> in (HBase2DynamicTableFactory.java:163)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_ACCESS> in (HBase2DynamicTableFactory.java:161)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_WRITE> in (HBase2DynamicTableFactory.java:162)
-Method <org.apache.flink.connector.hbase2.HBase2DynamicTableFactory.optionalOptions()> gets field <org.apache.flink.table.connector.source.lookup.LookupOptions.PARTIAL_CACHE_MAX_ROWS> in (HBase2DynamicTableFactory.java:164)
-Method <org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink.getConfiguration()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink.getHBaseTableSchema()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink.getTableName()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink.getWriteOptions()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseDynamicTableSink.java:0)
-Method <org.apache.flink.connector.hbase2.source.AbstractTableInputFormat.close()> calls method <org.apache.flink.util.IOUtils.closeQuietly(java.lang.AutoCloseable)> in (AbstractTableInputFormat.java:201)
-Method <org.apache.flink.connector.hbase2.source.AbstractTableInputFormat.createInputSplits(int)> has return type <[Lorg.apache.flink.core.io.InputSplit;> in (AbstractTableInputFormat.java:0)
-Method <org.apache.flink.connector.hbase2.source.AbstractTableInputFormat.getConnection()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (AbstractTableInputFormat.java:0)
-Method <org.apache.flink.connector.hbase2.source.AbstractTableInputFormat.getInputSplitAssigner([Lorg.apache.flink.core.io.InputSplit;)> has parameter of type <[Lorg.apache.flink.core.io.InputSplit;> in (AbstractTableInputFormat.java:0)
-Method <org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource.getLookupRuntimeProvider(org.apache.flink.table.connector.source.LookupTableSource$LookupContext)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (HBaseDynamicTableSource.java:63)
-Method <org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource.getLookupRuntimeProvider(org.apache.flink.table.connector.source.LookupTableSource$LookupContext)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (HBaseDynamicTableSource.java:66)
-Method <org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource.getLookupRuntimeProvider(org.apache.flink.table.connector.source.LookupTableSource$LookupContext)> calls method <org.apache.flink.util.Preconditions.checkArgument(boolean, java.lang.Object)> in (HBaseDynamicTableSource.java:69)
-Method <org.apache.flink.connector.hbase2.source.HBaseRowDataAsyncLookupFunction.getHTableName()> is annotated with <org.apache.flink.annotation.VisibleForTesting> in (HBaseRowDataAsyncLookupFunction.java:0)
-Method <org.apache.flink.connector.hbase2.source.HBaseRowDataAsyncLookupFunction.open(org.apache.flink.table.functions.FunctionContext)> calls constructor <org.apache.flink.util.concurrent.ExecutorThreadFactory.<init>(java.lang.String, java.lang.Thread$UncaughtExceptionHandler)> in (HBaseRowDataAsyncLookupFunction.java:96)
Method <org.apache.flink.connector.print.table.PrintTableSinkFactory$RowDataPrintFunction.invoke(org.apache.flink.table.data.RowData, org.apache.flink.streaming.api.functions.sink.SinkFunction$Context)> calls method <org.apache.flink.api.common.functions.util.PrintSinkOutputWriter.write(java.lang.Object)> in (PrintTableSinkFactory.java:187)
Method <org.apache.flink.connector.print.table.PrintTableSinkFactory$RowDataPrintFunction.open(org.apache.flink.configuration.Configuration)> calls method <org.apache.flink.api.common.functions.util.PrintSinkOutputWriter.open(int, int)> in (PrintTableSinkFactory.java:180)
Method <org.apache.flink.connector.print.table.PrintTableSinkFactory$RowDataPrintFunction.open(org.apache.flink.configuration.Configuration)> calls method <org.apache.flink.streaming.api.operators.StreamingRuntimeContext.getIndexOfThisSubtask()> in (PrintTableSinkFactory.java:180)
diff --git a/flink-architecture-tests/flink-architecture-tests-production/pom.xml b/flink-architecture-tests/flink-architecture-tests-production/pom.xml
index e66af3dee6f..3b1ef2afd95 100644
--- a/flink-architecture-tests/flink-architecture-tests-production/pom.xml
+++ b/flink-architecture-tests/flink-architecture-tests-production/pom.xml
@@ -134,21 +134,6 @@ under the License.
<artifactId>flink-connector-files</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-1.4</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-2.2</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-base</artifactId>
- </dependency>
-
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-hive_${scala.binary.version}</artifactId>
diff --git a/flink-architecture-tests/pom.xml b/flink-architecture-tests/pom.xml
index 50f928d03c9..24474cf1c80 100644
--- a/flink-architecture-tests/pom.xml
+++ b/flink-architecture-tests/pom.xml
@@ -146,27 +146,6 @@ under the License.
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-1.4</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-2.2</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-base</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-hive_${scala.binary.version}</artifactId>
diff --git a/flink-connectors/flink-connector-hbase-1.4/archunit-violations/3ba92d3a-6609-4295-92ed-f2fe207ee2b3 b/flink-connectors/flink-connector-hbase-1.4/archunit-violations/3ba92d3a-6609-4295-92ed-f2fe207ee2b3
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/flink-connectors/flink-connector-hbase-1.4/archunit-violations/ffbddcc3-857a-4af7-a6b5-fcf71e2cc191 b/flink-connectors/flink-connector-hbase-1.4/archunit-violations/ffbddcc3-857a-4af7-a6b5-fcf71e2cc191
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/flink-connectors/flink-connector-hbase-1.4/archunit-violations/stored.rules b/flink-connectors/flink-connector-hbase-1.4/archunit-violations/stored.rules
deleted file mode 100644
index 0dcd72673c9..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/archunit-violations/stored.rules
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-#Tue Feb 22 12:17:39 CET 2022
-Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=ffbddcc3-857a-4af7-a6b5-fcf71e2cc191
-ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=3ba92d3a-6609-4295-92ed-f2fe207ee2b3
diff --git a/flink-connectors/flink-connector-hbase-1.4/pom.xml b/flink-connectors/flink-connector-hbase-1.4/pom.xml
deleted file mode 100644
index 008c2c5cdc7..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/pom.xml
+++ /dev/null
@@ -1,413 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connectors</artifactId>
- <version>1.18-SNAPSHOT</version>
- </parent>
-
- <artifactId>flink-connector-hbase-1.4</artifactId>
- <name>Flink : Connectors : HBase 1.4</name>
- <packaging>jar</packaging>
-
- <properties>
- <hbase.version>1.4.3</hbase.version>
- </properties>
-
- <dependencies>
-
- <!-- Core -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-streaming-java</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Flink HBase -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-base</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Table ecosystem -->
-
- <!-- Projects depending on this project won't depend on flink-table-*. -->
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-api-java-bridge</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
-
- <!-- Tests -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-base</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-hadoop-compatibility_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-shaded-include-yarn_${scala.binary.version}</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-test-utils</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-common</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-planner_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-api-scala-bridge_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-planner_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-server</artifactId>
- <version>${hbase.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-auth</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-server</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- <exclusions>
- <!-- Remove unneeded dependency, which is conflicting with our jetty-util version. -->
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-sslengine</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-2.1</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.1</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- </exclusion>
- <!-- Bug in hbase annotations, can be removed when fixed. See FLINK-2153. -->
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>tomcat</groupId>
- <artifactId>jasper-compiler</artifactId>
- </exclusion>
- <exclusion>
- <groupId>tomcat</groupId>
- <artifactId>jasper-runtime</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jruby.jcodings</groupId>
- <artifactId>jcodings</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jruby.joni</groupId>
- <artifactId>joni</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jamon</groupId>
- <artifactId>jamon-runtime</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-auth</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <!-- Bump hbase netty dependency -->
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.1.46.Final</version>
- </dependency>
-
- <!--
- We declare this test-classified dependency here to move it into our
- "test" scope. Otherwise it would end up in proudction jars.
- This can probably be fixed once we rely on higher HBase versions which
- have fixed this problem.
- -->
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-common</artifactId>
- <version>${hbase.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-minicluster</artifactId>
- <version>${flink.hadoop.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <!-- This dependency is no longer shipped with the JDK since Java 9.-->
- <groupId>jdk.tools</groupId>
- <artifactId>jdk.tools</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop-compat</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- <version>${flink.hadoop.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop2-compat</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- ArchUit test dependencies -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-architecture-tests-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <!-- HBase only works with Zookeper 3.4 -->
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <profiles>
- <profile>
- <id>java11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- hbase currently does not support Java 11, see HBASE-21110 -->
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/HBase1DynamicTableFactory.java b/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/HBase1DynamicTableFactory.java
deleted file mode 100644
index fbc793ca3ca..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/HBase1DynamicTableFactory.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.configuration.ConfigOption;
-import org.apache.flink.configuration.ReadableConfig;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase1.sink.HBaseDynamicTableSink;
-import org.apache.flink.connector.hbase1.source.HBaseDynamicTableSource;
-import org.apache.flink.table.connector.sink.DynamicTableSink;
-import org.apache.flink.table.connector.source.DynamicTableSource;
-import org.apache.flink.table.connector.source.lookup.LookupOptions;
-import org.apache.flink.table.connector.source.lookup.cache.DefaultLookupCache;
-import org.apache.flink.table.connector.source.lookup.cache.LookupCache;
-import org.apache.flink.table.factories.DynamicTableSinkFactory;
-import org.apache.flink.table.factories.DynamicTableSourceFactory;
-import org.apache.flink.table.factories.FactoryUtil.TableFactoryHelper;
-
-import org.apache.hadoop.conf.Configuration;
-
-import java.time.Duration;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_ASYNC;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_MAX_ROWS;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_TTL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_MAX_RETRIES;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.NULL_STRING_LITERAL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_INTERVAL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_ROWS;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_SIZE;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_PARALLELISM;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.TABLE_NAME;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.ZOOKEEPER_QUORUM;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.ZOOKEEPER_ZNODE_PARENT;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.PROPERTIES_PREFIX;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.getHBaseConfiguration;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.getHBaseWriteOptions;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.validatePrimaryKey;
-import static org.apache.flink.table.factories.FactoryUtil.createTableFactoryHelper;
-
-/** HBase connector factory. */
-@Internal
-public class HBase1DynamicTableFactory
- implements DynamicTableSourceFactory, DynamicTableSinkFactory {
-
- private static final String IDENTIFIER = "hbase-1.4";
-
- @Override
- public DynamicTableSource createDynamicTableSource(Context context) {
- TableFactoryHelper helper = createTableFactoryHelper(this, context);
- helper.validateExcept(PROPERTIES_PREFIX);
-
- final ReadableConfig tableOptions = helper.getOptions();
-
- validatePrimaryKey(context.getPhysicalRowDataType(), context.getPrimaryKeyIndexes());
-
- String tableName = tableOptions.get(TABLE_NAME);
- Configuration hbaseClientConf = getHBaseConfiguration(tableOptions);
- String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
- HBaseTableSchema hbaseSchema =
- HBaseTableSchema.fromDataType(context.getPhysicalRowDataType());
- LookupCache cache = null;
-
- // Backward compatible to legacy caching options
- if (tableOptions.get(LOOKUP_CACHE_MAX_ROWS) > 0
- && tableOptions.get(LOOKUP_CACHE_TTL).compareTo(Duration.ZERO) > 0) {
- cache =
- DefaultLookupCache.newBuilder()
- .maximumSize(tableOptions.get(LOOKUP_CACHE_MAX_ROWS))
- .expireAfterWrite(tableOptions.get(LOOKUP_CACHE_TTL))
- .build();
- }
-
- if (tableOptions
- .get(LookupOptions.CACHE_TYPE)
- .equals(LookupOptions.LookupCacheType.PARTIAL)) {
- cache = DefaultLookupCache.fromConfig(tableOptions);
- }
-
- return new HBaseDynamicTableSource(
- hbaseClientConf,
- tableName,
- hbaseSchema,
- nullStringLiteral,
- tableOptions.get(LookupOptions.MAX_RETRIES),
- cache);
- }
-
- @Override
- public DynamicTableSink createDynamicTableSink(Context context) {
- TableFactoryHelper helper = createTableFactoryHelper(this, context);
- helper.validateExcept(PROPERTIES_PREFIX);
-
- final ReadableConfig tableOptions = helper.getOptions();
-
- validatePrimaryKey(context.getPhysicalRowDataType(), context.getPrimaryKeyIndexes());
-
- String tableName = tableOptions.get(TABLE_NAME);
- Configuration hbaseConf = getHBaseConfiguration(tableOptions);
- HBaseWriteOptions hBaseWriteOptions = getHBaseWriteOptions(tableOptions);
- String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
- HBaseTableSchema hbaseSchema =
- HBaseTableSchema.fromDataType(context.getPhysicalRowDataType());
-
- return new HBaseDynamicTableSink(
- tableName, hbaseSchema, hbaseConf, hBaseWriteOptions, nullStringLiteral);
- }
-
- @Override
- public String factoryIdentifier() {
- return IDENTIFIER;
- }
-
- @Override
- public Set<ConfigOption<?>> requiredOptions() {
- Set<ConfigOption<?>> set = new HashSet<>();
- set.add(TABLE_NAME);
- set.add(ZOOKEEPER_QUORUM);
- return set;
- }
-
- @Override
- public Set<ConfigOption<?>> optionalOptions() {
- Set<ConfigOption<?>> set = new HashSet<>();
- set.add(ZOOKEEPER_ZNODE_PARENT);
- set.add(NULL_STRING_LITERAL);
- set.add(SINK_BUFFER_FLUSH_MAX_SIZE);
- set.add(SINK_BUFFER_FLUSH_MAX_ROWS);
- set.add(SINK_BUFFER_FLUSH_INTERVAL);
- set.add(SINK_PARALLELISM);
- set.add(LOOKUP_ASYNC);
- set.add(LOOKUP_CACHE_MAX_ROWS);
- set.add(LOOKUP_CACHE_TTL);
- set.add(LOOKUP_MAX_RETRIES);
- set.add(LookupOptions.CACHE_TYPE);
- set.add(LookupOptions.MAX_RETRIES);
- set.add(LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_ACCESS);
- set.add(LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_WRITE);
- set.add(LookupOptions.PARTIAL_CACHE_CACHE_MISSING_KEY);
- set.add(LookupOptions.PARTIAL_CACHE_MAX_ROWS);
- return set;
- }
-
- @Override
- public Set<ConfigOption<?>> forwardOptions() {
- return Stream.of(
- TABLE_NAME,
- ZOOKEEPER_ZNODE_PARENT,
- ZOOKEEPER_QUORUM,
- NULL_STRING_LITERAL,
- SINK_BUFFER_FLUSH_MAX_SIZE,
- SINK_BUFFER_FLUSH_MAX_ROWS,
- SINK_BUFFER_FLUSH_INTERVAL,
- LOOKUP_CACHE_MAX_ROWS,
- LOOKUP_CACHE_TTL,
- LOOKUP_MAX_RETRIES)
- .collect(Collectors.toSet());
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/sink/HBaseDynamicTableSink.java b/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/sink/HBaseDynamicTableSink.java
deleted file mode 100644
index 2b9e87c5d1e..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/sink/HBaseDynamicTableSink.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1.sink;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.sink.HBaseSinkFunction;
-import org.apache.flink.connector.hbase.sink.RowDataToMutationConverter;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.connector.ChangelogMode;
-import org.apache.flink.table.connector.sink.DynamicTableSink;
-import org.apache.flink.table.connector.sink.SinkFunctionProvider;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.types.RowKind;
-
-import org.apache.hadoop.conf.Configuration;
-
-/** HBase table sink implementation. */
-@Internal
-public class HBaseDynamicTableSink implements DynamicTableSink {
-
- private final HBaseTableSchema hbaseTableSchema;
- private final String nullStringLiteral;
- private final Configuration hbaseConf;
- private final HBaseWriteOptions writeOptions;
- private final String tableName;
-
- public HBaseDynamicTableSink(
- String tableName,
- HBaseTableSchema hbaseTableSchema,
- Configuration hbaseConf,
- HBaseWriteOptions writeOptions,
- String nullStringLiteral) {
- this.hbaseTableSchema = hbaseTableSchema;
- this.nullStringLiteral = nullStringLiteral;
- this.hbaseConf = hbaseConf;
- this.writeOptions = writeOptions;
- this.tableName = tableName;
- }
-
- @Override
- public SinkRuntimeProvider getSinkRuntimeProvider(Context context) {
- HBaseSinkFunction<RowData> sinkFunction =
- new HBaseSinkFunction<>(
- tableName,
- hbaseConf,
- new RowDataToMutationConverter(hbaseTableSchema, nullStringLiteral),
- writeOptions.getBufferFlushMaxSizeInBytes(),
- writeOptions.getBufferFlushMaxRows(),
- writeOptions.getBufferFlushIntervalMillis());
- return SinkFunctionProvider.of(sinkFunction, writeOptions.getParallelism());
- }
-
- @Override
- public ChangelogMode getChangelogMode(ChangelogMode requestedMode) {
- // UPSERT mode
- ChangelogMode.Builder builder = ChangelogMode.newBuilder();
- for (RowKind kind : requestedMode.getContainedKinds()) {
- if (kind != RowKind.UPDATE_BEFORE) {
- builder.addContainedKind(kind);
- }
- }
- return builder.build();
- }
-
- @Override
- public DynamicTableSink copy() {
- return new HBaseDynamicTableSink(
- tableName, hbaseTableSchema, hbaseConf, writeOptions, nullStringLiteral);
- }
-
- @Override
- public String asSummaryString() {
- return "HBase";
- }
-
- // -------------------------------------------------------------------------------------------
-
- @VisibleForTesting
- public HBaseTableSchema getHBaseTableSchema() {
- return this.hbaseTableSchema;
- }
-
- @VisibleForTesting
- public HBaseWriteOptions getWriteOptions() {
- return writeOptions;
- }
-
- @VisibleForTesting
- public Configuration getConfiguration() {
- return this.hbaseConf;
- }
-
- @VisibleForTesting
- public String getTableName() {
- return this.tableName;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/AbstractTableInputFormat.java b/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/AbstractTableInputFormat.java
deleted file mode 100644
index 6b60adc9295..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/AbstractTableInputFormat.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.api.common.io.LocatableInputSplitAssigner;
-import org.apache.flink.api.common.io.RichInputFormat;
-import org.apache.flink.api.common.io.statistics.BaseStatistics;
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.connector.hbase.source.TableInputSplit;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.core.io.InputSplitAssigner;
-
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Pair;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Abstract {@link InputFormat} to read data from HBase tables. */
-@Internal
-public abstract class AbstractTableInputFormat<T> extends RichInputFormat<T, TableInputSplit> {
-
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractTableInputFormat.class);
- private static final long serialVersionUID = 1L;
-
- // helper variable to decide whether the input is exhausted or not
- protected boolean endReached = false;
-
- protected transient Connection connection = null;
- protected transient HTable table = null;
- protected transient Scan scan = null;
-
- /** HBase iterator wrapper. */
- protected ResultScanner resultScanner = null;
-
- protected byte[] currentRow;
- protected long scannedRows;
-
- // Configuration is not serializable
- protected byte[] serializedConfig;
-
- public AbstractTableInputFormat(org.apache.hadoop.conf.Configuration hConf) {
- serializedConfig = HBaseConfigurationUtil.serializeConfiguration(hConf);
- }
-
- /**
- * Creates a {@link Scan} object and opens the {@link HTable} connection to initialize the HBase
- * table.
- *
- * @throws IOException Thrown, if the connection could not be opened due to an I/O problem.
- */
- protected abstract void initTable() throws IOException;
-
- /**
- * Returns an instance of Scan that retrieves the required subset of records from the HBase
- * table.
- *
- * @return The appropriate instance of Scan for this use case.
- */
- protected abstract Scan getScanner();
-
- /**
- * What table is to be read.
- *
- * <p>Per instance of a TableInputFormat derivative only a single table name is possible.
- *
- * @return The name of the table
- */
- protected abstract String getTableName();
-
- /**
- * HBase returns an instance of {@link Result}.
- *
- * <p>This method maps the returned {@link Result} instance into the output type {@link T}.
- *
- * @param r The Result instance from HBase that needs to be converted
- * @return The appropriate instance of {@link T} that contains the data of Result.
- */
- protected abstract T mapResultToOutType(Result r);
-
- @Override
- public void configure(Configuration parameters) {}
-
- protected org.apache.hadoop.conf.Configuration getHadoopConfiguration() {
- return HBaseConfigurationUtil.deserializeConfiguration(
- serializedConfig, HBaseConfigurationUtil.getHBaseConfiguration());
- }
-
- /**
- * Creates a {@link Scan} object and opens the {@link HTable} connection. The connection is
- * opened in this method and closed in {@link #close()}.
- *
- * @param split The split to be opened.
- * @throws IOException Thrown, if the spit could not be opened due to an I/O problem.
- */
- @Override
- public void open(TableInputSplit split) throws IOException {
- initTable();
-
- if (split == null) {
- throw new IOException("Input split is null!");
- }
-
- logSplitInfo("opening", split);
-
- // set scan range
- currentRow = split.getStartRow();
- scan.setStartRow(currentRow);
- scan.setStopRow(split.getEndRow());
-
- resultScanner = table.getScanner(scan);
- endReached = false;
- scannedRows = 0;
- }
-
- public T nextRecord(T reuse) throws IOException {
- if (resultScanner == null) {
- throw new IOException("No table result scanner provided!");
- }
- Result res;
- try {
- res = resultScanner.next();
- } catch (Exception e) {
- resultScanner.close();
- // workaround for timeout on scan
- LOG.warn(
- "Error after scan of " + scannedRows + " rows. Retry with a new scanner...", e);
- scan.withStartRow(currentRow, false);
- resultScanner = table.getScanner(scan);
- res = resultScanner.next();
- }
-
- if (res != null) {
- scannedRows++;
- currentRow = res.getRow();
- return mapResultToOutType(res);
- }
-
- endReached = true;
- return null;
- }
-
- private void logSplitInfo(String action, TableInputSplit split) {
- int splitId = split.getSplitNumber();
- String splitStart = Bytes.toString(split.getStartRow());
- String splitEnd = Bytes.toString(split.getEndRow());
- String splitStartKey = splitStart.isEmpty() ? "-" : splitStart;
- String splitStopKey = splitEnd.isEmpty() ? "-" : splitEnd;
- String[] hostnames = split.getHostnames();
- LOG.info(
- "{} split (this={})[{}|{}|{}|{}]",
- action,
- this,
- splitId,
- hostnames,
- splitStartKey,
- splitStopKey);
- }
-
- @Override
- public boolean reachedEnd() throws IOException {
- return endReached;
- }
-
- @Override
- public void close() throws IOException {
- LOG.info("Closing split (scanned {} rows)", scannedRows);
- currentRow = null;
- try {
- if (resultScanner != null) {
- resultScanner.close();
- }
- closeTable();
- } finally {
- resultScanner = null;
- }
- }
-
- public void closeTable() {
- if (table != null) {
- try {
- table.close();
- } catch (IOException e) {
- LOG.warn("Exception occurs while closing HBase Table.", e);
- }
- table = null;
- }
- if (connection != null) {
- try {
- connection.close();
- } catch (IOException e) {
- LOG.warn("Exception occurs while closing HBase Connection.", e);
- }
- connection = null;
- }
- }
-
- @Override
- public TableInputSplit[] createInputSplits(final int minNumSplits) throws IOException {
- try {
- initTable();
-
- // Get the starting and ending row keys for every region in the currently open table
- final Pair<byte[][], byte[][]> keys = table.getRegionLocator().getStartEndKeys();
- if (keys == null || keys.getFirst() == null || keys.getFirst().length == 0) {
- LOG.warn(
- "Unexpected region keys: {} appeared in HBase table: {}, all region information are: {}.",
- keys,
- table,
- table.getRegionLocator().getAllRegionLocations());
- throw new IOException(
- "HBase Table expects at least one region in scan,"
- + " please check the HBase table status in HBase cluster");
- }
- final byte[] startRow = scan.getStartRow();
- final byte[] stopRow = scan.getStopRow();
- final boolean scanWithNoLowerBound = startRow.length == 0;
- final boolean scanWithNoUpperBound = stopRow.length == 0;
-
- final List<TableInputSplit> splits = new ArrayList<>(minNumSplits);
- for (int i = 0; i < keys.getFirst().length; i++) {
- final byte[] startKey = keys.getFirst()[i];
- final byte[] endKey = keys.getSecond()[i];
- final String regionLocation =
- table.getRegionLocator()
- .getRegionLocation(startKey, false)
- .getHostnamePort();
- // Test if the given region is to be included in the InputSplit while splitting the
- // regions of a table
- if (!includeRegionInScan(startKey, endKey)) {
- continue;
- }
- // Find the region on which the given row is being served
- final String[] hosts = new String[] {regionLocation};
-
- // Determine if regions contains keys used by the scan
- boolean isLastRegion = endKey.length == 0;
- if ((scanWithNoLowerBound || isLastRegion || Bytes.compareTo(startRow, endKey) < 0)
- && (scanWithNoUpperBound || Bytes.compareTo(stopRow, startKey) > 0)) {
-
- final byte[] splitStart =
- scanWithNoLowerBound || Bytes.compareTo(startKey, startRow) >= 0
- ? startKey
- : startRow;
- final byte[] splitStop =
- (scanWithNoUpperBound || Bytes.compareTo(endKey, stopRow) <= 0)
- && !isLastRegion
- ? endKey
- : stopRow;
- int id = splits.size();
- final TableInputSplit split =
- new TableInputSplit(
- id, hosts, table.getTableName(), splitStart, splitStop);
- splits.add(split);
- }
- }
- LOG.info("Created " + splits.size() + " splits");
- for (TableInputSplit split : splits) {
- logSplitInfo("created", split);
- }
- return splits.toArray(new TableInputSplit[splits.size()]);
- } finally {
- closeTable();
- }
- }
-
- /**
- * Test if the given region is to be included in the scan while splitting the regions of a
- * table.
- *
- * @param startKey Start key of the region
- * @param endKey End key of the region
- * @return true, if this region needs to be included as part of the input (default).
- */
- protected boolean includeRegionInScan(final byte[] startKey, final byte[] endKey) {
- return true;
- }
-
- @Override
- public InputSplitAssigner getInputSplitAssigner(TableInputSplit[] inputSplits) {
- return new LocatableInputSplitAssigner(inputSplits);
- }
-
- @Override
- public BaseStatistics getStatistics(BaseStatistics cachedStatistics) {
- return null;
- }
-
- @VisibleForTesting
- public Connection getConnection() {
- return connection;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/HBaseDynamicTableSource.java b/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/HBaseDynamicTableSource.java
deleted file mode 100644
index 0322c947ff3..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/HBaseDynamicTableSource.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.connector.source.DynamicTableSource;
-import org.apache.flink.table.connector.source.lookup.cache.LookupCache;
-import org.apache.flink.table.data.RowData;
-
-import org.apache.hadoop.conf.Configuration;
-
-import javax.annotation.Nullable;
-
-import java.util.Objects;
-
-/** HBase table source implementation. */
-@Internal
-public class HBaseDynamicTableSource extends AbstractHBaseDynamicTableSource {
-
- public HBaseDynamicTableSource(
- Configuration conf,
- String tableName,
- HBaseTableSchema hbaseSchema,
- String nullStringLiteral,
- int maxRetryTimes,
- @Nullable LookupCache cache) {
- super(conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes, cache);
- }
-
- @Override
- public DynamicTableSource copy() {
- return new HBaseDynamicTableSource(
- conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes, cache);
- }
-
- @Override
- public InputFormat<RowData, ?> getInputFormat() {
- return new HBaseRowDataInputFormat(conf, tableName, hbaseSchema, nullStringLiteral);
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof HBaseDynamicTableSource)) {
- return false;
- }
- HBaseDynamicTableSource that = (HBaseDynamicTableSource) o;
- return Objects.equals(conf, that.conf)
- && Objects.equals(tableName, that.tableName)
- && Objects.equals(hbaseSchema, that.hbaseSchema)
- && Objects.equals(nullStringLiteral, that.nullStringLiteral)
- && Objects.equals(maxRetryTimes, that.maxRetryTimes)
- && Objects.equals(cache, that.cache);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes, cache);
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/HBaseRowDataInputFormat.java b/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/HBaseRowDataInputFormat.java
deleted file mode 100644
index d48c2fa84c8..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/main/java/org/apache/flink/connector/hbase1/source/HBaseRowDataInputFormat.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1.source;
-
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.connector.hbase.util.HBaseSerde;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.data.RowData;
-
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.Scan;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-/**
- * {@link InputFormat} subclass that wraps the access for HTables. Returns the result as {@link
- * RowData}
- */
-public class HBaseRowDataInputFormat extends AbstractTableInputFormat<RowData> {
- private static final long serialVersionUID = 1L;
- private static final Logger LOG = LoggerFactory.getLogger(HBaseRowDataInputFormat.class);
-
- private final String tableName;
- private final HBaseTableSchema schema;
- private final String nullStringLiteral;
-
- private transient HBaseSerde serde;
-
- public HBaseRowDataInputFormat(
- org.apache.hadoop.conf.Configuration conf,
- String tableName,
- HBaseTableSchema schema,
- String nullStringLiteral) {
- super(conf);
- this.tableName = tableName;
- this.schema = schema;
- this.nullStringLiteral = nullStringLiteral;
- }
-
- @Override
- protected void initTable() throws IOException {
- this.serde = new HBaseSerde(schema, nullStringLiteral);
- if (table == null) {
- connectToTable();
- }
- if (table != null && scan == null) {
- scan = getScanner();
- }
- }
-
- @Override
- protected Scan getScanner() {
- return serde.createScan();
- }
-
- @Override
- public String getTableName() {
- return tableName;
- }
-
- @Override
- protected RowData mapResultToOutType(Result res) {
- return serde.convertToReusedRow(res);
- }
-
- private void connectToTable() throws IOException {
- try {
- connection = ConnectionFactory.createConnection(getHadoopConfiguration());
- table = (HTable) connection.getTable(TableName.valueOf(tableName));
- } catch (TableNotFoundException tnfe) {
- LOG.error("The table " + tableName + " not found ", tnfe);
- throw new RuntimeException("HBase table '" + tableName + "' not found.", tnfe);
- }
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory b/flink-connectors/flink-connector-hbase-1.4/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory
deleted file mode 100644
index 0b6f75d3094..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-org.apache.flink.connector.hbase1.HBase1DynamicTableFactory
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
deleted file mode 100644
index 1854cf377f0..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.architecture;
-
-import org.apache.flink.architecture.common.ImportOptions;
-
-import com.tngtech.archunit.core.importer.ImportOption;
-import com.tngtech.archunit.junit.AnalyzeClasses;
-import com.tngtech.archunit.junit.ArchTest;
-import com.tngtech.archunit.junit.ArchTests;
-
-/** Architecture tests for test code. */
-@AnalyzeClasses(
- packages = "org.apache.flink.connector.hbase1",
- importOptions = {
- ImportOption.OnlyIncludeTests.class,
- ImportOptions.ExcludeScalaImportOption.class,
- ImportOptions.ExcludeShadedImportOption.class
- })
-public class TestCodeArchitectureTest {
-
- @ArchTest
- public static final ArchTests COMMON_TESTS = ArchTests.in(TestCodeArchitectureTestBase.class);
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseConnectorITCase.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseConnectorITCase.java
deleted file mode 100644
index ad5b5def0db..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseConnectorITCase.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1;
-
-import org.apache.flink.api.common.typeinfo.TypeInformation;
-import org.apache.flink.api.common.typeinfo.Types;
-import org.apache.flink.api.java.typeutils.RowTypeInfo;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase1.source.AbstractTableInputFormat;
-import org.apache.flink.connector.hbase1.source.HBaseRowDataInputFormat;
-import org.apache.flink.connector.hbase1.util.HBaseTestBase;
-import org.apache.flink.streaming.api.datastream.DataStream;
-import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-import org.apache.flink.table.api.Table;
-import org.apache.flink.table.api.TableEnvironment;
-import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
-import org.apache.flink.table.functions.ScalarFunction;
-import org.apache.flink.test.util.TestBaseUtils;
-import org.apache.flink.types.Row;
-import org.apache.flink.util.CollectionUtil;
-
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.apache.flink.table.api.Expressions.$;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/** IT cases for HBase connector (source and sink). */
-public class HBaseConnectorITCase extends HBaseTestBase {
-
- // -------------------------------------------------------------------------------------
- // HBaseTableSource tests
- // -------------------------------------------------------------------------------------
-
- @Test
- public void testTableSourceFullScan() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- Table table =
- tEnv.sqlQuery(
- "SELECT "
- + " h.family1.col1, "
- + " h.family2.col1, "
- + " h.family2.col2, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3 "
- + "FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[10, Hello-1, 100, 1.01, false, Welt-1]\n"
- + "+I[20, Hello-2, 200, 2.02, true, Welt-2]\n"
- + "+I[30, Hello-3, 300, 3.03, false, Welt-3]\n"
- + "+I[40, null, 400, 4.04, true, Welt-4]\n"
- + "+I[50, Hello-5, 500, 5.05, false, Welt-5]\n"
- + "+I[60, Hello-6, 600, 6.06, true, Welt-6]\n"
- + "+I[70, Hello-7, 700, 7.07, false, Welt-7]\n"
- + "+I[80, null, 800, 8.08, true, Welt-8]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceProjection() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- Table table =
- tEnv.sqlQuery(
- "SELECT "
- + " h.family1.col1, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3 "
- + "FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[10, 1.01, false, Welt-1]\n"
- + "+I[20, 2.02, true, Welt-2]\n"
- + "+I[30, 3.03, false, Welt-3]\n"
- + "+I[40, 4.04, true, Welt-4]\n"
- + "+I[50, 5.05, false, Welt-5]\n"
- + "+I[60, 6.06, true, Welt-6]\n"
- + "+I[70, 7.07, false, Welt-7]\n"
- + "+I[80, 8.08, true, Welt-8]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceFieldOrder() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " rowkey INT PRIMARY KEY NOT ENFORCED,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " family1 ROW<col1 INT>"
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- Table table = tEnv.sqlQuery("SELECT * FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[1, +I[Hello-1, 100], +I[1.01, false, Welt-1], +I[10]]\n"
- + "+I[2, +I[Hello-2, 200], +I[2.02, true, Welt-2], +I[20]]\n"
- + "+I[3, +I[Hello-3, 300], +I[3.03, false, Welt-3], +I[30]]\n"
- + "+I[4, +I[null, 400], +I[4.04, true, Welt-4], +I[40]]\n"
- + "+I[5, +I[Hello-5, 500], +I[5.05, false, Welt-5], +I[50]]\n"
- + "+I[6, +I[Hello-6, 600], +I[6.06, true, Welt-6], +I[60]]\n"
- + "+I[7, +I[Hello-7, 700], +I[7.07, false, Welt-7], +I[70]]\n"
- + "+I[8, +I[null, 800], +I[8.08, true, Welt-8], +I[80]]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceReadAsByteArray() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " family2 ROW<col1 BYTES, col2 BYTES>,"
- + " rowkey INT"
- + // no primary key syntax
- ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
- tEnv.registerFunction("toUTF8", new ToUTF8());
- tEnv.registerFunction("toLong", new ToLong());
-
- Table table =
- tEnv.sqlQuery(
- "SELECT "
- + " toUTF8(h.family2.col1), "
- + " toLong(h.family2.col2) "
- + "FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[Hello-1, 100]\n"
- + "+I[Hello-2, 200]\n"
- + "+I[Hello-3, 300]\n"
- + "+I[null, 400]\n"
- + "+I[Hello-5, 500]\n"
- + "+I[Hello-6, 600]\n"
- + "+I[Hello-7, 700]\n"
- + "+I[null, 800]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSink() throws Exception {
- StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
- StreamTableEnvironment tEnv = StreamTableEnvironment.create(execEnv, streamSettings);
-
- // register HBase table testTable1 which contains test data
- String table1DDL = createHBaseTableDDL(TEST_TABLE_1, false);
- tEnv.executeSql(table1DDL);
-
- String table2DDL = createHBaseTableDDL(TEST_TABLE_2, false);
- tEnv.executeSql(table2DDL);
-
- String query =
- "INSERT INTO "
- + TEST_TABLE_2
- + " SELECT"
- + " rowkey,"
- + " family1,"
- + " family2,"
- + " family3"
- + " FROM "
- + TEST_TABLE_1;
-
- tEnv.executeSql(query).await();
-
- // start a batch scan job to verify contents in HBase table
- TableEnvironment batchEnv = TableEnvironment.create(batchSettings);
- batchEnv.executeSql(table2DDL);
-
- Table table =
- batchEnv.sqlQuery(
- "SELECT "
- + " h.rowkey, "
- + " h.family1.col1, "
- + " h.family2.col1, "
- + " h.family2.col2, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3 "
- + "FROM "
- + TEST_TABLE_2
- + " AS h");
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[1, 10, Hello-1, 100, 1.01, false, Welt-1]\n"
- + "+I[2, 20, Hello-2, 200, 2.02, true, Welt-2]\n"
- + "+I[3, 30, Hello-3, 300, 3.03, false, Welt-3]\n"
- + "+I[4, 40, null, 400, 4.04, true, Welt-4]\n"
- + "+I[5, 50, Hello-5, 500, 5.05, false, Welt-5]\n"
- + "+I[6, 60, Hello-6, 600, 6.06, true, Welt-6]\n"
- + "+I[7, 70, Hello-7, 700, 7.07, false, Welt-7]\n"
- + "+I[8, 80, null, 800, 8.08, true, Welt-8]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceSinkWithDDL() throws Exception {
- StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
- StreamTableEnvironment tEnv = StreamTableEnvironment.create(execEnv, streamSettings);
-
- // register HBase table testTable1 which contains test data
- String table1DDL = createHBaseTableDDL(TEST_TABLE_1, true);
- tEnv.executeSql(table1DDL);
-
- // register HBase table which is empty
- String table3DDL = createHBaseTableDDL(TEST_TABLE_3, true);
- tEnv.executeSql(table3DDL);
-
- String insertStatement =
- "INSERT INTO "
- + TEST_TABLE_3
- + " SELECT rowkey,"
- + " family1,"
- + " family2,"
- + " family3,"
- + " family4"
- + " from "
- + TEST_TABLE_1;
- tEnv.executeSql(insertStatement).await();
-
- // start a batch scan job to verify contents in HBase table
- TableEnvironment batchEnv = TableEnvironment.create(batchSettings);
- batchEnv.executeSql(table3DDL);
- String query =
- "SELECT "
- + " h.rowkey, "
- + " h.family1.col1, "
- + " h.family2.col1, "
- + " h.family2.col2, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3, "
- + " h.family4.col1, "
- + " h.family4.col2, "
- + " h.family4.col3, "
- + " h.family4.col4 "
- + " FROM "
- + TEST_TABLE_3
- + " AS h";
- Iterator<Row> collected = tEnv.executeSql(query).collect();
- List<String> result =
- CollectionUtil.iteratorToList(collected).stream()
- .map(Row::toString)
- .sorted()
- .collect(Collectors.toList());
-
- List<String> expected = new ArrayList<>();
- expected.add(
- "+I[1, 10, Hello-1, 100, 1.01, false, Welt-1, 2019-08-18T19:00, 2019-08-18, 19:00, 12345678.0001]");
- expected.add(
- "+I[2, 20, Hello-2, 200, 2.02, true, Welt-2, 2019-08-18T19:01, 2019-08-18, 19:01, 12345678.0002]");
- expected.add(
- "+I[3, 30, Hello-3, 300, 3.03, false, Welt-3, 2019-08-18T19:02, 2019-08-18, 19:02, 12345678.0003]");
- expected.add(
- "+I[4, 40, null, 400, 4.04, true, Welt-4, 2019-08-18T19:03, 2019-08-18, 19:03, 12345678.0004]");
- expected.add(
- "+I[5, 50, Hello-5, 500, 5.05, false, Welt-5, 2019-08-19T19:10, 2019-08-19, 19:10, 12345678.0005]");
- expected.add(
- "+I[6, 60, Hello-6, 600, 6.06, true, Welt-6, 2019-08-19T19:20, 2019-08-19, 19:20, 12345678.0006]");
- expected.add(
- "+I[7, 70, Hello-7, 700, 7.07, false, Welt-7, 2019-08-19T19:30, 2019-08-19, 19:30, 12345678.0007]");
- expected.add(
- "+I[8, 80, null, 800, 8.08, true, Welt-8, 2019-08-19T19:40, 2019-08-19, 19:40, 12345678.0008]");
- assertEquals(expected, result);
- }
-
- @Test
- public void testHBaseLookupTableSource() {
- StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
- StreamTableEnvironment tEnv = StreamTableEnvironment.create(execEnv, streamSettings);
-
- tEnv.executeSql(
- "CREATE TABLE "
- + TEST_TABLE_1
- + " ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " family4 ROW<col1 TIMESTAMP(3), col2 DATE, col3 TIME(3), col4 DECIMAL(12, 4)>,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- // prepare a source table
- String srcTableName = "src";
- DataStream<Row> srcDs = execEnv.fromCollection(testData).returns(testTypeInfo);
- Table in = tEnv.fromDataStream(srcDs, $("a"), $("b"), $("c"), $("proc").proctime());
- tEnv.createTemporaryView(srcTableName, in);
-
- // perform a temporal table join query
- String dimJoinQuery =
- "SELECT"
- + " a,"
- + " b,"
- + " h.family1.col1,"
- + " h.family2.col1,"
- + " h.family2.col2,"
- + " h.family3.col1,"
- + " h.family3.col2,"
- + " h.family3.col3,"
- + " h.family4.col1,"
- + " h.family4.col2,"
- + " h.family4.col3,"
- + " h.family4.col4 "
- + " FROM src JOIN "
- + TEST_TABLE_1
- + " FOR SYSTEM_TIME AS OF src.proc as h ON src.a = h.rowkey";
- Iterator<Row> collected = tEnv.executeSql(dimJoinQuery).collect();
- List<String> result =
- CollectionUtil.iteratorToList(collected).stream()
- .map(Row::toString)
- .sorted()
- .collect(Collectors.toList());
-
- List<String> expected = new ArrayList<>();
- expected.add(
- "+I[1, 1, 10, Hello-1, 100, 1.01, false, Welt-1, 2019-08-18T19:00, 2019-08-18, 19:00, 12345678.0001]");
- expected.add(
- "+I[2, 2, 20, Hello-2, 200, 2.02, true, Welt-2, 2019-08-18T19:01, 2019-08-18, 19:01, 12345678.0002]");
- expected.add(
- "+I[3, 2, 30, Hello-3, 300, 3.03, false, Welt-3, 2019-08-18T19:02, 2019-08-18, 19:02, 12345678.0003]");
- expected.add(
- "+I[3, 3, 30, Hello-3, 300, 3.03, false, Welt-3, 2019-08-18T19:02, 2019-08-18, 19:02, 12345678.0003]");
-
- assertEquals(expected, result);
- }
-
- @Test
- public void testTableInputFormatOpenClose() throws IOException {
- HBaseTableSchema tableSchema = new HBaseTableSchema();
- tableSchema.addColumn(FAMILY1, F1COL1, byte[].class);
- AbstractTableInputFormat<?> inputFormat =
- new HBaseRowDataInputFormat(getConf(), TEST_TABLE_1, tableSchema, "null");
- inputFormat.open(inputFormat.createInputSplits(1)[0]);
- assertNotNull(inputFormat.getConnection());
- assertNotNull(inputFormat.getConnection().getTable(TableName.valueOf(TEST_TABLE_1)));
-
- inputFormat.close();
- assertNull(inputFormat.getConnection());
- }
-
- // -------------------------------------------------------------------------------------
- // HBase lookup source tests
- // -------------------------------------------------------------------------------------
-
- // prepare a source collection.
- private static final List<Row> testData = new ArrayList<>();
- private static final RowTypeInfo testTypeInfo =
- new RowTypeInfo(
- new TypeInformation[] {Types.INT, Types.LONG, Types.STRING},
- new String[] {"a", "b", "c"});
-
- static {
- testData.add(Row.of(1, 1L, "Hi"));
- testData.add(Row.of(2, 2L, "Hello"));
- testData.add(Row.of(3, 2L, "Hello world"));
- testData.add(Row.of(3, 3L, "Hello world!"));
- }
-
- // ------------------------------- Utilities -------------------------------------------------
-
- /** A {@link ScalarFunction} that maps byte arrays to UTF-8 strings. */
- public static class ToUTF8 extends ScalarFunction {
- private static final long serialVersionUID = 1L;
-
- public String eval(byte[] bytes) {
- return Bytes.toString(bytes);
- }
- }
-
- /** A {@link ScalarFunction} that maps byte array to longs. */
- public static class ToLong extends ScalarFunction {
- private static final long serialVersionUID = 1L;
-
- public long eval(byte[] bytes) {
- return Bytes.toLong(bytes);
- }
- }
-
- private String createHBaseTableDDL(String tableName, boolean testTimeAndDecimalTypes) {
- StringBuilder family4Statement = new StringBuilder();
- if (testTimeAndDecimalTypes) {
- family4Statement.append(", family4 ROW<col1 TIMESTAMP(3)");
- family4Statement.append(", col2 DATE");
- family4Statement.append(", col3 TIME(3)");
- family4Statement.append(", col4 DECIMAL(12, 4)");
- family4Statement.append("> \n");
- }
-
- return "CREATE TABLE "
- + tableName
- + "(\n"
- + " rowkey INT,"
- + " family1 ROW<col1 INT>,\n"
- + " family2 ROW<col1 VARCHAR, col2 BIGINT>,\n"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 VARCHAR>"
- + family4Statement.toString()
- + ") WITH (\n"
- + " 'connector' = 'hbase-1.4',\n"
- + " 'table-name' = '"
- + tableName
- + "',\n"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "',\n"
- + " 'zookeeper.znode.parent' = '/hbase' "
- + ")";
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseDynamicTableFactoryTest.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseDynamicTableFactoryTest.java
deleted file mode 100644
index 8a8f1d7068a..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseDynamicTableFactoryTest.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1;
-
-import org.apache.flink.api.common.typeinfo.Types;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.source.HBaseRowDataLookupFunction;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase1.sink.HBaseDynamicTableSink;
-import org.apache.flink.connector.hbase1.source.HBaseDynamicTableSource;
-import org.apache.flink.table.catalog.Column;
-import org.apache.flink.table.catalog.ResolvedSchema;
-import org.apache.flink.table.connector.sink.DynamicTableSink;
-import org.apache.flink.table.connector.sink.SinkFunctionProvider;
-import org.apache.flink.table.connector.source.DynamicTableSource;
-import org.apache.flink.table.connector.source.LookupTableSource;
-import org.apache.flink.table.connector.source.lookup.LookupFunctionProvider;
-import org.apache.flink.table.connector.source.lookup.cache.DefaultLookupCache;
-import org.apache.flink.table.functions.LookupFunction;
-import org.apache.flink.table.runtime.connector.sink.SinkRuntimeProviderContext;
-import org.apache.flink.table.runtime.connector.source.LookupRuntimeProviderContext;
-import org.apache.flink.table.types.DataType;
-import org.apache.flink.util.ExceptionUtils;
-
-import org.apache.commons.collections.IteratorUtils;
-import org.apache.hadoop.hbase.HConstants;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import java.time.Duration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-import static org.apache.flink.connector.hbase.util.HBaseConfigurationUtil.getHBaseConfiguration;
-import static org.apache.flink.table.api.DataTypes.BIGINT;
-import static org.apache.flink.table.api.DataTypes.BOOLEAN;
-import static org.apache.flink.table.api.DataTypes.DATE;
-import static org.apache.flink.table.api.DataTypes.DECIMAL;
-import static org.apache.flink.table.api.DataTypes.DOUBLE;
-import static org.apache.flink.table.api.DataTypes.FIELD;
-import static org.apache.flink.table.api.DataTypes.INT;
-import static org.apache.flink.table.api.DataTypes.ROW;
-import static org.apache.flink.table.api.DataTypes.STRING;
-import static org.apache.flink.table.api.DataTypes.TIME;
-import static org.apache.flink.table.api.DataTypes.TIMESTAMP;
-import static org.apache.flink.table.factories.utils.FactoryMocks.createTableSink;
-import static org.apache.flink.table.factories.utils.FactoryMocks.createTableSource;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/** Unit test for {@link HBase1DynamicTableFactory}. */
-public class HBaseDynamicTableFactoryTest {
-
- private static final String FAMILY1 = "f1";
- private static final String FAMILY2 = "f2";
- private static final String FAMILY3 = "f3";
- private static final String FAMILY4 = "f4";
- private static final String COL1 = "c1";
- private static final String COL2 = "c2";
- private static final String COL3 = "c3";
- private static final String COL4 = "c4";
- private static final String ROWKEY = "rowkey";
-
- @Rule public final ExpectedException thrown = ExpectedException.none();
-
- @SuppressWarnings("rawtypes")
- @Test
- public void testTableSourceFactory() {
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(FAMILY1, ROW(FIELD(COL1, INT()))),
- Column.physical(FAMILY2, ROW(FIELD(COL1, INT()), FIELD(COL2, BIGINT()))),
- Column.physical(ROWKEY, BIGINT()),
- Column.physical(
- FAMILY3,
- ROW(
- FIELD(COL1, DOUBLE()),
- FIELD(COL2, BOOLEAN()),
- FIELD(COL3, STRING()))),
- Column.physical(
- FAMILY4,
- ROW(
- FIELD(COL1, DECIMAL(10, 3)),
- FIELD(COL2, TIMESTAMP(3)),
- FIELD(COL3, DATE()),
- FIELD(COL4, TIME()))));
-
- DynamicTableSource source = createTableSource(schema, getAllOptions());
- assertTrue(source instanceof HBaseDynamicTableSource);
- HBaseDynamicTableSource hbaseSource = (HBaseDynamicTableSource) source;
-
- int[][] lookupKey = {{2}};
- LookupTableSource.LookupRuntimeProvider lookupProvider =
- hbaseSource.getLookupRuntimeProvider(new LookupRuntimeProviderContext(lookupKey));
- assertTrue(lookupProvider instanceof LookupFunctionProvider);
-
- LookupFunction tableFunction =
- ((LookupFunctionProvider) lookupProvider).createLookupFunction();
- assertTrue(tableFunction instanceof HBaseRowDataLookupFunction);
- assertEquals(
- "testHBastTable", ((HBaseRowDataLookupFunction) tableFunction).getHTableName());
-
- HBaseTableSchema hbaseSchema = hbaseSource.getHBaseTableSchema();
- assertEquals(2, hbaseSchema.getRowKeyIndex());
- assertEquals(Optional.of(Types.LONG), hbaseSchema.getRowKeyTypeInfo());
-
- assertArrayEquals(new String[] {"f1", "f2", "f3", "f4"}, hbaseSchema.getFamilyNames());
- assertArrayEquals(new String[] {"c1"}, hbaseSchema.getQualifierNames("f1"));
- assertArrayEquals(new String[] {"c1", "c2"}, hbaseSchema.getQualifierNames("f2"));
- assertArrayEquals(new String[] {"c1", "c2", "c3"}, hbaseSchema.getQualifierNames("f3"));
- assertArrayEquals(
- new String[] {"c1", "c2", "c3", "c4"}, hbaseSchema.getQualifierNames("f4"));
-
- assertArrayEquals(new DataType[] {INT()}, hbaseSchema.getQualifierDataTypes("f1"));
- assertArrayEquals(
- new DataType[] {INT(), BIGINT()}, hbaseSchema.getQualifierDataTypes("f2"));
- assertArrayEquals(
- new DataType[] {DOUBLE(), BOOLEAN(), STRING()},
- hbaseSchema.getQualifierDataTypes("f3"));
- assertArrayEquals(
- new DataType[] {DECIMAL(10, 3), TIMESTAMP(3), DATE(), TIME()},
- hbaseSchema.getQualifierDataTypes("f4"));
- }
-
- @Test
- public void testLookupOptions() {
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
- Map<String, String> options = getAllOptions();
- options.put("lookup.cache", "PARTIAL");
- options.put("lookup.partial-cache.expire-after-access", "15213s");
- options.put("lookup.partial-cache.expire-after-write", "18213s");
- options.put("lookup.partial-cache.max-rows", "10000");
- options.put("lookup.partial-cache.cache-missing-key", "false");
- options.put("lookup.max-retries", "15513");
-
- DynamicTableSource source = createTableSource(schema, options);
- HBaseDynamicTableSource hbaseSource = (HBaseDynamicTableSource) source;
- assertThat(((HBaseDynamicTableSource) source).getMaxRetryTimes()).isEqualTo(15513);
- assertThat(hbaseSource.getCache()).isInstanceOf(DefaultLookupCache.class);
- DefaultLookupCache cache = (DefaultLookupCache) hbaseSource.getCache();
- assertThat(cache)
- .isEqualTo(
- DefaultLookupCache.newBuilder()
- .expireAfterAccess(Duration.ofSeconds(15213))
- .expireAfterWrite(Duration.ofSeconds(18213))
- .maximumSize(10000)
- .cacheMissingKey(false)
- .build());
- }
-
- @Test
- public void testTableSinkFactory() {
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))),
- Column.physical(FAMILY2, ROW(FIELD(COL1, INT()), FIELD(COL3, BIGINT()))),
- Column.physical(
- FAMILY3, ROW(FIELD(COL2, BOOLEAN()), FIELD(COL3, STRING()))),
- Column.physical(
- FAMILY4,
- ROW(
- FIELD(COL1, DECIMAL(10, 3)),
- FIELD(COL2, TIMESTAMP(3)),
- FIELD(COL3, DATE()),
- FIELD(COL4, TIME()))));
-
- DynamicTableSink sink = createTableSink(schema, getAllOptions());
- assertTrue(sink instanceof HBaseDynamicTableSink);
- HBaseDynamicTableSink hbaseSink = (HBaseDynamicTableSink) sink;
-
- HBaseTableSchema hbaseSchema = hbaseSink.getHBaseTableSchema();
- assertEquals(0, hbaseSchema.getRowKeyIndex());
- assertEquals(Optional.of(STRING()), hbaseSchema.getRowKeyDataType());
-
- assertArrayEquals(new String[] {"f1", "f2", "f3", "f4"}, hbaseSchema.getFamilyNames());
- assertArrayEquals(new String[] {"c1", "c2"}, hbaseSchema.getQualifierNames("f1"));
- assertArrayEquals(new String[] {"c1", "c3"}, hbaseSchema.getQualifierNames("f2"));
- assertArrayEquals(new String[] {"c2", "c3"}, hbaseSchema.getQualifierNames("f3"));
- assertArrayEquals(
- new String[] {"c1", "c2", "c3", "c4"}, hbaseSchema.getQualifierNames("f4"));
-
- assertArrayEquals(
- new DataType[] {DOUBLE(), INT()}, hbaseSchema.getQualifierDataTypes("f1"));
- assertArrayEquals(
- new DataType[] {INT(), BIGINT()}, hbaseSchema.getQualifierDataTypes("f2"));
- assertArrayEquals(
- new DataType[] {BOOLEAN(), STRING()}, hbaseSchema.getQualifierDataTypes("f3"));
- assertArrayEquals(
- new DataType[] {DECIMAL(10, 3), TIMESTAMP(3), DATE(), TIME()},
- hbaseSchema.getQualifierDataTypes("f4"));
-
- // verify hadoop Configuration
- org.apache.hadoop.conf.Configuration expectedConfiguration = getHBaseConfiguration();
- expectedConfiguration.set(HConstants.ZOOKEEPER_QUORUM, "localhost:2181");
- expectedConfiguration.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/flink");
- expectedConfiguration.set("hbase.security.authentication", "kerberos");
-
- org.apache.hadoop.conf.Configuration actualConfiguration = hbaseSink.getConfiguration();
-
- assertEquals(
- IteratorUtils.toList(expectedConfiguration.iterator()),
- IteratorUtils.toList(actualConfiguration.iterator()));
-
- // verify tableName
- assertEquals("testHBastTable", hbaseSink.getTableName());
-
- HBaseWriteOptions expectedWriteOptions =
- HBaseWriteOptions.builder()
- .setBufferFlushMaxRows(1000)
- .setBufferFlushIntervalMillis(1000)
- .setBufferFlushMaxSizeInBytes(2 * 1024 * 1024)
- .build();
- HBaseWriteOptions actualWriteOptions = hbaseSink.getWriteOptions();
- assertEquals(expectedWriteOptions, actualWriteOptions);
- }
-
- @Test
- public void testBufferFlushOptions() {
- Map<String, String> options = getAllOptions();
- options.put("sink.buffer-flush.max-size", "10mb");
- options.put("sink.buffer-flush.max-rows", "100");
- options.put("sink.buffer-flush.interval", "10s");
-
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
-
- DynamicTableSink sink = createTableSink(schema, options);
- HBaseWriteOptions expected =
- HBaseWriteOptions.builder()
- .setBufferFlushMaxRows(100)
- .setBufferFlushIntervalMillis(10 * 1000)
- .setBufferFlushMaxSizeInBytes(10 * 1024 * 1024)
- .build();
- HBaseWriteOptions actual = ((HBaseDynamicTableSink) sink).getWriteOptions();
- assertEquals(expected, actual);
- }
-
- @Test
- public void testParallelismOptions() {
- Map<String, String> options = getAllOptions();
- options.put("sink.parallelism", "2");
-
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
-
- DynamicTableSink sink = createTableSink(schema, options);
- assertTrue(sink instanceof HBaseDynamicTableSink);
- HBaseDynamicTableSink hbaseSink = (HBaseDynamicTableSink) sink;
- SinkFunctionProvider provider =
- (SinkFunctionProvider)
- hbaseSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false));
- assertEquals(2, (long) provider.getParallelism().get());
- }
-
- @Test
- public void testDisabledBufferFlushOptions() {
- Map<String, String> options = getAllOptions();
- options.put("sink.buffer-flush.max-size", "0");
- options.put("sink.buffer-flush.max-rows", "0");
- options.put("sink.buffer-flush.interval", "0");
-
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
-
- DynamicTableSink sink = createTableSink(schema, options);
- HBaseWriteOptions expected =
- HBaseWriteOptions.builder()
- .setBufferFlushMaxRows(0)
- .setBufferFlushIntervalMillis(0)
- .setBufferFlushMaxSizeInBytes(0)
- .build();
- HBaseWriteOptions actual = ((HBaseDynamicTableSink) sink).getWriteOptions();
- assertEquals(expected, actual);
- }
-
- @Test
- public void testUnknownOption() {
- Map<String, String> options = getAllOptions();
- options.put("sink.unknown.key", "unknown-value");
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))));
-
- try {
- createTableSource(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e, "Unsupported options:\n\nsink.unknown.key")
- .isPresent());
- }
-
- try {
- createTableSink(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e, "Unsupported options:\n\nsink.unknown.key")
- .isPresent());
- }
- }
-
- @Test
- public void testTypeWithUnsupportedPrecision() {
- Map<String, String> options = getAllOptions();
- // test unsupported timestamp precision
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(
- FAMILY1, ROW(FIELD(COL1, TIMESTAMP(6)), FIELD(COL2, INT()))));
- try {
- createTableSource(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIMESTAMP type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
-
- try {
- createTableSink(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIMESTAMP type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
- // test unsupported time precision
- schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, TIME(6)), FIELD(COL2, INT()))));
-
- try {
- createTableSource(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIME type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
-
- try {
- createTableSink(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIME type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
- }
-
- private Map<String, String> getAllOptions() {
- Map<String, String> options = new HashMap<>();
- options.put("connector", "hbase-1.4");
- options.put("table-name", "testHBastTable");
- options.put("zookeeper.quorum", "localhost:2181");
- options.put("zookeeper.znode.parent", "/flink");
- options.put("properties.hbase.security.authentication", "kerberos");
- return options;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseTablePlanTest.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseTablePlanTest.java
deleted file mode 100644
index f6e1ec19289..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseTablePlanTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1;
-
-import org.apache.flink.table.api.TableConfig;
-import org.apache.flink.table.planner.utils.StreamTableTestUtil;
-import org.apache.flink.table.planner.utils.TableTestBase;
-
-import org.junit.Test;
-
-import static org.apache.flink.core.testutils.FlinkMatchers.containsCause;
-
-/** Plan tests for HBase connector, for example, testing projection push down. */
-public class HBaseTablePlanTest extends TableTestBase {
-
- private final StreamTableTestUtil util = streamTestUtil(TableConfig.getDefault());
-
- @Test
- public void testMultipleRowKey() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " rowkey INT,"
- + " rowkey2 STRING "
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "Row key can't be set multiple times.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testNoneRowKey() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>"
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "HBase table requires to define a row key field. "
- + "A row key field is defined as an atomic type, "
- + "column families and qualifiers are defined as ROW type.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testInvalidPrimaryKey() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " rowkey STRING, "
- + " PRIMARY KEY (family1) NOT ENFORCED "
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "Primary key of HBase table must be defined on the row key field. "
- + "A row key field is defined as an atomic type, "
- + "column families and qualifiers are defined as ROW type.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testUnsupportedDataType() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " col1 ARRAY<STRING>, "
- + " rowkey STRING, "
- + " PRIMARY KEY (rowkey) NOT ENFORCED "
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "Unsupported field type 'ARRAY<STRING>' for HBase.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testProjectionPushDown() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-1.4',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- util.verifyExecPlan("SELECT h.family3, h.family2.col2 FROM hTable AS h");
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/util/HBaseTestBase.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/util/HBaseTestBase.java
deleted file mode 100644
index cc2de79e668..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/util/HBaseTestBase.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1.util;
-
-import org.apache.flink.table.api.EnvironmentSettings;
-
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.apache.flink.table.utils.DateTimeUtils.toInternal;
-
-/** Abstract IT case class for HBase. */
-public abstract class HBaseTestBase extends HBaseTestingClusterAutoStarter {
-
- protected static final String TEST_TABLE_1 = "testTable1";
- protected static final String TEST_TABLE_2 = "testTable2";
- protected static final String TEST_TABLE_3 = "testTable3";
-
- protected static final String ROW_KEY = "rowkey";
-
- protected static final String FAMILY1 = "family1";
- protected static final String F1COL1 = "col1";
-
- protected static final String FAMILY2 = "family2";
- protected static final String F2COL1 = "col1";
- protected static final String F2COL2 = "col2";
-
- protected static final String FAMILY3 = "family3";
- protected static final String F3COL1 = "col1";
- protected static final String F3COL2 = "col2";
- protected static final String F3COL3 = "col3";
-
- protected static final String FAMILY4 = "family4";
- protected static final String F4COL1 = "col1";
- protected static final String F4COL2 = "col2";
- protected static final String F4COL3 = "col3";
- protected static final String F4COL4 = "col4";
-
- private static final byte[][] FAMILIES =
- new byte[][] {
- Bytes.toBytes(FAMILY1),
- Bytes.toBytes(FAMILY2),
- Bytes.toBytes(FAMILY3),
- Bytes.toBytes(FAMILY4)
- };
-
- private static final byte[][] SPLIT_KEYS = new byte[][] {Bytes.toBytes(4)};
-
- protected EnvironmentSettings streamSettings;
- protected EnvironmentSettings batchSettings;
-
- @BeforeClass
- public static void activateHBaseCluster() throws IOException {
- prepareTables();
- }
-
- @Before
- public void before() {
- this.streamSettings = EnvironmentSettings.inStreamingMode();
- this.batchSettings = EnvironmentSettings.inBatchMode();
- }
-
- private static void prepareTables() throws IOException {
- createHBaseTable1();
- createHBaseTable2();
- createHBaseTable3();
- }
-
- private static void createHBaseTable1() throws IOException {
- // create a table
- TableName tableName = TableName.valueOf(TEST_TABLE_1);
- createTable(tableName, FAMILIES, SPLIT_KEYS);
-
- // get the HTable instance
- HTable table = openTable(tableName);
- List<Put> puts = new ArrayList<>();
- // add some data
- puts.add(
- putRow(
- 1,
- 10,
- "Hello-1",
- 100L,
- 1.01,
- false,
- "Welt-1",
- Timestamp.valueOf("2019-08-18 19:00:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:00:00"),
- new BigDecimal("12345678.0001")));
- puts.add(
- putRow(
- 2,
- 20,
- "Hello-2",
- 200L,
- 2.02,
- true,
- "Welt-2",
- Timestamp.valueOf("2019-08-18 19:01:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:01:00"),
- new BigDecimal("12345678.0002")));
- puts.add(
- putRow(
- 3,
- 30,
- "Hello-3",
- 300L,
- 3.03,
- false,
- "Welt-3",
- Timestamp.valueOf("2019-08-18 19:02:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:02:00"),
- new BigDecimal("12345678.0003")));
- puts.add(
- putRow(
- 4,
- 40,
- null,
- 400L,
- 4.04,
- true,
- "Welt-4",
- Timestamp.valueOf("2019-08-18 19:03:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:03:00"),
- new BigDecimal("12345678.0004")));
- puts.add(
- putRow(
- 5,
- 50,
- "Hello-5",
- 500L,
- 5.05,
- false,
- "Welt-5",
- Timestamp.valueOf("2019-08-19 19:10:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:10:00"),
- new BigDecimal("12345678.0005")));
- puts.add(
- putRow(
- 6,
- 60,
- "Hello-6",
- 600L,
- 6.06,
- true,
- "Welt-6",
- Timestamp.valueOf("2019-08-19 19:20:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:20:00"),
- new BigDecimal("12345678.0006")));
- puts.add(
- putRow(
- 7,
- 70,
- "Hello-7",
- 700L,
- 7.07,
- false,
- "Welt-7",
- Timestamp.valueOf("2019-08-19 19:30:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:30:00"),
- new BigDecimal("12345678.0007")));
- puts.add(
- putRow(
- 8,
- 80,
- null,
- 800L,
- 8.08,
- true,
- "Welt-8",
- Timestamp.valueOf("2019-08-19 19:40:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:40:00"),
- new BigDecimal("12345678.0008")));
-
- // append rows to table
- table.put(puts);
- table.close();
- }
-
- private static void createHBaseTable2() {
- // create a table
- TableName tableName = TableName.valueOf(TEST_TABLE_2);
- createTable(tableName, FAMILIES, SPLIT_KEYS);
- }
-
- private static void createHBaseTable3() {
- // create a table
- byte[][] families =
- new byte[][] {
- Bytes.toBytes(FAMILY1),
- Bytes.toBytes(FAMILY2),
- Bytes.toBytes(FAMILY3),
- Bytes.toBytes(FAMILY4),
- };
- TableName tableName = TableName.valueOf(TEST_TABLE_3);
- createTable(tableName, families, SPLIT_KEYS);
- }
-
- private static Put putRow(
- int rowKey,
- int f1c1,
- String f2c1,
- long f2c2,
- double f3c1,
- boolean f3c2,
- String f3c3,
- Timestamp f4c1,
- Date f4c2,
- Time f4c3,
- BigDecimal f4c4) {
- Put put = new Put(Bytes.toBytes(rowKey));
- // family 1
- put.addColumn(Bytes.toBytes(FAMILY1), Bytes.toBytes(F1COL1), Bytes.toBytes(f1c1));
- // family 2
- if (f2c1 != null) {
- put.addColumn(Bytes.toBytes(FAMILY2), Bytes.toBytes(F2COL1), Bytes.toBytes(f2c1));
- }
- put.addColumn(Bytes.toBytes(FAMILY2), Bytes.toBytes(F2COL2), Bytes.toBytes(f2c2));
- // family 3
- put.addColumn(Bytes.toBytes(FAMILY3), Bytes.toBytes(F3COL1), Bytes.toBytes(f3c1));
- put.addColumn(Bytes.toBytes(FAMILY3), Bytes.toBytes(F3COL2), Bytes.toBytes(f3c2));
- put.addColumn(Bytes.toBytes(FAMILY3), Bytes.toBytes(F3COL3), Bytes.toBytes(f3c3));
-
- // family 4
- put.addColumn(
- Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL1), Bytes.toBytes(toInternal(f4c1)));
- put.addColumn(
- Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL2), Bytes.toBytes(toInternal(f4c2)));
- put.addColumn(
- Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL3), Bytes.toBytes(toInternal(f4c3)));
- put.addColumn(Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL4), Bytes.toBytes(f4c4));
- return put;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/util/HBaseTestingClusterAutoStarter.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/util/HBaseTestingClusterAutoStarter.java
deleted file mode 100644
index 45b71e66914..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/util/HBaseTestingClusterAutoStarter.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase1.util;
-
-import org.apache.flink.test.util.AbstractTestBase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.MasterNotRunningException;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.ZooKeeperConnectionException;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.util.VersionUtil;
-import org.junit.AfterClass;
-import org.junit.Assume;
-import org.junit.BeforeClass;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * By using this class as the super class of a set of tests you will have a HBase testing cluster
- * available that is very suitable for writing tests for scanning and filtering against. This is
- * usable by any downstream application because the HBase cluster is 'injected' because a
- * dynamically generated hbase-site.xml is added to the classpath. Because of this classpath
- * manipulation it is not possible to start a second testing cluster in the same JVM. So if you have
- * this you should either put all hbase related tests in a single class or force surefire to setup a
- * new JVM for each testclass. See:
- * http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
- */
-//
-// NOTE: The code in this file is based on code from the
-// Apache HBase project, licensed under the Apache License v 2.0
-//
-// https://github.com/apache/hbase/blob/master/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/FilterTestingCluster.java
-//
-public abstract class HBaseTestingClusterAutoStarter extends AbstractTestBase {
-
- private static final Log LOG = LogFactory.getLog(HBaseTestingClusterAutoStarter.class);
-
- private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
- private static HBaseAdmin admin = null;
- private static List<TableName> createdTables = new ArrayList<>();
-
- private static Configuration conf;
-
- protected static void createTable(
- TableName tableName, byte[][] columnFamilyName, byte[][] splitKeys) {
- LOG.info("HBase minicluster: Creating table " + tableName.getNameAsString());
-
- assertNotNull("HBaseAdmin is not initialized successfully.", admin);
- HTableDescriptor desc = new HTableDescriptor(tableName);
- for (byte[] fam : columnFamilyName) {
- HColumnDescriptor colDef = new HColumnDescriptor(fam);
- desc.addFamily(colDef);
- }
-
- try {
- admin.createTable(desc, splitKeys);
- createdTables.add(tableName);
- assertTrue("Fail to create the table", admin.tableExists(tableName));
- } catch (IOException e) {
- assertNull("Exception found while creating table", e);
- }
- }
-
- protected static HTable openTable(TableName tableName) throws IOException {
- HTable table = (HTable) admin.getConnection().getTable(tableName);
- assertTrue("Fail to create the table", admin.tableExists(tableName));
- return table;
- }
-
- private static void deleteTables() {
- if (admin != null) {
- for (TableName tableName : createdTables) {
- try {
- if (admin.tableExists(tableName)) {
- admin.disableTable(tableName);
- admin.deleteTable(tableName);
- }
- } catch (IOException e) {
- assertNull("Exception found deleting the table", e);
- }
- }
- }
- }
-
- private static void initialize(Configuration c) {
- conf = HBaseConfiguration.create(c);
- // the default retry number is 35 in hbase-1.4, set 35 for test
- conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 35);
- try {
- admin = TEST_UTIL.getHBaseAdmin();
- } catch (MasterNotRunningException e) {
- assertNull("Master is not running", e);
- } catch (ZooKeeperConnectionException e) {
- assertNull("Cannot connect to ZooKeeper", e);
- } catch (IOException e) {
- assertNull("IOException", e);
- }
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- // HBase 1.4 does not work with Hadoop 3
- // because it uses Guava 12.0.1, Hadoop 3 uses Guava 27.0-jre.
- // There is no Guava version in between that works with both.
- Assume.assumeTrue(
- "This test is skipped for Hadoop versions above 3",
- VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0);
-
- LOG.info("HBase minicluster: Starting");
-
- TEST_UTIL.startMiniCluster(1);
-
- // https://issues.apache.org/jira/browse/HBASE-11711
- TEST_UTIL.getConfiguration().setInt("hbase.master.info.port", -1);
-
- // Make sure the zookeeper quorum value contains the right port number (varies per run).
- LOG.info("Hbase minicluster client port: " + TEST_UTIL.getZkCluster().getClientPort());
- TEST_UTIL
- .getConfiguration()
- .set(
- "hbase.zookeeper.quorum",
- "localhost:" + TEST_UTIL.getZkCluster().getClientPort());
-
- initialize(TEST_UTIL.getConfiguration());
- LOG.info("HBase minicluster: Running");
- }
-
- /** Returns zookeeper quorum value contains the right port number (varies per run). */
- protected static String getZookeeperQuorum() {
- return "localhost:" + TEST_UTIL.getZkCluster().getClientPort();
- }
-
- public static Configuration getConf() {
- return conf;
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- if (conf == null) {
- LOG.info("Skipping Hbase tear down. It was never started");
- return;
- }
- LOG.info("HBase minicluster: Shutting down");
- deleteTables();
- TEST_UTIL.shutdownMiniCluster();
- LOG.info("HBase minicluster: Down");
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/slf4j/impl/Log4jLoggerAdapter.java b/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/slf4j/impl/Log4jLoggerAdapter.java
deleted file mode 100644
index 028780893c4..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/java/org/slf4j/impl/Log4jLoggerAdapter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.slf4j.impl;
-
-/** Fake appender to work around HBase referring to it directly. */
-public interface Log4jLoggerAdapter {}
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/archunit.properties b/flink-connectors/flink-connector-hbase-1.4/src/test/resources/archunit.properties
deleted file mode 100644
index 15be88c95ba..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/archunit.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# By default we allow removing existing violations, but fail when new violations are added.
-freeze.store.default.allowStoreUpdate=true
-
-# Enable this if a new (frozen) rule has been added in order to create the initial store and record the existing violations.
-#freeze.store.default.allowStoreCreation=true
-
-# Enable this to add allow new violations to be recorded.
-# NOTE: Adding new violations should be avoided when possible. If the rule was correct to flag a new
-# violation, please try to avoid creating the violation. If the violation was created due to a
-# shortcoming of the rule, file a JIRA issue so the rule can be improved.
-#freeze.refreeze=true
-
-freeze.store.default.path=archunit-violations
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/hbase-site.xml b/flink-connectors/flink-connector-hbase-1.4/src/test/resources/hbase-site.xml
deleted file mode 100644
index 1e58ef4a788..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/hbase-site.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- Values used when running unit tests. Specify any values in here that
- should override the default values. -->
-
-<configuration>
- <property>
- <name>hbase_conf_key</name>
- <value>hbase_conf_value!</value>
- </property>
-</configuration>
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/log4j2-test.properties b/flink-connectors/flink-connector-hbase-1.4/src/test/resources/log4j2-test.properties
deleted file mode 100644
index 835c2ec9a3d..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/log4j2-test.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-################################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-################################################################################
-
-# Set root logger level to OFF to not flood build logs
-# set manually to INFO for debugging purposes
-rootLogger.level = OFF
-rootLogger.appenderRef.test.ref = TestLogger
-
-appender.testlogger.name = TestLogger
-appender.testlogger.type = CONSOLE
-appender.testlogger.target = SYSTEM_ERR
-appender.testlogger.layout.type = PatternLayout
-appender.testlogger.layout.pattern = %-4r [%t] %-5p %c %x - %m%n
diff --git a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/org/apache/flink/connector/hbase1/HBaseTablePlanTest.xml b/flink-connectors/flink-connector-hbase-1.4/src/test/resources/org/apache/flink/connector/hbase1/HBaseTablePlanTest.xml
deleted file mode 100644
index 9885ccbebd0..00000000000
--- a/flink-connectors/flink-connector-hbase-1.4/src/test/resources/org/apache/flink/connector/hbase1/HBaseTablePlanTest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<Root>
- <TestCase name="testProjectionPushDown">
- <Resource name="sql">
- <![CDATA[SELECT h.family3, h.family2.col2 FROM hTable AS h]]>
- </Resource>
- <Resource name="ast">
- <![CDATA[
-LogicalProject(family3=[$2], col2=[$1.col2])
-+- LogicalTableScan(table=[[default_catalog, default_database, hTable]])
-]]>
- </Resource>
- <Resource name="optimized exec plan">
- <![CDATA[
-Calc(select=[family3, family2.col2 AS col2])
-+- TableSourceScan(table=[[default_catalog, default_database, hTable, project=[family3, family2]]], fields=[family3, family2])
-]]>
- </Resource>
- </TestCase>
-</Root>
diff --git a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/346fff47-b126-4f8c-ba73-799d99856912 b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/346fff47-b126-4f8c-ba73-799d99856912
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/ac3990d6-8d39-4299-8765-3ae2f91d76af b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/ac3990d6-8d39-4299-8765-3ae2f91d76af
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules
deleted file mode 100644
index 642f0d0169e..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-#Tue Feb 22 12:17:50 CET 2022
-Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=346fff47-b126-4f8c-ba73-799d99856912
-ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=ac3990d6-8d39-4299-8765-3ae2f91d76af
diff --git a/flink-connectors/flink-connector-hbase-2.2/pom.xml b/flink-connectors/flink-connector-hbase-2.2/pom.xml
deleted file mode 100644
index c06c238bffd..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/pom.xml
+++ /dev/null
@@ -1,487 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connectors</artifactId>
- <version>1.18-SNAPSHOT</version>
- </parent>
-
- <artifactId>flink-connector-hbase-2.2</artifactId>
- <name>Flink : Connectors : HBase 2.2</name>
- <packaging>jar</packaging>
-
- <properties>
- <hbase.version>2.2.3</hbase.version>
- </properties>
-
- <dependencies>
-
- <!-- Core -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-streaming-java</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Flink HBase -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-base</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-server</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Table ecosystem -->
-
- <!-- Projects depending on this project won't depend on flink-table-*. -->
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-api-java-bridge</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
-
- <!-- HBase -->
-
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-common</artifactId>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-client</artifactId>
- <version>${hbase.version}</version>
- <exclusions>
- <!-- Remove unneeded dependency, which is conflicting with our jetty-util version. -->
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-sslengine</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-2.1</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.1</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- </exclusion>
- <!-- Bug in hbase annotations, can be removed when fixed. See FLINK-2153. -->
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-common</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-auth</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-mapreduce-client-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <!-- Bump hbase netty dependency -->
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.1.46.Final</version>
- </dependency>
-
- <dependency>
- <!-- Replaces Hbase log4j dependency -->
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-1.2-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- Tests -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connector-hbase-base</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <!-- exclude HBase dependencies -->
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop-compat</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop2-compat</artifactId>
- </exclusion>
- </exclusions>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-clients</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-hadoop-compatibility_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-shaded-include-yarn_${scala.binary.version}</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-test-utils</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-common</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-planner_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-api-scala-bridge_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-planner_${scala.binary.version}</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-server</artifactId>
- <version>${hbase.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish</groupId>
- <artifactId>javax.el</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-zookeeper</artifactId>
- <version>${hbase.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-common</artifactId>
- <version>${hbase.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-mapreduce</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish</groupId>
- <artifactId>javax.el</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-minicluster</artifactId>
- <version>${flink.hadoop.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <!-- This dependency is no longer shipped with the JDK since Java 9.-->
- <groupId>jdk.tools</groupId>
- <artifactId>jdk.tools</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop-compat</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- <version>${flink.hadoop.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop2-compat</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- ArchUit test dependencies -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-architecture-tests-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <!-- HBase only works with Zookeper 3.4 -->
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <profiles>
- <profile>
- <id>java17</id>
- <activation>
- <jdk>[17,)</jdk>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- hbase currently does not support Java 17, see HBASE-26038 -->
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/HBase2DynamicTableFactory.java b/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/HBase2DynamicTableFactory.java
deleted file mode 100644
index 8c5513710e3..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/HBase2DynamicTableFactory.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.configuration.ConfigOption;
-import org.apache.flink.configuration.ReadableConfig;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink;
-import org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource;
-import org.apache.flink.table.connector.sink.DynamicTableSink;
-import org.apache.flink.table.connector.source.DynamicTableSource;
-import org.apache.flink.table.connector.source.lookup.LookupOptions;
-import org.apache.flink.table.connector.source.lookup.cache.DefaultLookupCache;
-import org.apache.flink.table.connector.source.lookup.cache.LookupCache;
-import org.apache.flink.table.factories.DynamicTableSinkFactory;
-import org.apache.flink.table.factories.DynamicTableSourceFactory;
-import org.apache.flink.table.factories.FactoryUtil.TableFactoryHelper;
-
-import org.apache.hadoop.conf.Configuration;
-
-import java.time.Duration;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_ASYNC;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_MAX_ROWS;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_CACHE_TTL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.LOOKUP_MAX_RETRIES;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.NULL_STRING_LITERAL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_INTERVAL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_ROWS;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_SIZE;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_PARALLELISM;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.TABLE_NAME;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.ZOOKEEPER_QUORUM;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.ZOOKEEPER_ZNODE_PARENT;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.PROPERTIES_PREFIX;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.getHBaseConfiguration;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.getHBaseWriteOptions;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptionsUtil.validatePrimaryKey;
-import static org.apache.flink.table.factories.FactoryUtil.createTableFactoryHelper;
-
-/** HBase connector factory. */
-@Internal
-public class HBase2DynamicTableFactory
- implements DynamicTableSourceFactory, DynamicTableSinkFactory {
-
- private static final String IDENTIFIER = "hbase-2.2";
-
- @Override
- public DynamicTableSource createDynamicTableSource(Context context) {
- TableFactoryHelper helper = createTableFactoryHelper(this, context);
- helper.validateExcept(PROPERTIES_PREFIX);
-
- final ReadableConfig tableOptions = helper.getOptions();
-
- validatePrimaryKey(context.getPhysicalRowDataType(), context.getPrimaryKeyIndexes());
-
- String tableName = tableOptions.get(TABLE_NAME);
- Configuration hbaseConf = getHBaseConfiguration(tableOptions);
- String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
- HBaseTableSchema hbaseSchema =
- HBaseTableSchema.fromDataType(context.getPhysicalRowDataType());
-
- LookupCache cache = null;
-
- // Backward compatible to legacy caching options
- if (tableOptions.get(LOOKUP_CACHE_MAX_ROWS) > 0
- && tableOptions.get(LOOKUP_CACHE_TTL).compareTo(Duration.ZERO) > 0) {
- cache =
- DefaultLookupCache.newBuilder()
- .maximumSize(tableOptions.get(LOOKUP_CACHE_MAX_ROWS))
- .expireAfterWrite(tableOptions.get(LOOKUP_CACHE_TTL))
- .build();
- }
-
- if (tableOptions
- .get(LookupOptions.CACHE_TYPE)
- .equals(LookupOptions.LookupCacheType.PARTIAL)) {
- cache = DefaultLookupCache.fromConfig(tableOptions);
- }
-
- return new HBaseDynamicTableSource(
- hbaseConf,
- tableName,
- hbaseSchema,
- nullStringLiteral,
- tableOptions.get(LookupOptions.MAX_RETRIES),
- tableOptions.get(LOOKUP_ASYNC),
- cache);
- }
-
- @Override
- public DynamicTableSink createDynamicTableSink(Context context) {
- TableFactoryHelper helper = createTableFactoryHelper(this, context);
- helper.validateExcept(PROPERTIES_PREFIX);
-
- final ReadableConfig tableOptions = helper.getOptions();
-
- validatePrimaryKey(context.getPhysicalRowDataType(), context.getPrimaryKeyIndexes());
-
- String tableName = tableOptions.get(TABLE_NAME);
- Configuration hbaseConf = getHBaseConfiguration(tableOptions);
- HBaseWriteOptions hBaseWriteOptions = getHBaseWriteOptions(tableOptions);
- String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
- HBaseTableSchema hbaseSchema =
- HBaseTableSchema.fromDataType(context.getPhysicalRowDataType());
-
- return new HBaseDynamicTableSink(
- tableName, hbaseSchema, hbaseConf, hBaseWriteOptions, nullStringLiteral);
- }
-
- @Override
- public String factoryIdentifier() {
- return IDENTIFIER;
- }
-
- @Override
- public Set<ConfigOption<?>> requiredOptions() {
- Set<ConfigOption<?>> set = new HashSet<>();
- set.add(TABLE_NAME);
- return set;
- }
-
- @Override
- public Set<ConfigOption<?>> optionalOptions() {
- Set<ConfigOption<?>> set = new HashSet<>();
- set.add(ZOOKEEPER_ZNODE_PARENT);
- set.add(ZOOKEEPER_QUORUM);
- set.add(NULL_STRING_LITERAL);
- set.add(SINK_BUFFER_FLUSH_MAX_SIZE);
- set.add(SINK_BUFFER_FLUSH_MAX_ROWS);
- set.add(SINK_BUFFER_FLUSH_INTERVAL);
- set.add(SINK_PARALLELISM);
- set.add(LOOKUP_ASYNC);
- set.add(LOOKUP_CACHE_MAX_ROWS);
- set.add(LOOKUP_CACHE_TTL);
- set.add(LOOKUP_MAX_RETRIES);
- set.add(LookupOptions.CACHE_TYPE);
- set.add(LookupOptions.MAX_RETRIES);
- set.add(LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_ACCESS);
- set.add(LookupOptions.PARTIAL_CACHE_EXPIRE_AFTER_WRITE);
- set.add(LookupOptions.PARTIAL_CACHE_CACHE_MISSING_KEY);
- set.add(LookupOptions.PARTIAL_CACHE_MAX_ROWS);
- return set;
- }
-
- @Override
- public Set<ConfigOption<?>> forwardOptions() {
- return Stream.of(
- TABLE_NAME,
- ZOOKEEPER_ZNODE_PARENT,
- ZOOKEEPER_QUORUM,
- NULL_STRING_LITERAL,
- LOOKUP_CACHE_MAX_ROWS,
- LOOKUP_CACHE_TTL,
- LOOKUP_MAX_RETRIES,
- SINK_BUFFER_FLUSH_MAX_SIZE,
- SINK_BUFFER_FLUSH_MAX_ROWS,
- SINK_BUFFER_FLUSH_INTERVAL)
- .collect(Collectors.toSet());
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/sink/HBaseDynamicTableSink.java b/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/sink/HBaseDynamicTableSink.java
deleted file mode 100644
index 6ea9ba3ebc1..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/sink/HBaseDynamicTableSink.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.sink;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.sink.HBaseSinkFunction;
-import org.apache.flink.connector.hbase.sink.RowDataToMutationConverter;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.connector.ChangelogMode;
-import org.apache.flink.table.connector.sink.DynamicTableSink;
-import org.apache.flink.table.connector.sink.SinkFunctionProvider;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.types.RowKind;
-
-import org.apache.hadoop.conf.Configuration;
-
-/** HBase table sink implementation. */
-@Internal
-public class HBaseDynamicTableSink implements DynamicTableSink {
-
- private final String tableName;
- private final HBaseTableSchema hbaseTableSchema;
- private final Configuration hbaseConf;
- private final HBaseWriteOptions writeOptions;
- private final String nullStringLiteral;
-
- public HBaseDynamicTableSink(
- String tableName,
- HBaseTableSchema hbaseTableSchema,
- Configuration hbaseConf,
- HBaseWriteOptions writeOptions,
- String nullStringLiteral) {
-
- this.tableName = tableName;
- this.hbaseTableSchema = hbaseTableSchema;
- this.hbaseConf = hbaseConf;
- this.writeOptions = writeOptions;
- this.nullStringLiteral = nullStringLiteral;
- }
-
- @Override
- public SinkRuntimeProvider getSinkRuntimeProvider(Context context) {
- HBaseSinkFunction<RowData> sinkFunction =
- new HBaseSinkFunction<>(
- tableName,
- hbaseConf,
- new RowDataToMutationConverter(hbaseTableSchema, nullStringLiteral),
- writeOptions.getBufferFlushMaxSizeInBytes(),
- writeOptions.getBufferFlushMaxRows(),
- writeOptions.getBufferFlushIntervalMillis());
- return SinkFunctionProvider.of(sinkFunction, writeOptions.getParallelism());
- }
-
- @Override
- public ChangelogMode getChangelogMode(ChangelogMode requestedMode) {
- // UPSERT mode
- ChangelogMode.Builder builder = ChangelogMode.newBuilder();
- for (RowKind kind : requestedMode.getContainedKinds()) {
- if (kind != RowKind.UPDATE_BEFORE) {
- builder.addContainedKind(kind);
- }
- }
- return builder.build();
- }
-
- @Override
- public DynamicTableSink copy() {
- return new HBaseDynamicTableSink(
- tableName, hbaseTableSchema, hbaseConf, writeOptions, nullStringLiteral);
- }
-
- @Override
- public String asSummaryString() {
- return "HBase";
- }
-
- // -------------------------------------------------------------------------------------------
-
- @VisibleForTesting
- public HBaseTableSchema getHBaseTableSchema() {
- return this.hbaseTableSchema;
- }
-
- @VisibleForTesting
- public HBaseWriteOptions getWriteOptions() {
- return writeOptions;
- }
-
- @VisibleForTesting
- public Configuration getConfiguration() {
- return this.hbaseConf;
- }
-
- @VisibleForTesting
- public String getTableName() {
- return this.tableName;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/AbstractTableInputFormat.java b/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/AbstractTableInputFormat.java
deleted file mode 100644
index d340fe8da42..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/AbstractTableInputFormat.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.api.common.io.LocatableInputSplitAssigner;
-import org.apache.flink.api.common.io.RichInputFormat;
-import org.apache.flink.api.common.io.statistics.BaseStatistics;
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.connector.hbase.source.TableInputSplit;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.core.io.InputSplitAssigner;
-import org.apache.flink.util.IOUtils;
-
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Pair;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Abstract {@link InputFormat} to read data from HBase tables. */
-@Internal
-public abstract class AbstractTableInputFormat<T> extends RichInputFormat<T, TableInputSplit> {
-
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractTableInputFormat.class);
- private static final long serialVersionUID = 1L;
-
- // helper variable to decide whether the input is exhausted or not
- protected boolean endReached = false;
-
- protected transient Connection connection = null;
- protected transient Table table = null;
- protected transient RegionLocator regionLocator = null;
- protected transient Scan scan = null;
-
- /** HBase iterator wrapper. */
- protected ResultScanner resultScanner = null;
-
- protected byte[] currentRow;
- protected long scannedRows;
-
- // Configuration is not serializable
- protected byte[] serializedConfig;
-
- public AbstractTableInputFormat(org.apache.hadoop.conf.Configuration hConf) {
- serializedConfig = HBaseConfigurationUtil.serializeConfiguration(hConf);
- }
-
- /**
- * Creates a {@link Scan} object and opens the {@link HTable} connection to initialize the HBase
- * table.
- *
- * @throws IOException Thrown, if the connection could not be opened due to an I/O problem.
- */
- protected abstract void initTable() throws IOException;
-
- /**
- * Returns an instance of Scan that retrieves the required subset of records from the HBase
- * table.
- *
- * @return The appropriate instance of Scan for this use case.
- */
- protected abstract Scan getScanner();
-
- /**
- * What table is to be read.
- *
- * <p>Per instance of a TableInputFormat derivative only a single table name is possible.
- *
- * @return The name of the table
- */
- protected abstract String getTableName();
-
- /**
- * HBase returns an instance of {@link Result}.
- *
- * <p>This method maps the returned {@link Result} instance into the output type {@link T}.
- *
- * @param r The Result instance from HBase that needs to be converted
- * @return The appropriate instance of {@link T} that contains the data of Result.
- */
- protected abstract T mapResultToOutType(Result r);
-
- @Override
- public void configure(Configuration parameters) {}
-
- protected org.apache.hadoop.conf.Configuration getHadoopConfiguration() {
- return HBaseConfigurationUtil.deserializeConfiguration(
- serializedConfig, HBaseConfigurationUtil.getHBaseConfiguration());
- }
-
- /**
- * Creates a {@link Scan} object and opens the {@link HTable} connection. The connection is
- * opened in this method and closed in {@link #close()}.
- *
- * @param split The split to be opened.
- * @throws IOException Thrown, if the spit could not be opened due to an I/O problem.
- */
- @Override
- public void open(TableInputSplit split) throws IOException {
- initTable();
-
- if (split == null) {
- throw new IOException("Input split is null!");
- }
-
- logSplitInfo("opening", split);
-
- // set scan range
- currentRow = split.getStartRow();
- scan.setStartRow(currentRow);
- scan.setStopRow(split.getEndRow());
-
- resultScanner = table.getScanner(scan);
- endReached = false;
- scannedRows = 0;
- }
-
- @Override
- public T nextRecord(T reuse) throws IOException {
- if (resultScanner == null) {
- throw new IOException("No table result scanner provided!");
- }
- Result res;
- try {
- res = resultScanner.next();
- } catch (Exception e) {
- resultScanner.close();
- // workaround for timeout on scan
- LOG.warn(
- "Error after scan of " + scannedRows + " rows. Retry with a new scanner...", e);
- scan.withStartRow(currentRow, false);
- resultScanner = table.getScanner(scan);
- res = resultScanner.next();
- }
-
- if (res != null) {
- scannedRows++;
- currentRow = res.getRow();
- return mapResultToOutType(res);
- }
-
- endReached = true;
- return null;
- }
-
- private void logSplitInfo(String action, TableInputSplit split) {
- int splitId = split.getSplitNumber();
- String splitStart = Bytes.toString(split.getStartRow());
- String splitEnd = Bytes.toString(split.getEndRow());
- String splitStartKey = splitStart.isEmpty() ? "-" : splitStart;
- String splitStopKey = splitEnd.isEmpty() ? "-" : splitEnd;
- String[] hostnames = split.getHostnames();
- LOG.info(
- "{} split (this={})[{}|{}|{}|{}]",
- action,
- this,
- splitId,
- hostnames,
- splitStartKey,
- splitStopKey);
- }
-
- @Override
- public boolean reachedEnd() throws IOException {
- return endReached;
- }
-
- @Override
- public void close() throws IOException {
- LOG.info("Closing split (scanned {} rows)", scannedRows);
- currentRow = null;
- IOUtils.closeQuietly(resultScanner);
- resultScanner = null;
- closeTable();
- }
-
- public void closeTable() {
- if (table != null) {
- try {
- table.close();
- } catch (IOException e) {
- LOG.warn("Exception occurs while closing HBase Table.", e);
- }
- table = null;
- }
- if (connection != null) {
- try {
- connection.close();
- } catch (IOException e) {
- LOG.warn("Exception occurs while closing HBase Connection.", e);
- }
- connection = null;
- }
- }
-
- @Override
- public TableInputSplit[] createInputSplits(final int minNumSplits) throws IOException {
- try {
- initTable();
-
- // Get the starting and ending row keys for every region in the currently open table
- final Pair<byte[][], byte[][]> keys = regionLocator.getStartEndKeys();
- if (keys == null || keys.getFirst() == null || keys.getFirst().length == 0) {
- LOG.warn(
- "Unexpected region keys: {} appeared in HBase table: {}, all region information are: {}.",
- keys,
- table,
- regionLocator.getAllRegionLocations());
- throw new IOException(
- "HBase Table expects at least one region in scan,"
- + " please check the HBase table status in HBase cluster");
- }
- final byte[] startRow = scan.getStartRow();
- final byte[] stopRow = scan.getStopRow();
- final boolean scanWithNoLowerBound = startRow.length == 0;
- final boolean scanWithNoUpperBound = stopRow.length == 0;
-
- final List<TableInputSplit> splits = new ArrayList<>(minNumSplits);
- for (int i = 0; i < keys.getFirst().length; i++) {
- final byte[] startKey = keys.getFirst()[i];
- final byte[] endKey = keys.getSecond()[i];
- final String regionLocation =
- regionLocator.getRegionLocation(startKey, false).getHostnamePort();
- // Test if the given region is to be included in the InputSplit while splitting the
- // regions of a table
- if (!includeRegionInScan(startKey, endKey)) {
- continue;
- }
- // Find the region on which the given row is being served
- final String[] hosts = new String[] {regionLocation};
-
- // Determine if regions contains keys used by the scan
- boolean isLastRegion = endKey.length == 0;
- if ((scanWithNoLowerBound || isLastRegion || Bytes.compareTo(startRow, endKey) < 0)
- && (scanWithNoUpperBound || Bytes.compareTo(stopRow, startKey) > 0)) {
-
- final byte[] splitStart =
- scanWithNoLowerBound || Bytes.compareTo(startKey, startRow) >= 0
- ? startKey
- : startRow;
- final byte[] splitStop =
- (scanWithNoUpperBound || Bytes.compareTo(endKey, stopRow) <= 0)
- && !isLastRegion
- ? endKey
- : stopRow;
- int id = splits.size();
- final TableInputSplit split =
- new TableInputSplit(
- id, hosts, table.getName().getName(), splitStart, splitStop);
- splits.add(split);
- }
- }
- LOG.info("Created " + splits.size() + " splits");
- for (TableInputSplit split : splits) {
- logSplitInfo("created", split);
- }
- return splits.toArray(new TableInputSplit[splits.size()]);
- } finally {
- closeTable();
- }
- }
-
- /**
- * Test if the given region is to be included in the scan while splitting the regions of a
- * table.
- *
- * @param startKey Start key of the region
- * @param endKey End key of the region
- * @return true, if this region needs to be included as part of the input (default).
- */
- protected boolean includeRegionInScan(final byte[] startKey, final byte[] endKey) {
- return true;
- }
-
- @Override
- public InputSplitAssigner getInputSplitAssigner(TableInputSplit[] inputSplits) {
- return new LocatableInputSplitAssigner(inputSplits);
- }
-
- @Override
- public BaseStatistics getStatistics(BaseStatistics cachedStatistics) {
- return null;
- }
-
- @VisibleForTesting
- public Connection getConnection() {
- return connection;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseDynamicTableSource.java b/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseDynamicTableSource.java
deleted file mode 100644
index 7c88703ca96..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseDynamicTableSource.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.connector.hbase.source.AbstractHBaseDynamicTableSource;
-import org.apache.flink.connector.hbase.source.HBaseRowDataLookupFunction;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.connector.source.DynamicTableSource;
-import org.apache.flink.table.connector.source.lookup.AsyncLookupFunctionProvider;
-import org.apache.flink.table.connector.source.lookup.LookupFunctionProvider;
-import org.apache.flink.table.connector.source.lookup.PartialCachingAsyncLookupProvider;
-import org.apache.flink.table.connector.source.lookup.PartialCachingLookupProvider;
-import org.apache.flink.table.connector.source.lookup.cache.LookupCache;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.types.DataType;
-
-import org.apache.hadoop.conf.Configuration;
-
-import javax.annotation.Nullable;
-
-import java.util.Objects;
-
-import static org.apache.flink.util.Preconditions.checkArgument;
-
-/** HBase table source implementation. */
-@Internal
-public class HBaseDynamicTableSource extends AbstractHBaseDynamicTableSource {
-
- private final boolean lookupAsync;
-
- public HBaseDynamicTableSource(
- Configuration conf,
- String tableName,
- HBaseTableSchema hbaseSchema,
- String nullStringLiteral,
- int maxRetryTimes,
- boolean lookupAsync,
- @Nullable LookupCache cache) {
- super(conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes, cache);
- this.lookupAsync = lookupAsync;
- }
-
- @Override
- public LookupRuntimeProvider getLookupRuntimeProvider(LookupContext context) {
- checkArgument(
- context.getKeys().length == 1 && context.getKeys()[0].length == 1,
- "Currently, HBase table can only be lookup by single rowkey.");
- checkArgument(
- hbaseSchema.getRowKeyName().isPresent(),
- "HBase schema must have a row key when used in lookup mode.");
- checkArgument(
- DataType.getFieldNames(hbaseSchema.convertToDataType())
- .get(context.getKeys()[0][0])
- .equals(hbaseSchema.getRowKeyName().get()),
- "Currently, HBase table only supports lookup by rowkey field.");
- if (lookupAsync) {
- HBaseRowDataAsyncLookupFunction asyncLookupFunction =
- new HBaseRowDataAsyncLookupFunction(
- conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes);
- if (cache != null) {
- return PartialCachingAsyncLookupProvider.of(asyncLookupFunction, cache);
- } else {
- return AsyncLookupFunctionProvider.of(asyncLookupFunction);
- }
- } else {
- HBaseRowDataLookupFunction lookupFunction =
- new HBaseRowDataLookupFunction(
- conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes);
- if (cache != null) {
- return PartialCachingLookupProvider.of(lookupFunction, cache);
- } else {
- return LookupFunctionProvider.of(lookupFunction);
- }
- }
- }
-
- @Override
- public DynamicTableSource copy() {
- return new HBaseDynamicTableSource(
- conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes, lookupAsync, cache);
- }
-
- @Override
- protected InputFormat<RowData, ?> getInputFormat() {
- return new HBaseRowDataInputFormat(conf, tableName, hbaseSchema, nullStringLiteral);
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof HBaseDynamicTableSource)) {
- return false;
- }
- HBaseDynamicTableSource that = (HBaseDynamicTableSource) o;
- return Objects.equals(conf, that.conf)
- && Objects.equals(tableName, that.tableName)
- && Objects.equals(hbaseSchema, that.hbaseSchema)
- && Objects.equals(nullStringLiteral, that.nullStringLiteral)
- && Objects.equals(maxRetryTimes, that.maxRetryTimes)
- && Objects.equals(cache, that.cache)
- && Objects.equals(lookupAsync, that.lookupAsync);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(
- conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes, cache, lookupAsync);
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseRowDataAsyncLookupFunction.java b/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseRowDataAsyncLookupFunction.java
deleted file mode 100644
index 697d5fd9eab..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseRowDataAsyncLookupFunction.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.connector.hbase.util.HBaseSerde;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.data.GenericRowData;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.functions.AsyncLookupFunction;
-import org.apache.flink.table.functions.FunctionContext;
-import org.apache.flink.util.StringUtils;
-import org.apache.flink.util.concurrent.ExecutorThreadFactory;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.hadoop.hbase.client.AsyncConnection;
-import org.apache.hadoop.hbase.client.AsyncTable;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ScanResultConsumer;
-import org.apache.hadoop.hbase.util.Threads;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * The HBaseRowDataAsyncLookupFunction is an implementation to lookup HBase data by rowkey in async
- * fashion. It looks up the result as {@link RowData}.
- */
-@Internal
-public class HBaseRowDataAsyncLookupFunction extends AsyncLookupFunction {
-
- private static final Logger LOG =
- LoggerFactory.getLogger(HBaseRowDataAsyncLookupFunction.class);
- private static final long serialVersionUID = 1L;
-
- private final String hTableName;
- private final byte[] serializedConfig;
- private final HBaseTableSchema hbaseTableSchema;
- private final String nullStringLiteral;
-
- private transient AsyncConnection asyncConnection;
- private transient AsyncTable<ScanResultConsumer> table;
- private transient HBaseSerde serde;
-
- private final int maxRetryTimes;
-
- /** The size for thread pool. */
- private static final int THREAD_POOL_SIZE = 16;
-
- public HBaseRowDataAsyncLookupFunction(
- Configuration configuration,
- String hTableName,
- HBaseTableSchema hbaseTableSchema,
- String nullStringLiteral,
- int maxRetryTimes) {
- this.serializedConfig = HBaseConfigurationUtil.serializeConfiguration(configuration);
- this.hTableName = hTableName;
- this.hbaseTableSchema = hbaseTableSchema;
- this.nullStringLiteral = nullStringLiteral;
- this.maxRetryTimes = maxRetryTimes;
- }
-
- @Override
- public void open(FunctionContext context) {
- LOG.info("start open ...");
- final ExecutorService threadPool =
- Executors.newFixedThreadPool(
- THREAD_POOL_SIZE,
- new ExecutorThreadFactory(
- "hbase-async-lookup-worker", Threads.LOGGING_EXCEPTION_HANDLER));
- Configuration config = prepareRuntimeConfiguration();
- CompletableFuture<AsyncConnection> asyncConnectionFuture =
- ConnectionFactory.createAsyncConnection(config);
- try {
- asyncConnection = asyncConnectionFuture.get();
- table = asyncConnection.getTable(TableName.valueOf(hTableName), threadPool);
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Exception while creating connection to HBase.", e);
- throw new RuntimeException("Cannot create connection to HBase.", e);
- }
- this.serde = new HBaseSerde(hbaseTableSchema, nullStringLiteral);
- LOG.info("end open.");
- }
-
- /**
- * The invoke entry point of lookup function.
- *
- * @param keyRow A {@link RowData} that wraps lookup keys. Currently only support single rowkey.
- */
- @Override
- public CompletableFuture<Collection<RowData>> asyncLookup(RowData keyRow) {
- int currentRetry = 0;
- CompletableFuture<Collection<RowData>> future = new CompletableFuture<>();
- // fetch result
- fetchResult(future, currentRetry, ((GenericRowData) keyRow).getField(0));
- return future;
- }
-
- /**
- * Execute async fetch result .
- *
- * @param resultFuture The result or exception is returned.
- * @param currentRetry Current number of retries.
- * @param rowKey the lookup key.
- */
- private void fetchResult(
- CompletableFuture<Collection<RowData>> resultFuture, int currentRetry, Object rowKey) {
- Get get = serde.createGet(rowKey);
- CompletableFuture<Result> responseFuture = table.get(get);
- responseFuture.whenCompleteAsync(
- (result, throwable) -> {
- if (throwable != null) {
- if (throwable instanceof TableNotFoundException) {
- LOG.error("Table '{}' not found ", hTableName, throwable);
- resultFuture.completeExceptionally(
- new RuntimeException(
- "HBase table '" + hTableName + "' not found.",
- throwable));
- } else {
- LOG.error(
- String.format(
- "HBase asyncLookup error, retry times = %d",
- currentRetry),
- throwable);
- if (currentRetry >= maxRetryTimes) {
- resultFuture.completeExceptionally(throwable);
- } else {
- try {
- Thread.sleep(1000 * currentRetry);
- } catch (InterruptedException e1) {
- resultFuture.completeExceptionally(e1);
- }
- fetchResult(resultFuture, currentRetry + 1, rowKey);
- }
- }
- } else {
- if (result.isEmpty()) {
- resultFuture.complete(Collections.emptyList());
- } else {
- resultFuture.complete(
- Collections.singletonList(serde.convertToNewRow(result)));
- }
- }
- });
- }
-
- private Configuration prepareRuntimeConfiguration() {
- // create default configuration from current runtime env (`hbase-site.xml` in classpath)
- // first,
- // and overwrite configuration using serialized configuration from client-side env
- // (`hbase-site.xml` in classpath).
- // user params from client-side have the highest priority
- Configuration runtimeConfig =
- HBaseConfigurationUtil.deserializeConfiguration(
- serializedConfig, HBaseConfigurationUtil.getHBaseConfiguration());
-
- // do validation: check key option(s) in final runtime configuration
- if (StringUtils.isNullOrWhitespaceOnly(runtimeConfig.get(HConstants.ZOOKEEPER_QUORUM))) {
- LOG.error(
- "can not connect to HBase without {} configuration",
- HConstants.ZOOKEEPER_QUORUM);
- throw new IllegalArgumentException(
- "check HBase configuration failed, lost: '"
- + HConstants.ZOOKEEPER_QUORUM
- + "'!");
- }
-
- return runtimeConfig;
- }
-
- @Override
- public void close() {
- LOG.info("start close ...");
- if (null != table) {
- table = null;
- }
- if (null != asyncConnection) {
- try {
- asyncConnection.close();
- asyncConnection = null;
- } catch (IOException e) {
- // ignore exception when close.
- LOG.warn("exception when close connection", e);
- }
- }
- LOG.info("end close.");
- }
-
- @VisibleForTesting
- public String getHTableName() {
- return hTableName;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseRowDataInputFormat.java b/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseRowDataInputFormat.java
deleted file mode 100644
index 1bd9a6a91f9..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/java/org/apache/flink/connector/hbase2/source/HBaseRowDataInputFormat.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.source;
-
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.connector.hbase.util.HBaseSerde;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.data.RowData;
-
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.Scan;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-/**
- * {@link InputFormat} subclass that wraps the access for HTables. Returns the result as {@link
- * RowData}
- */
-public class HBaseRowDataInputFormat extends AbstractTableInputFormat<RowData> {
- private static final long serialVersionUID = 1L;
- private static final Logger LOG = LoggerFactory.getLogger(HBaseRowDataInputFormat.class);
-
- private final String tableName;
- private final HBaseTableSchema schema;
- private final String nullStringLiteral;
-
- private transient HBaseSerde serde;
-
- public HBaseRowDataInputFormat(
- org.apache.hadoop.conf.Configuration conf,
- String tableName,
- HBaseTableSchema schema,
- String nullStringLiteral) {
- super(conf);
- this.tableName = tableName;
- this.schema = schema;
- this.nullStringLiteral = nullStringLiteral;
- }
-
- @Override
- protected void initTable() throws IOException {
- this.serde = new HBaseSerde(schema, nullStringLiteral);
- if (table == null) {
- connectToTable();
- }
- if (table != null && scan == null) {
- scan = getScanner();
- }
- }
-
- @Override
- protected Scan getScanner() {
- return serde.createScan();
- }
-
- @Override
- public String getTableName() {
- return tableName;
- }
-
- @Override
- protected RowData mapResultToOutType(Result res) {
- return serde.convertToReusedRow(res);
- }
-
- private void connectToTable() throws IOException {
- try {
- if (connection == null) {
- connection = ConnectionFactory.createConnection(getHadoopConfiguration());
- }
- TableName name = TableName.valueOf(getTableName());
- table = connection.getTable(name);
- regionLocator = connection.getRegionLocator(name);
- } catch (TableNotFoundException tnfe) {
- LOG.error("The table " + tableName + " not found ", tnfe);
- throw new RuntimeException("HBase table '" + tableName + "' not found.", tnfe);
- }
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory b/flink-connectors/flink-connector-hbase-2.2/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory
deleted file mode 100644
index 904d775dcb8..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-org.apache.flink.connector.hbase2.HBase2DynamicTableFactory
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
deleted file mode 100644
index 35843606fd9..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.architecture;
-
-import org.apache.flink.architecture.common.ImportOptions;
-
-import com.tngtech.archunit.core.importer.ImportOption;
-import com.tngtech.archunit.junit.AnalyzeClasses;
-import com.tngtech.archunit.junit.ArchTest;
-import com.tngtech.archunit.junit.ArchTests;
-
-/** Architecture tests for test code. */
-@AnalyzeClasses(
- packages = "org.apache.flink.connector.hbase2",
- importOptions = {
- ImportOption.OnlyIncludeTests.class,
- ImportOptions.ExcludeScalaImportOption.class,
- ImportOptions.ExcludeShadedImportOption.class
- })
-public class TestCodeArchitectureTest {
-
- @ArchTest
- public static final ArchTests COMMON_TESTS = ArchTests.in(TestCodeArchitectureTestBase.class);
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseConnectorITCase.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseConnectorITCase.java
deleted file mode 100644
index 0a645aadc5b..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseConnectorITCase.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2;
-
-import org.apache.flink.api.common.typeinfo.TypeInformation;
-import org.apache.flink.api.common.typeinfo.Types;
-import org.apache.flink.api.java.typeutils.RowTypeInfo;
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase2.source.AbstractTableInputFormat;
-import org.apache.flink.connector.hbase2.source.HBaseRowDataInputFormat;
-import org.apache.flink.connector.hbase2.util.HBaseTestBase;
-import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
-import org.apache.flink.streaming.api.datastream.DataStream;
-import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-import org.apache.flink.table.api.Table;
-import org.apache.flink.table.api.TableEnvironment;
-import org.apache.flink.table.api.TableResult;
-import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
-import org.apache.flink.table.functions.ScalarFunction;
-import org.apache.flink.test.util.MiniClusterWithClientResource;
-import org.apache.flink.test.util.TestBaseUtils;
-import org.apache.flink.types.Row;
-import org.apache.flink.types.RowKind;
-import org.apache.flink.util.CollectionUtil;
-
-import org.apache.flink.shaded.guava31.com.google.common.collect.Lists;
-
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.ClassRule;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.apache.flink.table.api.Expressions.$;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/** IT cases for HBase connector (including source and sink). */
-public class HBaseConnectorITCase extends HBaseTestBase {
-
- @ClassRule
- public static final MiniClusterWithClientResource MINI_CLUSTER =
- new MiniClusterWithClientResource(
- new MiniClusterResourceConfiguration.Builder()
- .setConfiguration(new Configuration())
- .build());
-
- // -------------------------------------------------------------------------------------
- // HBaseTableSource tests
- // -------------------------------------------------------------------------------------
-
- @Test
- public void testTableSourceFullScan() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- Table table =
- tEnv.sqlQuery(
- "SELECT "
- + " h.family1.col1, "
- + " h.family2.col1, "
- + " h.family2.col2, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3 "
- + "FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[10, Hello-1, 100, 1.01, false, Welt-1]\n"
- + "+I[20, Hello-2, 200, 2.02, true, Welt-2]\n"
- + "+I[30, Hello-3, 300, 3.03, false, Welt-3]\n"
- + "+I[40, null, 400, 4.04, true, Welt-4]\n"
- + "+I[50, Hello-5, 500, 5.05, false, Welt-5]\n"
- + "+I[60, Hello-6, 600, 6.06, true, Welt-6]\n"
- + "+I[70, Hello-7, 700, 7.07, false, Welt-7]\n"
- + "+I[80, null, 800, 8.08, true, Welt-8]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceProjection() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- Table table =
- tEnv.sqlQuery(
- "SELECT "
- + " h.family1.col1, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3 "
- + "FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[10, 1.01, false, Welt-1]\n"
- + "+I[20, 2.02, true, Welt-2]\n"
- + "+I[30, 3.03, false, Welt-3]\n"
- + "+I[40, 4.04, true, Welt-4]\n"
- + "+I[50, 5.05, false, Welt-5]\n"
- + "+I[60, 6.06, true, Welt-6]\n"
- + "+I[70, 7.07, false, Welt-7]\n"
- + "+I[80, 8.08, true, Welt-8]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceFieldOrder() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " rowkey INT PRIMARY KEY NOT ENFORCED,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " family1 ROW<col1 INT>"
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- Table table = tEnv.sqlQuery("SELECT * FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[1, +I[Hello-1, 100], +I[1.01, false, Welt-1], +I[10]]\n"
- + "+I[2, +I[Hello-2, 200], +I[2.02, true, Welt-2], +I[20]]\n"
- + "+I[3, +I[Hello-3, 300], +I[3.03, false, Welt-3], +I[30]]\n"
- + "+I[4, +I[null, 400], +I[4.04, true, Welt-4], +I[40]]\n"
- + "+I[5, +I[Hello-5, 500], +I[5.05, false, Welt-5], +I[50]]\n"
- + "+I[6, +I[Hello-6, 600], +I[6.06, true, Welt-6], +I[60]]\n"
- + "+I[7, +I[Hello-7, 700], +I[7.07, false, Welt-7], +I[70]]\n"
- + "+I[8, +I[null, 800], +I[8.08, true, Welt-8], +I[80]]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSourceReadAsByteArray() {
- TableEnvironment tEnv = TableEnvironment.create(batchSettings);
-
- tEnv.executeSql(
- "CREATE TABLE hTable ("
- + " family2 ROW<col1 BYTES, col2 BYTES>,"
- + " rowkey INT"
- + // no primary key syntax
- ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
- tEnv.registerFunction("toUTF8", new ToUTF8());
- tEnv.registerFunction("toLong", new ToLong());
-
- Table table =
- tEnv.sqlQuery(
- "SELECT "
- + " toUTF8(h.family2.col1), "
- + " toLong(h.family2.col2) "
- + "FROM hTable AS h");
-
- List<Row> results = CollectionUtil.iteratorToList(table.execute().collect());
- String expected =
- "+I[Hello-1, 100]\n"
- + "+I[Hello-2, 200]\n"
- + "+I[Hello-3, 300]\n"
- + "+I[null, 400]\n"
- + "+I[Hello-5, 500]\n"
- + "+I[Hello-6, 600]\n"
- + "+I[Hello-7, 700]\n"
- + "+I[null, 800]\n";
-
- TestBaseUtils.compareResultAsText(results, expected);
- }
-
- @Test
- public void testTableSink() throws Exception {
- StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
- StreamTableEnvironment tEnv = StreamTableEnvironment.create(execEnv, streamSettings);
-
- // register HBase table testTable1 which contains test data
- String table1DDL = createHBaseTableDDL(TEST_TABLE_1, false);
- tEnv.executeSql(table1DDL);
-
- String table2DDL = createHBaseTableDDL(TEST_TABLE_2, false);
- tEnv.executeSql(table2DDL);
-
- String query =
- "INSERT INTO "
- + TEST_TABLE_2
- + " SELECT"
- + " rowkey,"
- + " family1,"
- + " family2,"
- + " family3"
- + " FROM "
- + TEST_TABLE_1;
-
- TableResult tableResult = tEnv.executeSql(query);
-
- // wait to finish
- tableResult.await();
-
- assertEquals(
- "Expected INSERT rowKind", RowKind.INSERT, tableResult.collect().next().getKind());
-
- // start a batch scan job to verify contents in HBase table
- TableEnvironment batchEnv = TableEnvironment.create(batchSettings);
- batchEnv.executeSql(table2DDL);
-
- List<String> expected = new ArrayList<>();
- expected.add("+I[1, 10, Hello-1, 100, 1.01, false, Welt-1]\n");
- expected.add("+I[2, 20, Hello-2, 200, 2.02, true, Welt-2]\n");
- expected.add("+I[3, 30, Hello-3, 300, 3.03, false, Welt-3]\n");
- expected.add("+I[4, 40, null, 400, 4.04, true, Welt-4]\n");
- expected.add("+I[5, 50, Hello-5, 500, 5.05, false, Welt-5]\n");
- expected.add("+I[6, 60, Hello-6, 600, 6.06, true, Welt-6]\n");
- expected.add("+I[7, 70, Hello-7, 700, 7.07, false, Welt-7]\n");
- expected.add("+I[8, 80, null, 800, 8.08, true, Welt-8]\n");
-
- Table countTable =
- batchEnv.sqlQuery("SELECT COUNT(h.rowkey) FROM " + TEST_TABLE_2 + " AS h");
-
- assertEquals(new Long(expected.size()), countTable.execute().collect().next().getField(0));
-
- Table table =
- batchEnv.sqlQuery(
- "SELECT "
- + " h.rowkey, "
- + " h.family1.col1, "
- + " h.family2.col1, "
- + " h.family2.col2, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3 "
- + "FROM "
- + TEST_TABLE_2
- + " AS h");
-
- TableResult tableResult2 = table.execute();
-
- List<Row> results = CollectionUtil.iteratorToList(tableResult2.collect());
-
- TestBaseUtils.compareResultAsText(results, String.join("", expected));
- }
-
- @Test
- public void testTableSourceSinkWithDDL() throws Exception {
- StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
- StreamTableEnvironment tEnv = StreamTableEnvironment.create(execEnv, streamSettings);
-
- // register HBase table testTable1 which contains test data
- String table1DDL = createHBaseTableDDL(TEST_TABLE_1, true);
- tEnv.executeSql(table1DDL);
-
- // register HBase table which is empty
- String table3DDL = createHBaseTableDDL(TEST_TABLE_3, true);
- tEnv.executeSql(table3DDL);
-
- String insertStatement =
- "INSERT INTO "
- + TEST_TABLE_3
- + " SELECT rowkey,"
- + " family1,"
- + " family2,"
- + " family3,"
- + " family4"
- + " from "
- + TEST_TABLE_1;
-
- TableResult tableResult = tEnv.executeSql(insertStatement);
-
- // wait to finish
- tableResult.await();
-
- assertEquals(
- "Expected INSERT rowKind", RowKind.INSERT, tableResult.collect().next().getKind());
-
- // start a batch scan job to verify contents in HBase table
- TableEnvironment batchEnv = TableEnvironment.create(batchSettings);
- batchEnv.executeSql(table3DDL);
-
- List<String> expected = new ArrayList<>();
- expected.add(
- "+I[1, 10, Hello-1, 100, 1.01, false, Welt-1, 2019-08-18T19:00, 2019-08-18, 19:00, 12345678.0001]");
- expected.add(
- "+I[2, 20, Hello-2, 200, 2.02, true, Welt-2, 2019-08-18T19:01, 2019-08-18, 19:01, 12345678.0002]");
- expected.add(
- "+I[3, 30, Hello-3, 300, 3.03, false, Welt-3, 2019-08-18T19:02, 2019-08-18, 19:02, 12345678.0003]");
- expected.add(
- "+I[4, 40, null, 400, 4.04, true, Welt-4, 2019-08-18T19:03, 2019-08-18, 19:03, 12345678.0004]");
- expected.add(
- "+I[5, 50, Hello-5, 500, 5.05, false, Welt-5, 2019-08-19T19:10, 2019-08-19, 19:10, 12345678.0005]");
- expected.add(
- "+I[6, 60, Hello-6, 600, 6.06, true, Welt-6, 2019-08-19T19:20, 2019-08-19, 19:20, 12345678.0006]");
- expected.add(
- "+I[7, 70, Hello-7, 700, 7.07, false, Welt-7, 2019-08-19T19:30, 2019-08-19, 19:30, 12345678.0007]");
- expected.add(
- "+I[8, 80, null, 800, 8.08, true, Welt-8, 2019-08-19T19:40, 2019-08-19, 19:40, 12345678.0008]");
-
- String query =
- "SELECT "
- + " h.rowkey, "
- + " h.family1.col1, "
- + " h.family2.col1, "
- + " h.family2.col2, "
- + " h.family3.col1, "
- + " h.family3.col2, "
- + " h.family3.col3, "
- + " h.family4.col1, "
- + " h.family4.col2, "
- + " h.family4.col3, "
- + " h.family4.col4 "
- + " FROM "
- + TEST_TABLE_3
- + " AS h";
-
- TableResult tableResult3 = batchEnv.executeSql(query);
-
- List<String> result =
- Lists.newArrayList(tableResult3.collect()).stream()
- .map(Row::toString)
- .sorted()
- .collect(Collectors.toList());
-
- assertEquals(expected, result);
- }
-
- @Test
- public void testHBaseLookupTableSource() {
- verifyHBaseLookupJoin(false);
- }
-
- @Test
- public void testHBaseAsyncLookupTableSource() {
- verifyHBaseLookupJoin(true);
- }
-
- @Test
- public void testTableInputFormatOpenClose() throws IOException {
- HBaseTableSchema tableSchema = new HBaseTableSchema();
- tableSchema.addColumn(FAMILY1, F1COL1, byte[].class);
- AbstractTableInputFormat<?> inputFormat =
- new HBaseRowDataInputFormat(getConf(), TEST_TABLE_1, tableSchema, "null");
- inputFormat.open(inputFormat.createInputSplits(1)[0]);
- assertNotNull(inputFormat.getConnection());
- assertNotNull(inputFormat.getConnection().getTable(TableName.valueOf(TEST_TABLE_1)));
-
- inputFormat.close();
- assertNull(inputFormat.getConnection());
- }
-
- private void verifyHBaseLookupJoin(boolean async) {
- StreamExecutionEnvironment execEnv = StreamExecutionEnvironment.getExecutionEnvironment();
- StreamTableEnvironment tEnv = StreamTableEnvironment.create(execEnv, streamSettings);
-
- tEnv.executeSql(
- "CREATE TABLE "
- + TEST_TABLE_1
- + " ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " family4 ROW<col1 TIMESTAMP(3), col2 DATE, col3 TIME(3), col4 DECIMAL(12, 4)>,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'lookup.async' = '"
- + async
- + "',"
- + " 'table-name' = '"
- + TEST_TABLE_1
- + "',"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "'"
- + ")");
-
- // prepare a source table
- String srcTableName = "src";
- DataStream<Row> srcDs = execEnv.fromCollection(testData).returns(testTypeInfo);
- Table in = tEnv.fromDataStream(srcDs, $("a"), $("b"), $("c"), $("proc").proctime());
- tEnv.createTemporaryView(srcTableName, in);
-
- // perform a temporal table join query
- String dimJoinQuery =
- "SELECT"
- + " a,"
- + " b,"
- + " h.family1.col1,"
- + " h.family2.col1,"
- + " h.family2.col2,"
- + " h.family3.col1,"
- + " h.family3.col2,"
- + " h.family3.col3,"
- + " h.family4.col1,"
- + " h.family4.col2,"
- + " h.family4.col3,"
- + " h.family4.col4 "
- + " FROM src JOIN "
- + TEST_TABLE_1
- + " FOR SYSTEM_TIME AS OF src.proc as h ON src.a = h.rowkey";
- Iterator<Row> collected = tEnv.executeSql(dimJoinQuery).collect();
- List<String> result =
- Lists.newArrayList(collected).stream()
- .map(Row::toString)
- .sorted()
- .collect(Collectors.toList());
-
- List<String> expected = new ArrayList<>();
- expected.add(
- "+I[1, 1, 10, Hello-1, 100, 1.01, false, Welt-1, 2019-08-18T19:00, 2019-08-18, 19:00, 12345678.0001]");
- expected.add(
- "+I[2, 2, 20, Hello-2, 200, 2.02, true, Welt-2, 2019-08-18T19:01, 2019-08-18, 19:01, 12345678.0002]");
- expected.add(
- "+I[3, 2, 30, Hello-3, 300, 3.03, false, Welt-3, 2019-08-18T19:02, 2019-08-18, 19:02, 12345678.0003]");
- expected.add(
- "+I[3, 3, 30, Hello-3, 300, 3.03, false, Welt-3, 2019-08-18T19:02, 2019-08-18, 19:02, 12345678.0003]");
-
- assertEquals(expected, result);
- }
-
- // -------------------------------------------------------------------------------------
- // HBase lookup source tests
- // -------------------------------------------------------------------------------------
-
- // prepare a source collection.
- private static final List<Row> testData = new ArrayList<>();
- private static final RowTypeInfo testTypeInfo =
- new RowTypeInfo(
- new TypeInformation[] {Types.INT, Types.LONG, Types.STRING},
- new String[] {"a", "b", "c"});
-
- static {
- testData.add(Row.of(1, 1L, "Hi"));
- testData.add(Row.of(2, 2L, "Hello"));
- testData.add(Row.of(3, 2L, "Hello world"));
- testData.add(Row.of(3, 3L, "Hello world!"));
- }
-
- // ------------------------------- Utilities -------------------------------------------------
-
- /** A {@link ScalarFunction} that maps byte arrays to UTF-8 strings. */
- public static class ToUTF8 extends ScalarFunction {
- private static final long serialVersionUID = 1L;
-
- public String eval(byte[] bytes) {
- return Bytes.toString(bytes);
- }
- }
-
- /** A {@link ScalarFunction} that maps byte array to longs. */
- public static class ToLong extends ScalarFunction {
- private static final long serialVersionUID = 1L;
-
- public long eval(byte[] bytes) {
- return Bytes.toLong(bytes);
- }
- }
-
- private String createHBaseTableDDL(String tableName, boolean testTimeAndDecimalTypes) {
- StringBuilder family4Statement = new StringBuilder();
- if (testTimeAndDecimalTypes) {
- family4Statement.append(", family4 ROW<col1 TIMESTAMP(3)");
- family4Statement.append(", col2 DATE");
- family4Statement.append(", col3 TIME(3)");
- family4Statement.append(", col4 DECIMAL(12, 4)");
- family4Statement.append("> \n");
- }
-
- return "CREATE TABLE "
- + tableName
- + "(\n"
- + " rowkey INT,"
- + " family1 ROW<col1 INT>,\n"
- + " family2 ROW<col1 VARCHAR, col2 BIGINT>,\n"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 VARCHAR>"
- + family4Statement.toString()
- + ") WITH (\n"
- + " 'connector' = 'hbase-2.2',\n"
- + " 'table-name' = '"
- + tableName
- + "',\n"
- + " 'zookeeper.quorum' = '"
- + getZookeeperQuorum()
- + "',\n"
- + " 'zookeeper.znode.parent' = '/hbase' "
- + ")";
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseDynamicTableFactoryTest.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseDynamicTableFactoryTest.java
deleted file mode 100644
index a535f0e0c58..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseDynamicTableFactoryTest.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2;
-
-import org.apache.flink.api.common.typeinfo.Types;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.source.HBaseRowDataLookupFunction;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink;
-import org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource;
-import org.apache.flink.connector.hbase2.source.HBaseRowDataAsyncLookupFunction;
-import org.apache.flink.table.catalog.Column;
-import org.apache.flink.table.catalog.ResolvedSchema;
-import org.apache.flink.table.connector.sink.DynamicTableSink;
-import org.apache.flink.table.connector.sink.SinkFunctionProvider;
-import org.apache.flink.table.connector.source.DynamicTableSource;
-import org.apache.flink.table.connector.source.LookupTableSource;
-import org.apache.flink.table.connector.source.lookup.AsyncLookupFunctionProvider;
-import org.apache.flink.table.connector.source.lookup.LookupFunctionProvider;
-import org.apache.flink.table.connector.source.lookup.cache.DefaultLookupCache;
-import org.apache.flink.table.functions.AsyncLookupFunction;
-import org.apache.flink.table.functions.LookupFunction;
-import org.apache.flink.table.runtime.connector.sink.SinkRuntimeProviderContext;
-import org.apache.flink.table.runtime.connector.source.LookupRuntimeProviderContext;
-import org.apache.flink.table.types.DataType;
-import org.apache.flink.util.ExceptionUtils;
-
-import org.apache.commons.collections.IteratorUtils;
-import org.apache.hadoop.hbase.HConstants;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import java.time.Duration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-import static org.apache.flink.table.api.DataTypes.BIGINT;
-import static org.apache.flink.table.api.DataTypes.BOOLEAN;
-import static org.apache.flink.table.api.DataTypes.DATE;
-import static org.apache.flink.table.api.DataTypes.DECIMAL;
-import static org.apache.flink.table.api.DataTypes.DOUBLE;
-import static org.apache.flink.table.api.DataTypes.FIELD;
-import static org.apache.flink.table.api.DataTypes.INT;
-import static org.apache.flink.table.api.DataTypes.ROW;
-import static org.apache.flink.table.api.DataTypes.STRING;
-import static org.apache.flink.table.api.DataTypes.TIME;
-import static org.apache.flink.table.api.DataTypes.TIMESTAMP;
-import static org.apache.flink.table.factories.utils.FactoryMocks.createTableSink;
-import static org.apache.flink.table.factories.utils.FactoryMocks.createTableSource;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/** Unit test for {@link HBase2DynamicTableFactory}. */
-public class HBaseDynamicTableFactoryTest {
-
- private static final String FAMILY1 = "f1";
- private static final String FAMILY2 = "f2";
- private static final String FAMILY3 = "f3";
- private static final String FAMILY4 = "f4";
- private static final String COL1 = "c1";
- private static final String COL2 = "c2";
- private static final String COL3 = "c3";
- private static final String COL4 = "c4";
- private static final String ROWKEY = "rowkey";
-
- @Rule public final ExpectedException thrown = ExpectedException.none();
-
- @SuppressWarnings("rawtypes")
- @Test
- public void testTableSourceFactory() {
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(FAMILY1, ROW(FIELD(COL1, INT()))),
- Column.physical(FAMILY2, ROW(FIELD(COL1, INT()), FIELD(COL2, BIGINT()))),
- Column.physical(ROWKEY, BIGINT()),
- Column.physical(
- FAMILY3,
- ROW(
- FIELD(COL1, DOUBLE()),
- FIELD(COL2, BOOLEAN()),
- FIELD(COL3, STRING()))),
- Column.physical(
- FAMILY4,
- ROW(
- FIELD(COL1, DECIMAL(10, 3)),
- FIELD(COL2, TIMESTAMP(3)),
- FIELD(COL3, DATE()),
- FIELD(COL4, TIME()))));
-
- DynamicTableSource source = createTableSource(schema, getAllOptions());
- assertTrue(source instanceof HBaseDynamicTableSource);
- HBaseDynamicTableSource hbaseSource = (HBaseDynamicTableSource) source;
-
- int[][] lookupKey = {{2}};
- LookupTableSource.LookupRuntimeProvider lookupProvider =
- hbaseSource.getLookupRuntimeProvider(new LookupRuntimeProviderContext(lookupKey));
- assertTrue(lookupProvider instanceof LookupFunctionProvider);
-
- LookupFunction tableFunction =
- ((LookupFunctionProvider) lookupProvider).createLookupFunction();
- assertTrue(tableFunction instanceof HBaseRowDataLookupFunction);
- assertEquals(
- "testHBastTable", ((HBaseRowDataLookupFunction) tableFunction).getHTableName());
-
- HBaseTableSchema hbaseSchema = hbaseSource.getHBaseTableSchema();
- assertEquals(2, hbaseSchema.getRowKeyIndex());
- assertEquals(Optional.of(Types.LONG), hbaseSchema.getRowKeyTypeInfo());
-
- assertArrayEquals(new String[] {"f1", "f2", "f3", "f4"}, hbaseSchema.getFamilyNames());
- assertArrayEquals(new String[] {"c1"}, hbaseSchema.getQualifierNames("f1"));
- assertArrayEquals(new String[] {"c1", "c2"}, hbaseSchema.getQualifierNames("f2"));
- assertArrayEquals(new String[] {"c1", "c2", "c3"}, hbaseSchema.getQualifierNames("f3"));
- assertArrayEquals(
- new String[] {"c1", "c2", "c3", "c4"}, hbaseSchema.getQualifierNames("f4"));
-
- assertArrayEquals(new DataType[] {INT()}, hbaseSchema.getQualifierDataTypes("f1"));
- assertArrayEquals(
- new DataType[] {INT(), BIGINT()}, hbaseSchema.getQualifierDataTypes("f2"));
- assertArrayEquals(
- new DataType[] {DOUBLE(), BOOLEAN(), STRING()},
- hbaseSchema.getQualifierDataTypes("f3"));
- assertArrayEquals(
- new DataType[] {DECIMAL(10, 3), TIMESTAMP(3), DATE(), TIME()},
- hbaseSchema.getQualifierDataTypes("f4"));
- }
-
- @Test
- public void testLookupOptions() {
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
- Map<String, String> options = getAllOptions();
- options.put("lookup.cache", "PARTIAL");
- options.put("lookup.partial-cache.expire-after-access", "15213s");
- options.put("lookup.partial-cache.expire-after-write", "18213s");
- options.put("lookup.partial-cache.max-rows", "10000");
- options.put("lookup.partial-cache.cache-missing-key", "false");
- options.put("lookup.max-retries", "15513");
-
- DynamicTableSource source = createTableSource(schema, options);
- HBaseDynamicTableSource hbaseSource = (HBaseDynamicTableSource) source;
- assertThat(((HBaseDynamicTableSource) source).getMaxRetryTimes()).isEqualTo(15513);
- assertThat(hbaseSource.getCache()).isInstanceOf(DefaultLookupCache.class);
- DefaultLookupCache cache = (DefaultLookupCache) hbaseSource.getCache();
- assertThat(cache)
- .isEqualTo(
- DefaultLookupCache.newBuilder()
- .expireAfterAccess(Duration.ofSeconds(15213))
- .expireAfterWrite(Duration.ofSeconds(18213))
- .maximumSize(10000)
- .cacheMissingKey(false)
- .build());
- }
-
- @Test
- public void testTableSinkFactory() {
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))),
- Column.physical(FAMILY2, ROW(FIELD(COL1, INT()), FIELD(COL3, BIGINT()))),
- Column.physical(
- FAMILY3, ROW(FIELD(COL2, BOOLEAN()), FIELD(COL3, STRING()))),
- Column.physical(
- FAMILY4,
- ROW(
- FIELD(COL1, DECIMAL(10, 3)),
- FIELD(COL2, TIMESTAMP(3)),
- FIELD(COL3, DATE()),
- FIELD(COL4, TIME()))));
-
- DynamicTableSink sink = createTableSink(schema, getAllOptions());
- assertTrue(sink instanceof HBaseDynamicTableSink);
- HBaseDynamicTableSink hbaseSink = (HBaseDynamicTableSink) sink;
-
- HBaseTableSchema hbaseSchema = hbaseSink.getHBaseTableSchema();
- assertEquals(0, hbaseSchema.getRowKeyIndex());
- assertEquals(Optional.of(STRING()), hbaseSchema.getRowKeyDataType());
-
- assertArrayEquals(new String[] {"f1", "f2", "f3", "f4"}, hbaseSchema.getFamilyNames());
- assertArrayEquals(new String[] {"c1", "c2"}, hbaseSchema.getQualifierNames("f1"));
- assertArrayEquals(new String[] {"c1", "c3"}, hbaseSchema.getQualifierNames("f2"));
- assertArrayEquals(new String[] {"c2", "c3"}, hbaseSchema.getQualifierNames("f3"));
- assertArrayEquals(
- new String[] {"c1", "c2", "c3", "c4"}, hbaseSchema.getQualifierNames("f4"));
-
- assertArrayEquals(
- new DataType[] {DOUBLE(), INT()}, hbaseSchema.getQualifierDataTypes("f1"));
- assertArrayEquals(
- new DataType[] {INT(), BIGINT()}, hbaseSchema.getQualifierDataTypes("f2"));
- assertArrayEquals(
- new DataType[] {BOOLEAN(), STRING()}, hbaseSchema.getQualifierDataTypes("f3"));
- assertArrayEquals(
- new DataType[] {DECIMAL(10, 3), TIMESTAMP(3), DATE(), TIME()},
- hbaseSchema.getQualifierDataTypes("f4"));
-
- // verify hadoop Configuration
- org.apache.hadoop.conf.Configuration expectedConfiguration =
- HBaseConfigurationUtil.getHBaseConfiguration();
- expectedConfiguration.set(HConstants.ZOOKEEPER_QUORUM, "localhost:2181");
- expectedConfiguration.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/flink");
- expectedConfiguration.set("hbase.security.authentication", "kerberos");
-
- org.apache.hadoop.conf.Configuration actualConfiguration = hbaseSink.getConfiguration();
-
- assertEquals(
- IteratorUtils.toList(expectedConfiguration.iterator()),
- IteratorUtils.toList(actualConfiguration.iterator()));
-
- // verify tableName
- assertEquals("testHBastTable", hbaseSink.getTableName());
-
- HBaseWriteOptions expectedWriteOptions =
- HBaseWriteOptions.builder()
- .setBufferFlushMaxRows(1000)
- .setBufferFlushIntervalMillis(1000)
- .setBufferFlushMaxSizeInBytes(2 * 1024 * 1024)
- .build();
- HBaseWriteOptions actualWriteOptions = hbaseSink.getWriteOptions();
- assertEquals(expectedWriteOptions, actualWriteOptions);
- }
-
- @Test
- public void testBufferFlushOptions() {
- Map<String, String> options = getAllOptions();
- options.put("sink.buffer-flush.max-size", "10mb");
- options.put("sink.buffer-flush.max-rows", "100");
- options.put("sink.buffer-flush.interval", "10s");
-
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
-
- DynamicTableSink sink = createTableSink(schema, options);
- HBaseWriteOptions expected =
- HBaseWriteOptions.builder()
- .setBufferFlushMaxRows(100)
- .setBufferFlushIntervalMillis(10 * 1000)
- .setBufferFlushMaxSizeInBytes(10 * 1024 * 1024)
- .build();
- HBaseWriteOptions actual = ((HBaseDynamicTableSink) sink).getWriteOptions();
- assertEquals(expected, actual);
- }
-
- @Test
- public void testParallelismOptions() {
- Map<String, String> options = getAllOptions();
- options.put("sink.parallelism", "2");
-
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
-
- DynamicTableSink sink = createTableSink(schema, options);
- assertTrue(sink instanceof HBaseDynamicTableSink);
- HBaseDynamicTableSink hbaseSink = (HBaseDynamicTableSink) sink;
- SinkFunctionProvider provider =
- (SinkFunctionProvider)
- hbaseSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false));
- assertEquals(2, (long) provider.getParallelism().get());
- }
-
- @Test
- public void testLookupAsync() {
- Map<String, String> options = getAllOptions();
- options.put("lookup.async", "true");
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))));
- DynamicTableSource source = createTableSource(schema, options);
- assertTrue(source instanceof HBaseDynamicTableSource);
- HBaseDynamicTableSource hbaseSource = (HBaseDynamicTableSource) source;
-
- int[][] lookupKey = {{0}};
- LookupTableSource.LookupRuntimeProvider lookupProvider =
- hbaseSource.getLookupRuntimeProvider(new LookupRuntimeProviderContext(lookupKey));
- assertTrue(lookupProvider instanceof AsyncLookupFunctionProvider);
-
- AsyncLookupFunction asyncTableFunction =
- ((AsyncLookupFunctionProvider) lookupProvider).createAsyncLookupFunction();
- assertTrue(asyncTableFunction instanceof HBaseRowDataAsyncLookupFunction);
- assertEquals(
- "testHBastTable",
- ((HBaseRowDataAsyncLookupFunction) asyncTableFunction).getHTableName());
- }
-
- @Test
- public void testDisabledBufferFlushOptions() {
- Map<String, String> options = getAllOptions();
- options.put("sink.buffer-flush.max-size", "0");
- options.put("sink.buffer-flush.max-rows", "0");
- options.put("sink.buffer-flush.interval", "0");
-
- ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
-
- DynamicTableSink sink = createTableSink(schema, options);
- HBaseWriteOptions expected =
- HBaseWriteOptions.builder()
- .setBufferFlushMaxRows(0)
- .setBufferFlushIntervalMillis(0)
- .setBufferFlushMaxSizeInBytes(0)
- .build();
- HBaseWriteOptions actual = ((HBaseDynamicTableSink) sink).getWriteOptions();
- assertEquals(expected, actual);
- }
-
- @Test
- public void testUnknownOption() {
- Map<String, String> options = getAllOptions();
- options.put("sink.unknown.key", "unknown-value");
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))));
-
- try {
- createTableSource(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e, "Unsupported options:\n\nsink.unknown.key")
- .isPresent());
- }
-
- try {
- createTableSink(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e, "Unsupported options:\n\nsink.unknown.key")
- .isPresent());
- }
- }
-
- @Test
- public void testTypeWithUnsupportedPrecision() {
- Map<String, String> options = getAllOptions();
- // test unsupported timestamp precision
- ResolvedSchema schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(
- FAMILY1, ROW(FIELD(COL1, TIMESTAMP(6)), FIELD(COL2, INT()))));
- try {
- createTableSource(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIMESTAMP type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
-
- try {
- createTableSink(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIMESTAMP type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
- // test unsupported time precision
- schema =
- ResolvedSchema.of(
- Column.physical(ROWKEY, STRING()),
- Column.physical(FAMILY1, ROW(FIELD(COL1, TIME(6)), FIELD(COL2, INT()))));
-
- try {
- createTableSource(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIME type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
-
- try {
- createTableSink(schema, options);
- fail("Should fail");
- } catch (Exception e) {
- assertTrue(
- ExceptionUtils.findThrowableWithMessage(
- e,
- "The precision 6 of TIME type is out of the range [0, 3]"
- + " supported by HBase connector")
- .isPresent());
- }
- }
-
- private Map<String, String> getAllOptions() {
- Map<String, String> options = new HashMap<>();
- options.put("connector", "hbase-2.2");
- options.put("table-name", "testHBastTable");
- options.put("zookeeper.quorum", "localhost:2181");
- options.put("zookeeper.znode.parent", "/flink");
- options.put("properties.hbase.security.authentication", "kerberos");
- return options;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseTablePlanTest.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseTablePlanTest.java
deleted file mode 100644
index 048e08d30e8..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseTablePlanTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2;
-
-import org.apache.flink.table.api.TableConfig;
-import org.apache.flink.table.planner.utils.StreamTableTestUtil;
-import org.apache.flink.table.planner.utils.TableTestBase;
-
-import org.junit.Test;
-
-import static org.apache.flink.core.testutils.FlinkMatchers.containsCause;
-
-/** Plan tests for HBase connector, for example, testing projection push down. */
-public class HBaseTablePlanTest extends TableTestBase {
-
- private final StreamTableTestUtil util = streamTestUtil(TableConfig.getDefault());
-
- @Test
- public void testMultipleRowKey() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " rowkey INT,"
- + " rowkey2 STRING "
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "Row key can't be set multiple times.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testNoneRowKey() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>"
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "HBase table requires to define a row key field. "
- + "A row key field is defined as an atomic type, "
- + "column families and qualifiers are defined as ROW type.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testInvalidPrimaryKey() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " rowkey STRING, "
- + " PRIMARY KEY (family1) NOT ENFORCED "
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "Primary key of HBase table must be defined on the row key field. "
- + "A row key field is defined as an atomic type, "
- + "column families and qualifiers are defined as ROW type.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testUnsupportedDataType() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " col1 ARRAY<STRING>, "
- + " rowkey STRING, "
- + " PRIMARY KEY (rowkey) NOT ENFORCED "
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- thrown().expect(
- containsCause(
- new IllegalArgumentException(
- "Unsupported field type 'ARRAY<STRING>' for HBase.")));
- util.verifyExecPlan("SELECT * FROM hTable");
- }
-
- @Test
- public void testProjectionPushDown() {
- util.tableEnv()
- .executeSql(
- "CREATE TABLE hTable ("
- + " family1 ROW<col1 INT>,"
- + " family2 ROW<col1 STRING, col2 BIGINT>,"
- + " family3 ROW<col1 DOUBLE, col2 BOOLEAN, col3 STRING>,"
- + " rowkey INT,"
- + " PRIMARY KEY (rowkey) NOT ENFORCED"
- + ") WITH ("
- + " 'connector' = 'hbase-2.2',"
- + " 'table-name' = 'my_table',"
- + " 'zookeeper.quorum' = 'localhost:2021'"
- + ")");
- util.verifyExecPlan("SELECT h.family3, h.family2.col2 FROM hTable AS h");
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/source/HBaseRowDataAsyncLookupFunctionTest.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/source/HBaseRowDataAsyncLookupFunctionTest.java
deleted file mode 100644
index 1c1ad725b4a..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/source/HBaseRowDataAsyncLookupFunctionTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.source;
-
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.connector.hbase2.util.HBaseTestBase;
-import org.apache.flink.table.api.DataTypes;
-import org.apache.flink.table.connector.source.lookup.LookupOptions;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.types.DataType;
-
-import org.apache.flink.shaded.guava31.com.google.common.collect.Lists;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import java.util.stream.Collectors;
-
-import static org.apache.flink.table.api.DataTypes.BIGINT;
-import static org.apache.flink.table.api.DataTypes.DOUBLE;
-import static org.apache.flink.table.api.DataTypes.FIELD;
-import static org.apache.flink.table.api.DataTypes.INT;
-import static org.apache.flink.table.api.DataTypes.ROW;
-import static org.apache.flink.table.api.DataTypes.STRING;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/** Test suite for {@link HBaseRowDataAsyncLookupFunction}. */
-public class HBaseRowDataAsyncLookupFunctionTest extends HBaseTestBase {
- @Test
- public void testEval() throws Exception {
- HBaseRowDataAsyncLookupFunction lookupFunction = buildRowDataAsyncLookupFunction();
-
- lookupFunction.open(null);
- final List<String> result = new ArrayList<>();
- int[] rowkeys = {1, 2, 1, 12, 3, 12, 4, 3};
- CountDownLatch latch = new CountDownLatch(rowkeys.length);
- for (int rowkey : rowkeys) {
- CompletableFuture<Collection<RowData>> future = new CompletableFuture<>();
- lookupFunction.eval(future, rowkey);
- future.whenComplete(
- (rs, t) -> {
- synchronized (result) {
- if (rs.isEmpty()) {
- result.add(rowkey + ": null");
- } else {
- rs.forEach(row -> result.add(rowkey + ": " + row.toString()));
- }
- }
- latch.countDown();
- });
- }
- // this verifies lookup calls are async
- assertTrue(result.size() < rowkeys.length);
- latch.await();
- lookupFunction.close();
- List<String> sortResult =
- Lists.newArrayList(result).stream().sorted().collect(Collectors.toList());
- List<String> expected = new ArrayList<>();
- expected.add("12: null");
- expected.add("12: null");
- expected.add("1: +I(1,+I(10),+I(Hello-1,100),+I(1.01,false,Welt-1))");
- expected.add("1: +I(1,+I(10),+I(Hello-1,100),+I(1.01,false,Welt-1))");
- expected.add("2: +I(2,+I(20),+I(Hello-2,200),+I(2.02,true,Welt-2))");
- expected.add("3: +I(3,+I(30),+I(Hello-3,300),+I(3.03,false,Welt-3))");
- expected.add("3: +I(3,+I(30),+I(Hello-3,300),+I(3.03,false,Welt-3))");
- expected.add("4: +I(4,+I(40),+I(null,400),+I(4.04,true,Welt-4))");
- assertEquals(expected, sortResult);
- }
-
- private HBaseRowDataAsyncLookupFunction buildRowDataAsyncLookupFunction() {
- DataType dataType =
- ROW(
- FIELD(ROW_KEY, INT()),
- FIELD(FAMILY1, ROW(FIELD(F1COL1, INT()))),
- FIELD(FAMILY2, ROW(FIELD(F2COL1, STRING()), FIELD(F2COL2, BIGINT()))),
- FIELD(
- FAMILY3,
- ROW(
- FIELD(F3COL1, DOUBLE()),
- FIELD(F3COL2, DataTypes.BOOLEAN()),
- FIELD(F3COL3, STRING()))));
- HBaseTableSchema hbaseSchema = HBaseTableSchema.fromDataType(dataType);
- return new HBaseRowDataAsyncLookupFunction(
- getConf(),
- TEST_TABLE_1,
- hbaseSchema,
- "null",
- LookupOptions.MAX_RETRIES.defaultValue());
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/util/HBaseTestBase.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/util/HBaseTestBase.java
deleted file mode 100644
index 1e639ba9703..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/util/HBaseTestBase.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.util;
-
-import org.apache.flink.table.api.EnvironmentSettings;
-
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.apache.flink.table.utils.DateTimeUtils.toInternal;
-
-/** Abstract IT case class for HBase. */
-public abstract class HBaseTestBase extends HBaseTestingClusterAutoStarter {
-
- protected static final String TEST_TABLE_1 = "testTable1";
- protected static final String TEST_TABLE_2 = "testTable2";
- protected static final String TEST_TABLE_3 = "testTable3";
-
- protected static final String ROW_KEY = "rowkey";
-
- protected static final String FAMILY1 = "family1";
- protected static final String F1COL1 = "col1";
-
- protected static final String FAMILY2 = "family2";
- protected static final String F2COL1 = "col1";
- protected static final String F2COL2 = "col2";
-
- protected static final String FAMILY3 = "family3";
- protected static final String F3COL1 = "col1";
- protected static final String F3COL2 = "col2";
- protected static final String F3COL3 = "col3";
-
- protected static final String FAMILY4 = "family4";
- protected static final String F4COL1 = "col1";
- protected static final String F4COL2 = "col2";
- protected static final String F4COL3 = "col3";
- protected static final String F4COL4 = "col4";
-
- private static final byte[][] FAMILIES =
- new byte[][] {
- Bytes.toBytes(FAMILY1),
- Bytes.toBytes(FAMILY2),
- Bytes.toBytes(FAMILY3),
- Bytes.toBytes(FAMILY4)
- };
-
- private static final byte[][] SPLIT_KEYS = new byte[][] {Bytes.toBytes(4)};
-
- protected EnvironmentSettings streamSettings;
- protected EnvironmentSettings batchSettings;
-
- @BeforeClass
- public static void activateHBaseCluster() throws IOException {
- prepareTables();
- }
-
- @Before
- public void before() {
- this.streamSettings = EnvironmentSettings.inStreamingMode();
- this.batchSettings = EnvironmentSettings.inBatchMode();
- }
-
- private static void prepareTables() throws IOException {
- createHBaseTable1();
- createHBaseTable2();
- createHBaseTable3();
- }
-
- private static void createHBaseTable1() throws IOException {
- // create a table
- TableName tableName = TableName.valueOf(TEST_TABLE_1);
- createTable(tableName, FAMILIES, SPLIT_KEYS);
-
- // get the HTable instance
- Table table = openTable(tableName);
- List<Put> puts = new ArrayList<>();
- // add some data
- puts.add(
- putRow(
- 1,
- 10,
- "Hello-1",
- 100L,
- 1.01,
- false,
- "Welt-1",
- Timestamp.valueOf("2019-08-18 19:00:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:00:00"),
- new BigDecimal("12345678.0001")));
- puts.add(
- putRow(
- 2,
- 20,
- "Hello-2",
- 200L,
- 2.02,
- true,
- "Welt-2",
- Timestamp.valueOf("2019-08-18 19:01:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:01:00"),
- new BigDecimal("12345678.0002")));
- puts.add(
- putRow(
- 3,
- 30,
- "Hello-3",
- 300L,
- 3.03,
- false,
- "Welt-3",
- Timestamp.valueOf("2019-08-18 19:02:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:02:00"),
- new BigDecimal("12345678.0003")));
- puts.add(
- putRow(
- 4,
- 40,
- null,
- 400L,
- 4.04,
- true,
- "Welt-4",
- Timestamp.valueOf("2019-08-18 19:03:00"),
- Date.valueOf("2019-08-18"),
- Time.valueOf("19:03:00"),
- new BigDecimal("12345678.0004")));
- puts.add(
- putRow(
- 5,
- 50,
- "Hello-5",
- 500L,
- 5.05,
- false,
- "Welt-5",
- Timestamp.valueOf("2019-08-19 19:10:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:10:00"),
- new BigDecimal("12345678.0005")));
- puts.add(
- putRow(
- 6,
- 60,
- "Hello-6",
- 600L,
- 6.06,
- true,
- "Welt-6",
- Timestamp.valueOf("2019-08-19 19:20:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:20:00"),
- new BigDecimal("12345678.0006")));
- puts.add(
- putRow(
- 7,
- 70,
- "Hello-7",
- 700L,
- 7.07,
- false,
- "Welt-7",
- Timestamp.valueOf("2019-08-19 19:30:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:30:00"),
- new BigDecimal("12345678.0007")));
- puts.add(
- putRow(
- 8,
- 80,
- null,
- 800L,
- 8.08,
- true,
- "Welt-8",
- Timestamp.valueOf("2019-08-19 19:40:00"),
- Date.valueOf("2019-08-19"),
- Time.valueOf("19:40:00"),
- new BigDecimal("12345678.0008")));
-
- // append rows to table
- table.put(puts);
- table.close();
- }
-
- private static void createHBaseTable2() {
- // create a table
- TableName tableName = TableName.valueOf(TEST_TABLE_2);
- createTable(tableName, FAMILIES, SPLIT_KEYS);
- }
-
- private static void createHBaseTable3() {
- // create a table
- byte[][] families =
- new byte[][] {
- Bytes.toBytes(FAMILY1),
- Bytes.toBytes(FAMILY2),
- Bytes.toBytes(FAMILY3),
- Bytes.toBytes(FAMILY4),
- };
- TableName tableName = TableName.valueOf(TEST_TABLE_3);
- createTable(tableName, families, SPLIT_KEYS);
- }
-
- private static Put putRow(
- int rowKey,
- int f1c1,
- String f2c1,
- long f2c2,
- double f3c1,
- boolean f3c2,
- String f3c3,
- Timestamp f4c1,
- Date f4c2,
- Time f4c3,
- BigDecimal f4c4) {
- Put put = new Put(Bytes.toBytes(rowKey));
- // family 1
- put.addColumn(Bytes.toBytes(FAMILY1), Bytes.toBytes(F1COL1), Bytes.toBytes(f1c1));
- // family 2
- if (f2c1 != null) {
- put.addColumn(Bytes.toBytes(FAMILY2), Bytes.toBytes(F2COL1), Bytes.toBytes(f2c1));
- }
- put.addColumn(Bytes.toBytes(FAMILY2), Bytes.toBytes(F2COL2), Bytes.toBytes(f2c2));
- // family 3
- put.addColumn(Bytes.toBytes(FAMILY3), Bytes.toBytes(F3COL1), Bytes.toBytes(f3c1));
- put.addColumn(Bytes.toBytes(FAMILY3), Bytes.toBytes(F3COL2), Bytes.toBytes(f3c2));
- put.addColumn(Bytes.toBytes(FAMILY3), Bytes.toBytes(F3COL3), Bytes.toBytes(f3c3));
-
- // family 4
- put.addColumn(
- Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL1), Bytes.toBytes(toInternal(f4c1)));
- put.addColumn(
- Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL2), Bytes.toBytes(toInternal(f4c2)));
- put.addColumn(
- Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL3), Bytes.toBytes(toInternal(f4c3)));
- put.addColumn(Bytes.toBytes(FAMILY4), Bytes.toBytes(F4COL4), Bytes.toBytes(f4c4));
- return put;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/util/HBaseTestingClusterAutoStarter.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/util/HBaseTestingClusterAutoStarter.java
deleted file mode 100644
index 2482f1ae516..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/util/HBaseTestingClusterAutoStarter.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase2.util;
-
-import org.apache.commons.lang3.Range;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.MasterNotRunningException;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.ZooKeeperConnectionException;
-import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.util.VersionUtil;
-import org.junit.AfterClass;
-import org.junit.Assume;
-import org.junit.BeforeClass;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * By using this class as the super class of a set of tests you will have a HBase testing cluster
- * available that is very suitable for writing tests for scanning and filtering against.
- */
-public class HBaseTestingClusterAutoStarter {
- private static final Log LOG = LogFactory.getLog(HBaseTestingClusterAutoStarter.class);
-
- private static final Range<String> HADOOP_VERSION_RANGE =
- Range.between("2.8.0", "3.0.3", VersionUtil::compareVersions);
-
- private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
- private static Admin admin = null;
- private static List<TableName> createdTables = new ArrayList<>();
-
- private static Configuration conf;
-
- protected static void createTable(
- TableName tableName, byte[][] columnFamilyName, byte[][] splitKeys) {
- assertNotNull("HBaseAdmin is not initialized successfully.", admin);
- HTableDescriptor desc = new HTableDescriptor(tableName);
- for (byte[] fam : columnFamilyName) {
- HColumnDescriptor colDef = new HColumnDescriptor(fam);
- desc.addFamily(colDef);
- }
-
- try {
- admin.createTable(desc, splitKeys);
- createdTables.add(tableName);
- assertTrue("Fail to create the table", admin.tableExists(tableName));
- } catch (IOException e) {
- assertNull("Exception found while creating table", e);
- }
- }
-
- protected static Table openTable(TableName tableName) throws IOException {
- Table table = TEST_UTIL.getConnection().getTable(tableName);
- assertTrue("Fail to create the table", admin.tableExists(tableName));
- return table;
- }
-
- private static void deleteTables() {
- if (admin != null) {
- for (TableName tableName : createdTables) {
- try {
- if (admin.tableExists(tableName)) {
- admin.disableTable(tableName);
- admin.deleteTable(tableName);
- }
- } catch (IOException e) {
- assertNull("Exception found deleting the table", e);
- }
- }
- }
- }
-
- public static Configuration getConf() {
- return conf;
- }
-
- public static String getZookeeperQuorum() {
- return "localhost:" + TEST_UTIL.getZkCluster().getClientPort();
- }
-
- private static void initialize(Configuration c) {
- conf = HBaseConfiguration.create(c);
- // the default retry number is 15 in hbase-2.2, set 15 for test
- conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 15);
- try {
- admin = TEST_UTIL.getAdmin();
- } catch (MasterNotRunningException e) {
- assertNull("Master is not running", e);
- } catch (ZooKeeperConnectionException e) {
- assertNull("Cannot connect to ZooKeeper", e);
- } catch (IOException e) {
- assertNull("IOException", e);
- }
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- // HBase 2.2.3 HBaseTestingUtility works with only a certain range of hadoop versions
- String hadoopVersion = System.getProperty("hadoop.version");
- Assume.assumeTrue(HADOOP_VERSION_RANGE.contains(hadoopVersion));
- TEST_UTIL.startMiniCluster(1);
-
- // https://issues.apache.org/jira/browse/HBASE-11711
- TEST_UTIL.getConfiguration().setInt("hbase.master.info.port", -1);
-
- // Make sure the zookeeper quorum value contains the right port number (varies per run).
- LOG.info("Hbase minicluster client port: " + TEST_UTIL.getZkCluster().getClientPort());
- TEST_UTIL
- .getConfiguration()
- .set(
- "hbase.zookeeper.quorum",
- "localhost:" + TEST_UTIL.getZkCluster().getClientPort());
-
- initialize(TEST_UTIL.getConfiguration());
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- if (conf == null) {
- LOG.info("Skipping Hbase tear down. It was never started");
- return;
- }
- LOG.info("HBase minicluster: Shutting down");
- deleteTables();
- TEST_UTIL.shutdownMiniCluster();
- LOG.info("HBase minicluster: Down");
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/slf4j/impl/Log4jLoggerAdapter.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/slf4j/impl/Log4jLoggerAdapter.java
deleted file mode 100644
index 028780893c4..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/slf4j/impl/Log4jLoggerAdapter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.slf4j.impl;
-
-/** Fake appender to work around HBase referring to it directly. */
-public interface Log4jLoggerAdapter {}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/archunit.properties b/flink-connectors/flink-connector-hbase-2.2/src/test/resources/archunit.properties
deleted file mode 100644
index 15be88c95ba..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/archunit.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# By default we allow removing existing violations, but fail when new violations are added.
-freeze.store.default.allowStoreUpdate=true
-
-# Enable this if a new (frozen) rule has been added in order to create the initial store and record the existing violations.
-#freeze.store.default.allowStoreCreation=true
-
-# Enable this to add allow new violations to be recorded.
-# NOTE: Adding new violations should be avoided when possible. If the rule was correct to flag a new
-# violation, please try to avoid creating the violation. If the violation was created due to a
-# shortcoming of the rule, file a JIRA issue so the rule can be improved.
-#freeze.refreeze=true
-
-freeze.store.default.path=archunit-violations
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/hbase-site.xml b/flink-connectors/flink-connector-hbase-2.2/src/test/resources/hbase-site.xml
deleted file mode 100644
index 1e58ef4a788..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/hbase-site.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- Values used when running unit tests. Specify any values in here that
- should override the default values. -->
-
-<configuration>
- <property>
- <name>hbase_conf_key</name>
- <value>hbase_conf_value!</value>
- </property>
-</configuration>
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/log4j2-test.properties b/flink-connectors/flink-connector-hbase-2.2/src/test/resources/log4j2-test.properties
deleted file mode 100644
index 835c2ec9a3d..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/log4j2-test.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-################################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-################################################################################
-
-# Set root logger level to OFF to not flood build logs
-# set manually to INFO for debugging purposes
-rootLogger.level = OFF
-rootLogger.appenderRef.test.ref = TestLogger
-
-appender.testlogger.name = TestLogger
-appender.testlogger.type = CONSOLE
-appender.testlogger.target = SYSTEM_ERR
-appender.testlogger.layout.type = PatternLayout
-appender.testlogger.layout.pattern = %-4r [%t] %-5p %c %x - %m%n
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/org/apache/flink/connector/hbase2/HBaseTablePlanTest.xml b/flink-connectors/flink-connector-hbase-2.2/src/test/resources/org/apache/flink/connector/hbase2/HBaseTablePlanTest.xml
deleted file mode 100644
index 9885ccbebd0..00000000000
--- a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/org/apache/flink/connector/hbase2/HBaseTablePlanTest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<Root>
- <TestCase name="testProjectionPushDown">
- <Resource name="sql">
- <![CDATA[SELECT h.family3, h.family2.col2 FROM hTable AS h]]>
- </Resource>
- <Resource name="ast">
- <![CDATA[
-LogicalProject(family3=[$2], col2=[$1.col2])
-+- LogicalTableScan(table=[[default_catalog, default_database, hTable]])
-]]>
- </Resource>
- <Resource name="optimized exec plan">
- <![CDATA[
-Calc(select=[family3, family2.col2 AS col2])
-+- TableSourceScan(table=[[default_catalog, default_database, hTable, project=[family3, family2]]], fields=[family3, family2])
-]]>
- </Resource>
- </TestCase>
-</Root>
diff --git a/flink-connectors/flink-connector-hbase-base/archunit-violations/f8f77b71-7087-4b3f-88c5-29588fadcc52 b/flink-connectors/flink-connector-hbase-base/archunit-violations/f8f77b71-7087-4b3f-88c5-29588fadcc52
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/flink-connectors/flink-connector-hbase-base/archunit-violations/fd028eab-0e49-4e91-9c40-477a55f378f2 b/flink-connectors/flink-connector-hbase-base/archunit-violations/fd028eab-0e49-4e91-9c40-477a55f378f2
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/flink-connectors/flink-connector-hbase-base/archunit-violations/stored.rules b/flink-connectors/flink-connector-hbase-base/archunit-violations/stored.rules
deleted file mode 100644
index c5f72df90e4..00000000000
--- a/flink-connectors/flink-connector-hbase-base/archunit-violations/stored.rules
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-#Tue Feb 22 12:17:29 CET 2022
-Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=f8f77b71-7087-4b3f-88c5-29588fadcc52
-ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=fd028eab-0e49-4e91-9c40-477a55f378f2
diff --git a/flink-connectors/flink-connector-hbase-base/pom.xml b/flink-connectors/flink-connector-hbase-base/pom.xml
deleted file mode 100644
index 2193dc75798..00000000000
--- a/flink-connectors/flink-connector-hbase-base/pom.xml
+++ /dev/null
@@ -1,235 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-connectors</artifactId>
- <version>1.18-SNAPSHOT</version>
- </parent>
-
- <artifactId>flink-connector-hbase-base</artifactId>
- <name>Flink : Connectors : HBase base</name>
- <packaging>jar</packaging>
-
- <properties>
- <hbase.version>1.4.3</hbase.version>
- </properties>
-
- <dependencies>
-
- <!-- Core -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-streaming-java</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Table ecosystem -->
-
- <!-- Projects depending on this project won't depend on flink-table-*. -->
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-table-api-java-bridge</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
-
- <!-- HBase -->
-
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-common</artifactId>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-client</artifactId>
- <version>${hbase.version}</version>
- <exclusions>
- <!-- Remove unneeded dependency, which is conflicting with our jetty-util version. -->
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-sslengine</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-2.1</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.1</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- </exclusion>
- <!-- Bug in hbase annotations, can be removed when fixed. See FLINK-2153. -->
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-common</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-auth</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-mapreduce-client-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.reload4j</groupId>
- <artifactId>reload4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-reload4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <!-- Bump hbase netty dependency -->
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.1.46.Final</version>
- </dependency>
-
- <dependency>
- <!-- Replaces Hbase log4j dependency -->
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-1.2-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- ArchUit test dependencies -->
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-architecture-tests-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- <configuration>
- <excludes>
- <!-- test-jar is still used by JUnit4 modules -->
- <exclude>META-INF/services/org.junit.jupiter.api.extension.Extension</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>java11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- hbase currently does not support Java 11, see HBASE-21110 -->
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/options/HBaseWriteOptions.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/options/HBaseWriteOptions.java
deleted file mode 100644
index 0ba2f88bff2..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/options/HBaseWriteOptions.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.options;
-
-import org.apache.flink.annotation.Internal;
-
-import org.apache.hadoop.hbase.client.ConnectionConfiguration;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-/** Options for HBase writing. */
-@Internal
-public class HBaseWriteOptions implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final long bufferFlushMaxSizeInBytes;
- private final long bufferFlushMaxRows;
- private final long bufferFlushIntervalMillis;
- private final Integer parallelism;
-
- private HBaseWriteOptions(
- long bufferFlushMaxSizeInBytes,
- long bufferFlushMaxMutations,
- long bufferFlushIntervalMillis,
- Integer parallelism) {
- this.bufferFlushMaxSizeInBytes = bufferFlushMaxSizeInBytes;
- this.bufferFlushMaxRows = bufferFlushMaxMutations;
- this.bufferFlushIntervalMillis = bufferFlushIntervalMillis;
- this.parallelism = parallelism;
- }
-
- public long getBufferFlushMaxSizeInBytes() {
- return bufferFlushMaxSizeInBytes;
- }
-
- public long getBufferFlushMaxRows() {
- return bufferFlushMaxRows;
- }
-
- public long getBufferFlushIntervalMillis() {
- return bufferFlushIntervalMillis;
- }
-
- public Integer getParallelism() {
- return parallelism;
- }
-
- @Override
- public String toString() {
- return "HBaseWriteOptions{"
- + "bufferFlushMaxSizeInBytes="
- + bufferFlushMaxSizeInBytes
- + ", bufferFlushMaxRows="
- + bufferFlushMaxRows
- + ", bufferFlushIntervalMillis="
- + bufferFlushIntervalMillis
- + ", parallelism="
- + parallelism
- + '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- HBaseWriteOptions that = (HBaseWriteOptions) o;
- return bufferFlushMaxSizeInBytes == that.bufferFlushMaxSizeInBytes
- && bufferFlushMaxRows == that.bufferFlushMaxRows
- && bufferFlushIntervalMillis == that.bufferFlushIntervalMillis
- && parallelism == that.parallelism;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(
- bufferFlushMaxSizeInBytes,
- bufferFlushMaxRows,
- bufferFlushIntervalMillis,
- parallelism);
- }
-
- /** Creates a builder for {@link HBaseWriteOptions}. */
- public static Builder builder() {
- return new Builder();
- }
-
- /** Builder for {@link HBaseWriteOptions}. */
- public static class Builder {
-
- private long bufferFlushMaxSizeInBytes = ConnectionConfiguration.WRITE_BUFFER_SIZE_DEFAULT;
- private long bufferFlushMaxRows = 0;
- private long bufferFlushIntervalMillis = 0;
- private Integer parallelism;
-
- /**
- * Optional. Sets when to flush a buffered request based on the memory size of rows
- * currently added. Default to <code>2mb</code>.
- */
- public Builder setBufferFlushMaxSizeInBytes(long bufferFlushMaxSizeInBytes) {
- this.bufferFlushMaxSizeInBytes = bufferFlushMaxSizeInBytes;
- return this;
- }
-
- /**
- * Optional. Sets when to flush buffered request based on the number of rows currently
- * added. Defaults to not set, i.e. won't flush based on the number of buffered rows.
- */
- public Builder setBufferFlushMaxRows(long bufferFlushMaxRows) {
- this.bufferFlushMaxRows = bufferFlushMaxRows;
- return this;
- }
-
- /**
- * Optional. Sets a flush interval flushing buffered requesting if the interval passes, in
- * milliseconds. Defaults to not set, i.e. won't flush based on flush interval.
- */
- public Builder setBufferFlushIntervalMillis(long bufferFlushIntervalMillis) {
- this.bufferFlushIntervalMillis = bufferFlushIntervalMillis;
- return this;
- }
-
- /**
- * Optional. Defines the parallelism of the HBase sink operator. By default, the parallelism
- * is determined by the framework using the same parallelism of the upstream chained
- * operator.
- */
- public Builder setParallelism(Integer parallelism) {
- this.parallelism = parallelism;
- return this;
- }
-
- /** Creates a new instance of {@link HBaseWriteOptions}. */
- public HBaseWriteOptions build() {
- return new HBaseWriteOptions(
- bufferFlushMaxSizeInBytes,
- bufferFlushMaxRows,
- bufferFlushIntervalMillis,
- parallelism);
- }
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/HBaseMutationConverter.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/HBaseMutationConverter.java
deleted file mode 100644
index d89bd4ca030..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/HBaseMutationConverter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.sink;
-
-import org.apache.flink.annotation.Internal;
-
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.client.Put;
-
-import java.io.Serializable;
-
-/**
- * A converter used to converts the input record into HBase {@link Mutation}.
- *
- * @param <T> type of input record.
- */
-@Internal
-public interface HBaseMutationConverter<T> extends Serializable {
-
- /** Initialization method for the function. It is called once before conversion method. */
- void open();
-
- /**
- * Converts the input record into HBase {@link Mutation}. A mutation can be a {@link Put} or
- * {@link Delete}.
- */
- Mutation convertToMutation(T record);
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/HBaseSinkFunction.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/HBaseSinkFunction.java
deleted file mode 100644
index 4dd30b37b0d..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/HBaseSinkFunction.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.sink;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.runtime.state.FunctionInitializationContext;
-import org.apache.flink.runtime.state.FunctionSnapshotContext;
-import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
-import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;
-import org.apache.flink.util.StringUtils;
-import org.apache.flink.util.concurrent.ExecutorThreadFactory;
-
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.hadoop.hbase.client.BufferedMutator;
-import org.apache.hadoop.hbase.client.BufferedMutatorParams;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * The sink function for HBase.
- *
- * <p>This class leverage {@link BufferedMutator} to buffer multiple {@link
- * org.apache.hadoop.hbase.client.Mutation Mutations} before sending the requests to cluster. The
- * buffering strategy can be configured by {@code bufferFlushMaxSizeInBytes}, {@code
- * bufferFlushMaxMutations} and {@code bufferFlushIntervalMillis}.
- */
-@Internal
-public class HBaseSinkFunction<T> extends RichSinkFunction<T>
- implements CheckpointedFunction, BufferedMutator.ExceptionListener {
-
- private static final long serialVersionUID = 1L;
- private static final Logger LOG = LoggerFactory.getLogger(HBaseSinkFunction.class);
-
- private final String hTableName;
- private final byte[] serializedConfig;
-
- private final long bufferFlushMaxSizeInBytes;
- private final long bufferFlushMaxMutations;
- private final long bufferFlushIntervalMillis;
- private final HBaseMutationConverter<T> mutationConverter;
-
- private transient Connection connection;
- private transient BufferedMutator mutator;
-
- private transient ScheduledExecutorService executor;
- private transient ScheduledFuture scheduledFuture;
- private transient AtomicLong numPendingRequests;
-
- private transient volatile boolean closed = false;
-
- /**
- * This is set from inside the {@link BufferedMutator.ExceptionListener} if a {@link Throwable}
- * was thrown.
- *
- * <p>Errors will be checked and rethrown before processing each input element, and when the
- * sink is closed.
- */
- private final AtomicReference<Throwable> failureThrowable = new AtomicReference<>();
-
- public HBaseSinkFunction(
- String hTableName,
- org.apache.hadoop.conf.Configuration conf,
- HBaseMutationConverter<T> mutationConverter,
- long bufferFlushMaxSizeInBytes,
- long bufferFlushMaxMutations,
- long bufferFlushIntervalMillis) {
- this.hTableName = hTableName;
- // Configuration is not serializable
- this.serializedConfig = HBaseConfigurationUtil.serializeConfiguration(conf);
- this.mutationConverter = mutationConverter;
- this.bufferFlushMaxSizeInBytes = bufferFlushMaxSizeInBytes;
- this.bufferFlushMaxMutations = bufferFlushMaxMutations;
- this.bufferFlushIntervalMillis = bufferFlushIntervalMillis;
- }
-
- @Override
- public void open(Configuration parameters) throws Exception {
- LOG.info("start open ...");
- org.apache.hadoop.conf.Configuration config = prepareRuntimeConfiguration();
- try {
- this.mutationConverter.open();
- this.numPendingRequests = new AtomicLong(0);
-
- if (null == connection) {
- this.connection = ConnectionFactory.createConnection(config);
- }
- // create a parameter instance, set the table name and custom listener reference.
- BufferedMutatorParams params =
- new BufferedMutatorParams(TableName.valueOf(hTableName)).listener(this);
- if (bufferFlushMaxSizeInBytes > 0) {
- params.writeBufferSize(bufferFlushMaxSizeInBytes);
- }
- this.mutator = connection.getBufferedMutator(params);
-
- if (bufferFlushIntervalMillis > 0 && bufferFlushMaxMutations != 1) {
- this.executor =
- Executors.newScheduledThreadPool(
- 1, new ExecutorThreadFactory("hbase-upsert-sink-flusher"));
- this.scheduledFuture =
- this.executor.scheduleWithFixedDelay(
- () -> {
- if (closed) {
- return;
- }
- try {
- flush();
- } catch (Exception e) {
- // fail the sink and skip the rest of the items
- // if the failure handler decides to throw an exception
- failureThrowable.compareAndSet(null, e);
- }
- },
- bufferFlushIntervalMillis,
- bufferFlushIntervalMillis,
- TimeUnit.MILLISECONDS);
- }
- } catch (TableNotFoundException tnfe) {
- LOG.error("The table " + hTableName + " not found ", tnfe);
- throw new RuntimeException("HBase table '" + hTableName + "' not found.", tnfe);
- } catch (IOException ioe) {
- LOG.error("Exception while creating connection to HBase.", ioe);
- throw new RuntimeException("Cannot create connection to HBase.", ioe);
- }
- LOG.info("end open.");
- }
-
- private org.apache.hadoop.conf.Configuration prepareRuntimeConfiguration() throws IOException {
- // create default configuration from current runtime env (`hbase-site.xml` in classpath)
- // first,
- // and overwrite configuration using serialized configuration from client-side env
- // (`hbase-site.xml` in classpath).
- // user params from client-side have the highest priority
- org.apache.hadoop.conf.Configuration runtimeConfig =
- HBaseConfigurationUtil.deserializeConfiguration(
- serializedConfig, HBaseConfigurationUtil.getHBaseConfiguration());
-
- // do validation: check key option(s) in final runtime configuration
- if (StringUtils.isNullOrWhitespaceOnly(runtimeConfig.get(HConstants.ZOOKEEPER_QUORUM))) {
- LOG.error(
- "Can not connect to HBase without {} configuration",
- HConstants.ZOOKEEPER_QUORUM);
- throw new IOException(
- "Check HBase configuration failed, lost: '"
- + HConstants.ZOOKEEPER_QUORUM
- + "'!");
- }
-
- return runtimeConfig;
- }
-
- private void checkErrorAndRethrow() {
- Throwable cause = failureThrowable.get();
- if (cause != null) {
- throw new RuntimeException("An error occurred in HBaseSink.", cause);
- }
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public void invoke(T value, Context context) throws Exception {
- checkErrorAndRethrow();
-
- mutator.mutate(mutationConverter.convertToMutation(value));
-
- // flush when the buffer number of mutations greater than the configured max size.
- if (bufferFlushMaxMutations > 0
- && numPendingRequests.incrementAndGet() >= bufferFlushMaxMutations) {
- flush();
- }
- }
-
- private void flush() throws IOException {
- // BufferedMutator is thread-safe
- mutator.flush();
- numPendingRequests.set(0);
- checkErrorAndRethrow();
- }
-
- @Override
- public void close() throws Exception {
- closed = true;
-
- if (mutator != null) {
- try {
- mutator.close();
- } catch (IOException e) {
- LOG.warn("Exception occurs while closing HBase BufferedMutator.", e);
- }
- this.mutator = null;
- }
-
- if (connection != null) {
- try {
- connection.close();
- } catch (IOException e) {
- LOG.warn("Exception occurs while closing HBase Connection.", e);
- }
- this.connection = null;
- }
-
- if (scheduledFuture != null) {
- scheduledFuture.cancel(false);
- if (executor != null) {
- executor.shutdownNow();
- }
- }
- }
-
- @Override
- public void snapshotState(FunctionSnapshotContext context) throws Exception {
- while (numPendingRequests.get() != 0) {
- flush();
- }
- }
-
- @Override
- public void initializeState(FunctionInitializationContext context) throws Exception {
- // nothing to do.
- }
-
- @Override
- public void onException(RetriesExhaustedWithDetailsException exception, BufferedMutator mutator)
- throws RetriesExhaustedWithDetailsException {
- // fail the sink and skip the rest of the items
- // if the failure handler decides to throw an exception
- failureThrowable.compareAndSet(null, exception);
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/RowDataToMutationConverter.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/RowDataToMutationConverter.java
deleted file mode 100644
index 406a996f8c9..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/sink/RowDataToMutationConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.sink;
-
-import org.apache.flink.connector.hbase.util.HBaseSerde;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.types.RowKind;
-
-import org.apache.hadoop.hbase.client.Mutation;
-
-/**
- * An implementation of {@link HBaseMutationConverter} which converts {@link RowData} into {@link
- * Mutation}.
- */
-public class RowDataToMutationConverter implements HBaseMutationConverter<RowData> {
- private static final long serialVersionUID = 1L;
-
- private final HBaseTableSchema schema;
- private final String nullStringLiteral;
- private transient HBaseSerde serde;
-
- public RowDataToMutationConverter(HBaseTableSchema schema, final String nullStringLiteral) {
- this.schema = schema;
- this.nullStringLiteral = nullStringLiteral;
- }
-
- @Override
- public void open() {
- this.serde = new HBaseSerde(schema, nullStringLiteral);
- }
-
- @Override
- public Mutation convertToMutation(RowData record) {
- RowKind kind = record.getRowKind();
- if (kind == RowKind.INSERT || kind == RowKind.UPDATE_AFTER) {
- return serde.createPutMutation(record);
- } else {
- return serde.createDeleteMutation(record);
- }
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/AbstractHBaseDynamicTableSource.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/AbstractHBaseDynamicTableSource.java
deleted file mode 100644
index c530cde003a..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/AbstractHBaseDynamicTableSource.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.api.common.io.InputFormat;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.connector.ChangelogMode;
-import org.apache.flink.table.connector.Projection;
-import org.apache.flink.table.connector.source.InputFormatProvider;
-import org.apache.flink.table.connector.source.LookupTableSource;
-import org.apache.flink.table.connector.source.ScanTableSource;
-import org.apache.flink.table.connector.source.abilities.SupportsProjectionPushDown;
-import org.apache.flink.table.connector.source.lookup.LookupFunctionProvider;
-import org.apache.flink.table.connector.source.lookup.PartialCachingLookupProvider;
-import org.apache.flink.table.connector.source.lookup.cache.LookupCache;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.types.DataType;
-
-import org.apache.hadoop.conf.Configuration;
-
-import javax.annotation.Nullable;
-
-import static org.apache.flink.util.Preconditions.checkArgument;
-
-/** HBase table source implementation. */
-@Internal
-public abstract class AbstractHBaseDynamicTableSource
- implements ScanTableSource, LookupTableSource, SupportsProjectionPushDown {
-
- protected final Configuration conf;
- protected final String tableName;
- protected HBaseTableSchema hbaseSchema;
- protected final String nullStringLiteral;
- protected final int maxRetryTimes;
- @Nullable protected final LookupCache cache;
-
- public AbstractHBaseDynamicTableSource(
- Configuration conf,
- String tableName,
- HBaseTableSchema hbaseSchema,
- String nullStringLiteral,
- int maxRetryTimes,
- @Nullable LookupCache cache) {
- this.conf = conf;
- this.tableName = tableName;
- this.hbaseSchema = hbaseSchema;
- this.nullStringLiteral = nullStringLiteral;
- this.maxRetryTimes = maxRetryTimes;
- this.cache = cache;
- }
-
- @Override
- public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) {
- return InputFormatProvider.of(getInputFormat());
- }
-
- protected abstract InputFormat<RowData, ?> getInputFormat();
-
- @Override
- public LookupRuntimeProvider getLookupRuntimeProvider(LookupContext context) {
- checkArgument(
- context.getKeys().length == 1 && context.getKeys()[0].length == 1,
- "Currently, HBase table can only be lookup by single rowkey.");
- checkArgument(
- hbaseSchema.getRowKeyName().isPresent(),
- "HBase schema must have a row key when used in lookup mode.");
- checkArgument(
- DataType.getFieldNames(hbaseSchema.convertToDataType())
- .get(context.getKeys()[0][0])
- .equals(hbaseSchema.getRowKeyName().get()),
- "Currently, HBase table only supports lookup by rowkey field.");
- HBaseRowDataLookupFunction lookupFunction =
- new HBaseRowDataLookupFunction(
- conf, tableName, hbaseSchema, nullStringLiteral, maxRetryTimes);
- if (cache != null) {
- return PartialCachingLookupProvider.of(lookupFunction, cache);
- } else {
- return LookupFunctionProvider.of(lookupFunction);
- }
- }
-
- @Override
- public boolean supportsNestedProjection() {
- // planner doesn't support nested projection push down yet.
- return false;
- }
-
- @Override
- public void applyProjection(int[][] projectedFields, DataType producedDataType) {
- this.hbaseSchema =
- HBaseTableSchema.fromDataType(
- Projection.of(projectedFields).project(hbaseSchema.convertToDataType()));
- }
-
- @Override
- public ChangelogMode getChangelogMode() {
- return ChangelogMode.insertOnly();
- }
-
- @Override
- public String asSummaryString() {
- return "HBase";
- }
-
- // -------------------------------------------------------------------------------------------
-
- @VisibleForTesting
- public HBaseTableSchema getHBaseTableSchema() {
- return this.hbaseSchema;
- }
-
- @VisibleForTesting
- public int getMaxRetryTimes() {
- return maxRetryTimes;
- }
-
- @VisibleForTesting
- @Nullable
- public LookupCache getCache() {
- return cache;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/HBaseRowDataLookupFunction.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/HBaseRowDataLookupFunction.java
deleted file mode 100644
index 0e1ba542e5b..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/HBaseRowDataLookupFunction.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.connector.hbase.util.HBaseSerde;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.data.GenericRowData;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.functions.FunctionContext;
-import org.apache.flink.table.functions.LookupFunction;
-import org.apache.flink.util.StringUtils;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Result;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * The HBaseRowDataLookupFunction is a standard user-defined table function, it can be used in
- * tableAPI and also useful for temporal table join plan in SQL. It looks up the result as {@link
- * RowData}.
- */
-@Internal
-public class HBaseRowDataLookupFunction extends LookupFunction {
-
- private static final Logger LOG = LoggerFactory.getLogger(HBaseRowDataLookupFunction.class);
- private static final long serialVersionUID = 1L;
-
- private final String hTableName;
- private final byte[] serializedConfig;
- private final HBaseTableSchema hbaseTableSchema;
- private final String nullStringLiteral;
-
- private transient Connection hConnection;
- private transient HTable table;
- private transient HBaseSerde serde;
-
- private final int maxRetryTimes;
-
- public HBaseRowDataLookupFunction(
- Configuration configuration,
- String hTableName,
- HBaseTableSchema hbaseTableSchema,
- String nullStringLiteral,
- int maxRetryTimes) {
- this.serializedConfig = HBaseConfigurationUtil.serializeConfiguration(configuration);
- this.hTableName = hTableName;
- this.hbaseTableSchema = hbaseTableSchema;
- this.nullStringLiteral = nullStringLiteral;
- this.maxRetryTimes = maxRetryTimes;
- }
-
- /**
- * The invoke entry point of lookup function.
- *
- * @param keyRow - A {@link RowData} that wraps lookup keys. Currently only support single
- * rowkey.
- */
- @Override
- public Collection<RowData> lookup(RowData keyRow) throws IOException {
- for (int retry = 0; retry <= maxRetryTimes; retry++) {
- try {
- // TODO: The implementation of LookupFunction will pass a GenericRowData as key row
- // and it's safe to cast for now. We need to update the logic once we improve the
- // LookupFunction in the future.
- Get get = serde.createGet(((GenericRowData) keyRow).getField(0));
- if (get != null) {
- Result result = table.get(get);
- if (!result.isEmpty()) {
- return Collections.singletonList(serde.convertToReusedRow(result));
- }
- }
- break;
- } catch (IOException e) {
- LOG.error(String.format("HBase lookup error, retry times = %d", retry), e);
- if (retry >= maxRetryTimes) {
- throw new RuntimeException("Execution of HBase lookup failed.", e);
- }
- try {
- Thread.sleep(1000 * retry);
- } catch (InterruptedException e1) {
- throw new RuntimeException(e1);
- }
- }
- }
- return Collections.emptyList();
- }
-
- private Configuration prepareRuntimeConfiguration() {
- // create default configuration from current runtime env (`hbase-site.xml` in classpath)
- // first,
- // and overwrite configuration using serialized configuration from client-side env
- // (`hbase-site.xml` in classpath).
- // user params from client-side have the highest priority
- Configuration runtimeConfig =
- HBaseConfigurationUtil.deserializeConfiguration(
- serializedConfig, HBaseConfigurationUtil.getHBaseConfiguration());
-
- // do validation: check key option(s) in final runtime configuration
- if (StringUtils.isNullOrWhitespaceOnly(runtimeConfig.get(HConstants.ZOOKEEPER_QUORUM))) {
- LOG.error(
- "can not connect to HBase without {} configuration",
- HConstants.ZOOKEEPER_QUORUM);
- throw new IllegalArgumentException(
- "check HBase configuration failed, lost: '"
- + HConstants.ZOOKEEPER_QUORUM
- + "'!");
- }
-
- return runtimeConfig;
- }
-
- @Override
- public void open(FunctionContext context) {
- LOG.info("start open ...");
- Configuration config = prepareRuntimeConfiguration();
- try {
- hConnection = ConnectionFactory.createConnection(config);
- table = (HTable) hConnection.getTable(TableName.valueOf(hTableName));
- } catch (TableNotFoundException tnfe) {
- LOG.error("Table '{}' not found ", hTableName, tnfe);
- throw new RuntimeException("HBase table '" + hTableName + "' not found.", tnfe);
- } catch (IOException ioe) {
- LOG.error("Exception while creating connection to HBase.", ioe);
- throw new RuntimeException("Cannot create connection to HBase.", ioe);
- }
- this.serde = new HBaseSerde(hbaseTableSchema, nullStringLiteral);
- LOG.info("end open.");
- }
-
- @Override
- public void close() {
- LOG.info("start close ...");
- if (null != table) {
- try {
- table.close();
- table = null;
- } catch (IOException e) {
- // ignore exception when close.
- LOG.warn("exception when close table", e);
- }
- }
- if (null != hConnection) {
- try {
- hConnection.close();
- hConnection = null;
- } catch (IOException e) {
- // ignore exception when close.
- LOG.warn("exception when close connection", e);
- }
- }
- LOG.info("end close.");
- }
-
- @VisibleForTesting
- public String getHTableName() {
- return hTableName;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/TableInputSplit.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/TableInputSplit.java
deleted file mode 100644
index b745fff7875..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/source/TableInputSplit.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.source;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.core.io.LocatableInputSplit;
-
-/**
- * This class implements a input splits for HBase. Each table input split corresponds to a key range
- * (low, high). All references to row below refer to the key of the row.
- */
-@Internal
-public class TableInputSplit extends LocatableInputSplit {
-
- private static final long serialVersionUID = 1L;
-
- /** The name of the table to retrieve data from. */
- private final byte[] tableName;
-
- /** The start row of the split. */
- private final byte[] startRow;
-
- /** The end row of the split. */
- private final byte[] endRow;
-
- /**
- * Creates a new table input split.
- *
- * @param splitNumber the number of the input split
- * @param hostnames the names of the hosts storing the data the input split refers to
- * @param tableName the name of the table to retrieve data from
- * @param startRow the start row of the split
- * @param endRow the end row of the split
- */
- public TableInputSplit(
- final int splitNumber,
- final String[] hostnames,
- final byte[] tableName,
- final byte[] startRow,
- final byte[] endRow) {
- super(splitNumber, hostnames);
-
- this.tableName = tableName;
- this.startRow = startRow;
- this.endRow = endRow;
- }
-
- /**
- * Returns the table name.
- *
- * @return The table name.
- */
- public byte[] getTableName() {
- return this.tableName;
- }
-
- /**
- * Returns the start row.
- *
- * @return The start row.
- */
- public byte[] getStartRow() {
- return this.startRow;
- }
-
- /**
- * Returns the end row.
- *
- * @return The end row.
- */
- public byte[] getEndRow() {
- return this.endRow;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptions.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptions.java
deleted file mode 100644
index 0c8dc978551..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptions.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.table;
-
-import org.apache.flink.annotation.PublicEvolving;
-import org.apache.flink.configuration.ConfigOption;
-import org.apache.flink.configuration.ConfigOptions;
-import org.apache.flink.configuration.MemorySize;
-import org.apache.flink.table.connector.source.lookup.LookupOptions;
-import org.apache.flink.table.factories.FactoryUtil;
-
-import java.time.Duration;
-
-/** Options for the HBase connector. */
-@PublicEvolving
-public class HBaseConnectorOptions {
-
- public static final ConfigOption<String> TABLE_NAME =
- ConfigOptions.key("table-name")
- .stringType()
- .noDefaultValue()
- .withDescription(
- "The name of HBase table to connect. "
- + "By default, the table is in 'default' namespace. "
- + "To assign the table a specified namespace you need to use 'namespace:table'.");
-
- public static final ConfigOption<String> ZOOKEEPER_QUORUM =
- ConfigOptions.key("zookeeper.quorum")
- .stringType()
- .noDefaultValue()
- .withDescription("The HBase Zookeeper quorum.");
-
- public static final ConfigOption<String> ZOOKEEPER_ZNODE_PARENT =
- ConfigOptions.key("zookeeper.znode.parent")
- .stringType()
- .defaultValue("/hbase")
- .withDescription("The root dir in Zookeeper for HBase cluster.");
-
- public static final ConfigOption<String> NULL_STRING_LITERAL =
- ConfigOptions.key("null-string-literal")
- .stringType()
- .defaultValue("null")
- .withDescription(
- "Representation for null values for string fields. HBase source and "
- + "sink encodes/decodes empty bytes as null values for all types except string type.");
-
- public static final ConfigOption<MemorySize> SINK_BUFFER_FLUSH_MAX_SIZE =
- ConfigOptions.key("sink.buffer-flush.max-size")
- .memoryType()
- .defaultValue(MemorySize.parse("2mb"))
- .withDescription(
- "Writing option, maximum size in memory of buffered rows for each "
- + "writing request. This can improve performance for writing data to HBase database, "
- + "but may increase the latency. Can be set to '0' to disable it. ");
-
- public static final ConfigOption<Integer> SINK_BUFFER_FLUSH_MAX_ROWS =
- ConfigOptions.key("sink.buffer-flush.max-rows")
- .intType()
- .defaultValue(1000)
- .withDescription(
- "Writing option, maximum number of rows to buffer for each writing request. "
- + "This can improve performance for writing data to HBase database, but may increase the latency. "
- + "Can be set to '0' to disable it.");
-
- public static final ConfigOption<Duration> SINK_BUFFER_FLUSH_INTERVAL =
- ConfigOptions.key("sink.buffer-flush.interval")
- .durationType()
- .defaultValue(Duration.ofSeconds(1))
- .withDescription(
- "Writing option, the interval to flush any buffered rows. "
- + "This can improve performance for writing data to HBase database, but may increase the latency. "
- + "Can be set to '0' to disable it. Note, both 'sink.buffer-flush.max-size' and 'sink.buffer-flush.max-rows' "
- + "can be set to '0' with the flush interval set allowing for complete async processing of buffered actions.");
-
- public static final ConfigOption<Boolean> LOOKUP_ASYNC =
- ConfigOptions.key("lookup.async")
- .booleanType()
- .defaultValue(false)
- .withDescription("whether to set async lookup.");
-
- /** @deprecated Please use {@link LookupOptions#PARTIAL_CACHE_MAX_ROWS} instead. */
- @Deprecated
- public static final ConfigOption<Long> LOOKUP_CACHE_MAX_ROWS =
- ConfigOptions.key("lookup.cache.max-rows")
- .longType()
- .defaultValue(-1L)
- .withDescription(
- "the max number of rows of lookup cache, over this value, the oldest rows will "
- + "be eliminated. \"cache.max-rows\" and \"cache.ttl\" options must all be specified if any of them is "
- + "specified. Cache is not enabled as default.");
-
- /** @deprecated Please use {@link LookupOptions#PARTIAL_CACHE_EXPIRE_AFTER_WRITE} instead. */
- @Deprecated
- public static final ConfigOption<Duration> LOOKUP_CACHE_TTL =
- ConfigOptions.key("lookup.cache.ttl")
- .durationType()
- .defaultValue(Duration.ofSeconds(0))
- .withDescription("the cache time to live.");
-
- /** @deprecated Please used {@link LookupOptions#MAX_RETRIES} instead. */
- public static final ConfigOption<Integer> LOOKUP_MAX_RETRIES =
- ConfigOptions.key("lookup.max-retries")
- .intType()
- .defaultValue(3)
- .withDescription("the max retry times if lookup database failed.");
-
- public static final ConfigOption<Integer> SINK_PARALLELISM = FactoryUtil.SINK_PARALLELISM;
-
- private HBaseConnectorOptions() {}
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptionsUtil.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptionsUtil.java
deleted file mode 100644
index 2141fe10523..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptionsUtil.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.table;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.configuration.ReadableConfig;
-import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
-import org.apache.flink.connector.hbase.util.HBaseConfigurationUtil;
-import org.apache.flink.connector.hbase.util.HBaseTableSchema;
-import org.apache.flink.table.types.DataType;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
-
-import java.util.Map;
-import java.util.Properties;
-
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_INTERVAL;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_ROWS;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_BUFFER_FLUSH_MAX_SIZE;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.SINK_PARALLELISM;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.ZOOKEEPER_QUORUM;
-import static org.apache.flink.connector.hbase.table.HBaseConnectorOptions.ZOOKEEPER_ZNODE_PARENT;
-
-/** Utilities for {@link HBaseConnectorOptions}. */
-@Internal
-public class HBaseConnectorOptionsUtil {
-
- /** Prefix for HBase specific properties. */
- public static final String PROPERTIES_PREFIX = "properties.";
-
- // --------------------------------------------------------------------------------------------
- // Validation
- // --------------------------------------------------------------------------------------------
-
- /**
- * Checks that the HBase table have row key defined. A row key is defined as an atomic type, and
- * column families and qualifiers are defined as ROW type. There shouldn't be multiple atomic
- * type columns in the schema. The PRIMARY KEY constraint is optional, if exist, the primary key
- * constraint must be defined on the single row key field.
- */
- public static void validatePrimaryKey(DataType dataType, int[] primaryKeyIndexes) {
- HBaseTableSchema hbaseSchema = HBaseTableSchema.fromDataType(dataType);
- if (!hbaseSchema.getRowKeyName().isPresent()) {
- throw new IllegalArgumentException(
- "HBase table requires to define a row key field. "
- + "A row key field is defined as an atomic type, "
- + "column families and qualifiers are defined as ROW type.");
- }
- if (primaryKeyIndexes.length == 0) {
- return;
- }
- if (primaryKeyIndexes.length > 1) {
- throw new IllegalArgumentException(
- "HBase table doesn't support a primary Key on multiple columns. "
- + "The primary key of HBase table must be defined on row key field.");
- }
- if (!hbaseSchema
- .getRowKeyName()
- .get()
- .equals(DataType.getFieldNames(dataType).get(primaryKeyIndexes[0]))) {
- throw new IllegalArgumentException(
- "Primary key of HBase table must be defined on the row key field. "
- + "A row key field is defined as an atomic type, "
- + "column families and qualifiers are defined as ROW type.");
- }
- }
-
- public static HBaseWriteOptions getHBaseWriteOptions(ReadableConfig tableOptions) {
- HBaseWriteOptions.Builder builder = HBaseWriteOptions.builder();
- builder.setBufferFlushIntervalMillis(
- tableOptions.get(SINK_BUFFER_FLUSH_INTERVAL).toMillis());
- builder.setBufferFlushMaxRows(tableOptions.get(SINK_BUFFER_FLUSH_MAX_ROWS));
- builder.setBufferFlushMaxSizeInBytes(
- tableOptions.get(SINK_BUFFER_FLUSH_MAX_SIZE).getBytes());
- builder.setParallelism(tableOptions.getOptional(SINK_PARALLELISM).orElse(null));
- return builder.build();
- }
-
- /** config HBase Configuration. */
- public static Configuration getHBaseConfiguration(ReadableConfig tableOptions) {
- // create default configuration from current runtime env (`hbase-site.xml` in classpath)
- // first,
- Configuration hbaseClientConf = HBaseConfigurationUtil.getHBaseConfiguration();
- hbaseClientConf.set(HConstants.ZOOKEEPER_QUORUM, tableOptions.get(ZOOKEEPER_QUORUM));
- hbaseClientConf.set(
- HConstants.ZOOKEEPER_ZNODE_PARENT, tableOptions.get(ZOOKEEPER_ZNODE_PARENT));
- // add HBase properties
- final Properties properties =
- getHBaseClientProperties(
- ((org.apache.flink.configuration.Configuration) tableOptions).toMap());
- properties.forEach((k, v) -> hbaseClientConf.set(k.toString(), v.toString()));
- return hbaseClientConf;
- }
-
- private static Properties getHBaseClientProperties(Map<String, String> tableOptions) {
- final Properties hbaseProperties = new Properties();
-
- if (containsHBaseClientProperties(tableOptions)) {
- tableOptions.keySet().stream()
- .filter(key -> key.startsWith(PROPERTIES_PREFIX))
- .forEach(
- key -> {
- final String value = tableOptions.get(key);
- final String subKey = key.substring((PROPERTIES_PREFIX).length());
- hbaseProperties.put(subKey, value);
- });
- }
- return hbaseProperties;
- }
-
- /** Returns whether the table options contains HBase client properties or not. 'properties'. */
- private static boolean containsHBaseClientProperties(Map<String, String> tableOptions) {
- return tableOptions.keySet().stream().anyMatch(k -> k.startsWith(PROPERTIES_PREFIX));
- }
-
- private HBaseConnectorOptionsUtil() {}
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseConfigurationUtil.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseConfigurationUtil.java
deleted file mode 100644
index b6679bdcf01..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseConfigurationUtil.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.util;
-
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.util.Preconditions;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.io.Writable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.IOException;
-
-/** This class helps to do serialization for hadoop Configuration and HBase-related classes. */
-@Internal
-public class HBaseConfigurationUtil {
-
- private static final Logger LOG = LoggerFactory.getLogger(HBaseConfigurationUtil.class);
-
- public static final String ENV_HBASE_CONF_DIR = "HBASE_CONF_DIR";
-
- public static Configuration getHBaseConfiguration() {
-
- // Instantiate an HBaseConfiguration to load the hbase-default.xml and hbase-site.xml from
- // the classpath.
- Configuration result = HBaseConfiguration.create();
- boolean foundHBaseConfiguration = false;
-
- // We need to load both hbase-default.xml and hbase-site.xml to the hbase configuration
- // The properties of a newly added resource will override the ones in previous resources, so
- // a configuration
- // file with higher priority should be added later.
-
- // Approach 1: HBASE_HOME environment variables
- String possibleHBaseConfPath = null;
-
- final String hbaseHome = System.getenv("HBASE_HOME");
- if (hbaseHome != null) {
- LOG.debug("Searching HBase configuration files in HBASE_HOME: {}", hbaseHome);
- possibleHBaseConfPath = hbaseHome + "/conf";
- }
-
- if (possibleHBaseConfPath != null) {
- foundHBaseConfiguration = addHBaseConfIfFound(result, possibleHBaseConfPath);
- }
-
- // Approach 2: HBASE_CONF_DIR environment variable
- String hbaseConfDir = System.getenv("HBASE_CONF_DIR");
- if (hbaseConfDir != null) {
- LOG.debug("Searching HBase configuration files in HBASE_CONF_DIR: {}", hbaseConfDir);
- foundHBaseConfiguration =
- addHBaseConfIfFound(result, hbaseConfDir) || foundHBaseConfiguration;
- }
-
- if (!foundHBaseConfiguration) {
- LOG.warn(
- "Could not find HBase configuration via any of the supported methods "
- + "(Flink configuration, environment variables).");
- }
-
- return result;
- }
-
- /**
- * Search HBase configuration files in the given path, and add them to the configuration if
- * found.
- */
- private static boolean addHBaseConfIfFound(
- Configuration configuration, String possibleHBaseConfPath) {
- boolean foundHBaseConfiguration = false;
- if (new File(possibleHBaseConfPath).exists()) {
- if (new File(possibleHBaseConfPath + "/hbase-default.xml").exists()) {
- configuration.addResource(
- new org.apache.hadoop.fs.Path(
- possibleHBaseConfPath + "/hbase-default.xml"));
- LOG.debug(
- "Adding "
- + possibleHBaseConfPath
- + "/hbase-default.xml to hbase configuration");
- foundHBaseConfiguration = true;
- }
- if (new File(possibleHBaseConfPath + "/hbase-site.xml").exists()) {
- configuration.addResource(
- new org.apache.hadoop.fs.Path(possibleHBaseConfPath + "/hbase-site.xml"));
- LOG.debug(
- "Adding "
- + possibleHBaseConfPath
- + "/hbase-site.xml to hbase configuration");
- foundHBaseConfiguration = true;
- }
- }
- return foundHBaseConfiguration;
- }
-
- /** Serialize a Hadoop {@link Configuration} into byte[]. */
- public static byte[] serializeConfiguration(Configuration conf) {
- try {
- return serializeWritable(conf);
- } catch (IOException e) {
- throw new RuntimeException(
- "Encounter an IOException when serialize the Configuration.", e);
- }
- }
-
- /**
- * Deserialize a Hadoop {@link Configuration} from byte[]. Deserialize configs to {@code
- * targetConfig} if it is set.
- */
- public static Configuration deserializeConfiguration(
- byte[] serializedConfig, Configuration targetConfig) {
- if (null == targetConfig) {
- targetConfig = new Configuration();
- }
- try {
- deserializeWritable(targetConfig, serializedConfig);
- } catch (IOException e) {
- throw new RuntimeException(
- "Encounter an IOException when deserialize the Configuration.", e);
- }
- return targetConfig;
- }
-
- /**
- * Serialize writable byte[].
- *
- * @param <T> the type parameter
- * @param writable the writable
- * @return the byte [ ]
- * @throws IOException the io exception
- */
- private static <T extends Writable> byte[] serializeWritable(T writable) throws IOException {
- Preconditions.checkArgument(writable != null);
-
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
- writable.write(outputStream);
- return byteArrayOutputStream.toByteArray();
- }
-
- /**
- * Deserialize writable.
- *
- * @param <T> the type parameter
- * @param writable the writable
- * @param bytes the bytes
- * @throws IOException the io exception
- */
- private static <T extends Writable> void deserializeWritable(T writable, byte[] bytes)
- throws IOException {
- Preconditions.checkArgument(writable != null);
- Preconditions.checkArgument(bytes != null);
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
- DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
- writable.readFields(dataInputStream);
- }
-
- public static org.apache.hadoop.conf.Configuration createHBaseConf() {
- org.apache.hadoop.conf.Configuration hbaseClientConf = HBaseConfiguration.create();
-
- String hbaseConfDir = System.getenv(ENV_HBASE_CONF_DIR);
-
- if (hbaseConfDir != null) {
- if (new File(hbaseConfDir).exists()) {
- String coreSite = hbaseConfDir + "/core-site.xml";
- String hdfsSite = hbaseConfDir + "/hdfs-site.xml";
- String hbaseSite = hbaseConfDir + "/hbase-site.xml";
- if (new File(coreSite).exists()) {
- hbaseClientConf.addResource(new org.apache.hadoop.fs.Path(coreSite));
- LOG.info("Adding " + coreSite + " to hbase configuration");
- }
- if (new File(hdfsSite).exists()) {
- hbaseClientConf.addResource(new org.apache.hadoop.fs.Path(hdfsSite));
- LOG.info("Adding " + hdfsSite + " to hbase configuration");
- }
- if (new File(hbaseSite).exists()) {
- hbaseClientConf.addResource(new org.apache.hadoop.fs.Path(hbaseSite));
- LOG.info("Adding " + hbaseSite + " to hbase configuration");
- }
- } else {
- LOG.warn(
- "HBase config directory '{}' not found, cannot load HBase configuration.",
- hbaseConfDir);
- }
- } else {
- LOG.warn(
- "{} env variable not found, cannot load HBase configuration.",
- ENV_HBASE_CONF_DIR);
- }
- return hbaseClientConf;
- }
-}
diff --git a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseSerde.java b/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseSerde.java
deleted file mode 100644
index 66800170a16..00000000000
--- a/flink-connectors/flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/util/HBaseSerde.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.hbase.util;
-
-import org.apache.flink.table.data.DecimalData;
-import org.apache.flink.table.data.GenericRowData;
-import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.data.StringData;
-import org.apache.flink.table.data.TimestampData;
-import org.apache.flink.table.types.DataType;
-import org.apache.flink.table.types.logical.DecimalType;
-import org.apache.flink.table.types.logical.LogicalType;
-import org.apache.flink.table.types.logical.LogicalTypeFamily;
-
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import javax.annotation.Nullable;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-
-import static org.apache.flink.table.types.logical.utils.LogicalTypeChecks.getPrecision;
-import static org.apache.flink.util.Preconditions.checkArgument;
-
-/** Utilities for HBase serialization and deserialization. */
-public class HBaseSerde {
-
- private static final byte[] EMPTY_BYTES = new byte[] {};
-
- private static final int MIN_TIMESTAMP_PRECISION = 0;
- private static final int MAX_TIMESTAMP_PRECISION = 3;
- private static final int MIN_TIME_PRECISION = 0;
- private static final int MAX_TIME_PRECISION = 3;
-
- private final byte[] nullStringBytes;
-
- // row key index in output row
- private final int rowkeyIndex;
-
- // family keys
- private final byte[][] families;
- // qualifier keys
- private final byte[][][] qualifiers;
-
- private final int fieldLength;
-
- private GenericRowData reusedRow;
- private GenericRowData[] reusedFamilyRows;
-
- private final @Nullable FieldEncoder keyEncoder;
- private final @Nullable FieldDecoder keyDecoder;
- private final FieldEncoder[][] qualifierEncoders;
- private final FieldDecoder[][] qualifierDecoders;
- private final GenericRowData rowWithRowKey;
- private final HBaseStronglyIncreasingTsGenerator timestampGenerator;
-
- public HBaseSerde(HBaseTableSchema hbaseSchema, final String nullStringLiteral) {
- this.families = hbaseSchema.getFamilyKeys();
- this.rowkeyIndex = hbaseSchema.getRowKeyIndex();
- LogicalType rowkeyType =
- hbaseSchema.getRowKeyDataType().map(DataType::getLogicalType).orElse(null);
-
- // field length need take row key into account if it exists.
- if (rowkeyIndex != -1 && rowkeyType != null) {
- this.fieldLength = families.length + 1;
- this.keyEncoder = createFieldEncoder(rowkeyType);
- this.keyDecoder = createFieldDecoder(rowkeyType);
- } else {
- this.fieldLength = families.length;
- this.keyEncoder = null;
- this.keyDecoder = null;
- }
- this.nullStringBytes = nullStringLiteral.getBytes(StandardCharsets.UTF_8);
-
- // prepare output rows
- this.reusedRow = new GenericRowData(fieldLength);
- this.reusedFamilyRows = new GenericRowData[families.length];
-
- this.qualifiers = new byte[families.length][][];
- this.qualifierEncoders = new FieldEncoder[families.length][];
- this.qualifierDecoders = new FieldDecoder[families.length][];
- String[] familyNames = hbaseSchema.getFamilyNames();
- for (int f = 0; f < families.length; f++) {
- this.qualifiers[f] = hbaseSchema.getQualifierKeys(familyNames[f]);
- DataType[] dataTypes = hbaseSchema.getQualifierDataTypes(familyNames[f]);
- this.qualifierEncoders[f] =
- Arrays.stream(dataTypes)
- .map(DataType::getLogicalType)
- .map(t -> createNullableFieldEncoder(t, nullStringBytes))
- .toArray(FieldEncoder[]::new);
- this.qualifierDecoders[f] =
- Arrays.stream(dataTypes)
- .map(DataType::getLogicalType)
- .map(t -> createNullableFieldDecoder(t, nullStringBytes))
- .toArray(FieldDecoder[]::new);
- this.reusedFamilyRows[f] = new GenericRowData(dataTypes.length);
- }
- this.rowWithRowKey = new GenericRowData(1);
- this.timestampGenerator = new HBaseStronglyIncreasingTsGenerator();
- }
-
- /**
- * Returns an instance of Put that writes record to HBase table.
- *
- * @return The appropriate instance of Put for this use case.
- */
- public @Nullable Put createPutMutation(RowData row) {
- checkArgument(keyEncoder != null, "row key is not set.");
- byte[] rowkey = keyEncoder.encode(row, rowkeyIndex);
- if (rowkey.length == 0) {
- // drop dirty records, rowkey shouldn't be zero length
- return null;
- }
- // upsert
- Put put = new Put(rowkey, timestampGenerator.get());
- for (int i = 0; i < fieldLength; i++) {
- if (i != rowkeyIndex) {
- int f = i > rowkeyIndex ? i - 1 : i;
- // get family key
- byte[] familyKey = families[f];
- RowData familyRow = row.getRow(i, qualifiers[f].length);
- for (int q = 0; q < this.qualifiers[f].length; q++) {
- // get quantifier key
- byte[] qualifier = qualifiers[f][q];
- // serialize value
- byte[] value = qualifierEncoders[f][q].encode(familyRow, q);
- put.addColumn(familyKey, qualifier, value);
- }
- }
- }
- return put;
- }
-
- /**
- * Returns an instance of Delete that remove record from HBase table.
- *
- * @return The appropriate instance of Delete for this use case.
- */
- public @Nullable Delete createDeleteMutation(RowData row) {
- checkArgument(keyEncoder != null, "row key is not set.");
- byte[] rowkey = keyEncoder.encode(row, rowkeyIndex);
- if (rowkey.length == 0) {
- // drop dirty records, rowkey shouldn't be zero length
- return null;
- }
- // delete
- Delete delete = new Delete(rowkey, timestampGenerator.get());
- for (int i = 0; i < fieldLength; i++) {
- if (i != rowkeyIndex) {
- int f = i > rowkeyIndex ? i - 1 : i;
- // get family key
- byte[] familyKey = families[f];
- for (int q = 0; q < this.qualifiers[f].length; q++) {
- // get quantifier key
- byte[] qualifier = qualifiers[f][q];
- delete.addColumns(familyKey, qualifier);
- }
- }
- }
- return delete;
- }
-
- /**
- * Returns an instance of Scan that retrieves the required subset of records from the HBase
- * table.
- *
- * @return The appropriate instance of Scan for this use case.
- */
- public Scan createScan() {
- Scan scan = new Scan();
- for (int f = 0; f < families.length; f++) {
- byte[] family = families[f];
- for (int q = 0; q < qualifiers[f].length; q++) {
- byte[] quantifier = qualifiers[f][q];
- scan.addColumn(family, quantifier);
- }
- }
- return scan;
- }
-
- /**
- * Returns an instance of Get that retrieves the matches records from the HBase table.
- *
- * @return The appropriate instance of Get for this use case.
- */
- public Get createGet(Object rowKey) {
- checkArgument(keyEncoder != null, "row key is not set.");
- rowWithRowKey.setField(0, rowKey);
- byte[] rowkey = keyEncoder.encode(rowWithRowKey, 0);
- if (rowkey.length == 0) {
- // drop dirty records, rowkey shouldn't be zero length
- return null;
- }
- Get get = new Get(rowkey);
- for (int f = 0; f < families.length; f++) {
- byte[] family = families[f];
- for (byte[] qualifier : qualifiers[f]) {
- get.addColumn(family, qualifier);
- }
- }
- return get;
- }
-
- /**
- * Converts HBase {@link Result} into a new {@link RowData} instance.
- *
- * <p>Note: this method is thread-safe.
- */
- public RowData convertToNewRow(Result result) {
- // The output rows needs to be initialized each time
- // to prevent the possibility of putting the output object into the cache.
- GenericRowData resultRow = new GenericRowData(fieldLength);
- GenericRowData[] familyRows = new GenericRowData[families.length];
- for (int f = 0; f < families.length; f++) {
- familyRows[f] = new GenericRowData(qualifiers[f].length);
- }
- return convertToRow(result, resultRow, familyRows);
- }
-
- /**
- * Converts HBase {@link Result} into a reused {@link RowData} instance.
- *
- * <p>Note: this method is NOT thread-safe.
- */
- public RowData convertToReusedRow(Result result) {
- return convertToRow(result, reusedRow, reusedFamilyRows);
- }
-
- private RowData convertToRow(
- Result result, GenericRowData resultRow, GenericRowData[] familyRows) {
- for (int i = 0; i < fieldLength; i++) {
- if (rowkeyIndex == i) {
- assert keyDecoder != null;
- Object rowkey = keyDecoder.decode(result.getRow());
- resultRow.setField(rowkeyIndex, rowkey);
- } else {
- int f = (rowkeyIndex != -1 && i > rowkeyIndex) ? i - 1 : i;
- // get family key
- byte[] familyKey = families[f];
- GenericRowData familyRow = familyRows[f];
- for (int q = 0; q < this.qualifiers[f].length; q++) {
- // get quantifier key
- byte[] qualifier = qualifiers[f][q];
- // read value
- byte[] value = result.getValue(familyKey, qualifier);
- familyRow.setField(q, qualifierDecoders[f][q].decode(value));
- }
- resultRow.setField(i, familyRow);
- }
- }
- return resultRow;
- }
-
- /**
- * Converts HBase {@link Result} into {@link RowData}.
- *
- * @deprecated Use {@link #convertToReusedRow(Result)} instead.
- */
- @Deprecated
- public RowData convertToRow(Result result) {
- for (int i = 0; i < fieldLength; i++) {
- if (rowkeyIndex == i) {
- assert keyDecoder != null;
- Object rowkey = keyDecoder.decode(result.getRow());
- reusedRow.setField(rowkeyIndex, rowkey);
- } else {
- int f = (rowkeyIndex != -1 && i > rowkeyIndex) ? i - 1 : i;
- // get family key
- byte[] familyKey = families[f];
- GenericRowData familyRow = reusedFamilyRows[f];
- for (int q = 0; q < this.qualifiers[f].length; q++) {
- // get quantifier key
- byte[] qualifier = qualifiers[f][q];
- // read value
- byte[] value = result.getValue(familyKey, qualifier);
- familyRow.setField(q, qualifierDecoders[f][q].decode(value));
- }
- reusedRow.setField(i, familyRow);
- }
- }
- return reusedRow;
- }
-
- // ------------------------------------------------------------------------------------
- // HBase Runtime Encoders
- // ------------------------------------------------------------------------------------
-
- /** Runtime encoder that encodes a specified field in {@link RowData} into byte[]. */
- @FunctionalInterface
- private interface FieldEncoder extends Serializable {
- byte[] encode(RowData row, int pos);
- }
-
- private static FieldEncoder createNullableFieldEncoder(
- LogicalType fieldType, final byte[] nullStringBytes) {
- final FieldEncoder encoder = createFieldEncoder(fieldType);
- if (fieldType.isNullable()) {
- if (fieldType.is(LogicalTypeFamily.CHARACTER_STRING)) {
- // special logic for null string values, because HBase can store empty bytes for
- // string
- return (row, pos) -> {
- if (row.isNullAt(pos)) {
- return nullStringBytes;
- } else {
- return encoder.encode(row, pos);
- }
- };
- } else {
- // encode empty bytes for null values
- return (row, pos) -> {
- if (row.isNullAt(pos)) {
- return EMPTY_BYTES;
- } else {
- return encoder.encode(row, pos);
- }
- };
- }
- } else {
- return encoder;
- }
- }
-
- private static FieldEncoder createFieldEncoder(LogicalType fieldType) {
- // ordered by type root definition
- switch (fieldType.getTypeRoot()) {
- case CHAR:
- case VARCHAR:
- // get the underlying UTF-8 bytes
- return (row, pos) -> row.getString(pos).toBytes();
- case BOOLEAN:
- return (row, pos) -> Bytes.toBytes(row.getBoolean(pos));
- case BINARY:
- case VARBINARY:
- return RowData::getBinary;
- case DECIMAL:
- return createDecimalEncoder((DecimalType) fieldType);
- case TINYINT:
- return (row, pos) -> new byte[] {row.getByte(pos)};
- case SMALLINT:
- return (row, pos) -> Bytes.toBytes(row.getShort(pos));
- case INTEGER:
- case DATE:
- case INTERVAL_YEAR_MONTH:
- return (row, pos) -> Bytes.toBytes(row.getInt(pos));
- case TIME_WITHOUT_TIME_ZONE:
- final int timePrecision = getPrecision(fieldType);
- if (timePrecision < MIN_TIME_PRECISION || timePrecision > MAX_TIME_PRECISION) {
- throw new UnsupportedOperationException(
- String.format(
- "The precision %s of TIME type is out of the range [%s, %s] supported by "
- + "HBase connector",
- timePrecision, MIN_TIME_PRECISION, MAX_TIME_PRECISION));
- }
- return (row, pos) -> Bytes.toBytes(row.getInt(pos));
- case BIGINT:
- case INTERVAL_DAY_TIME:
- return (row, pos) -> Bytes.toBytes(row.getLong(pos));
- case FLOAT:
- return (row, pos) -> Bytes.toBytes(row.getFloat(pos));
- case DOUBLE:
- return (row, pos) -> Bytes.toBytes(row.getDouble(pos));
- case TIMESTAMP_WITHOUT_TIME_ZONE:
- case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
- final int timestampPrecision = getPrecision(fieldType);
- if (timestampPrecision < MIN_TIMESTAMP_PRECISION
- || timestampPrecision > MAX_TIMESTAMP_PRECISION) {
- throw new UnsupportedOperationException(
- String.format(
- "The precision %s of TIMESTAMP type is out of the range [%s, %s] supported by "
- + "HBase connector",
- timestampPrecision,
- MIN_TIMESTAMP_PRECISION,
- MAX_TIMESTAMP_PRECISION));
- }
- return createTimestampEncoder(timestampPrecision);
- default:
- throw new UnsupportedOperationException("Unsupported type: " + fieldType);
- }
- }
-
- private static FieldEncoder createDecimalEncoder(DecimalType decimalType) {
- final int precision = decimalType.getPrecision();
- final int scale = decimalType.getScale();
- return (row, pos) -> {
- BigDecimal decimal = row.getDecimal(pos, precision, scale).toBigDecimal();
- return Bytes.toBytes(decimal);
- };
- }
-
- private static FieldEncoder createTimestampEncoder(final int precision) {
- return (row, pos) -> {
- long millisecond = row.getTimestamp(pos, precision).getMillisecond();
- return Bytes.toBytes(millisecond);
- };
- }
-
- // ------------------------------------------------------------------------------------
- // HBase Runtime Decoders
- // ------------------------------------------------------------------------------------
-
- /** Runtime decoder that decodes a byte[] into objects of internal data structure. */
- @FunctionalInterface
- private interface FieldDecoder extends Serializable {
- @Nullable
- Object decode(byte[] value);
- }
-
- private static FieldDecoder createNullableFieldDecoder(
- LogicalType fieldType, final byte[] nullStringBytes) {
- final FieldDecoder decoder = createFieldDecoder(fieldType);
- if (fieldType.isNullable()) {
- if (fieldType.is(LogicalTypeFamily.CHARACTER_STRING)) {
- return value -> {
- if (value == null || Arrays.equals(value, nullStringBytes)) {
- return null;
- } else {
- return decoder.decode(value);
- }
- };
- } else {
- return value -> {
- if (value == null || value.length == 0) {
- return null;
- } else {
- return decoder.decode(value);
- }
- };
- }
- } else {
- return decoder;
- }
- }
-
- private static FieldDecoder createFieldDecoder(LogicalType fieldType) {
- // ordered by type root definition
- switch (fieldType.getTypeRoot()) {
- case CHAR:
- case VARCHAR:
- // reuse bytes
- return StringData::fromBytes;
- case BOOLEAN:
- return Bytes::toBoolean;
- case BINARY:
- case VARBINARY:
- return value -> value;
- case DECIMAL:
- return createDecimalDecoder((DecimalType) fieldType);
- case TINYINT:
- return value -> value[0];
- case SMALLINT:
- return Bytes::toShort;
- case INTEGER:
- case DATE:
- case INTERVAL_YEAR_MONTH:
- return Bytes::toInt;
- case TIME_WITHOUT_TIME_ZONE:
- final int timePrecision = getPrecision(fieldType);
- if (timePrecision < MIN_TIME_PRECISION || timePrecision > MAX_TIME_PRECISION) {
- throw new UnsupportedOperationException(
- String.format(
... 6321 lines suppressed ...