遵循文档中的示例:https : //clickhouse.yandex/docs/en/table_engines/kafka/
我使用Kafka Engine和一个实例化视图创建了一个表,该视图将数据推送到MergeTree表。
这是我的表格结构:
CREATE TABLE games (
UserId UInt32,
ActivityType UInt8,
Amount Float32,
CurrencyId UInt8,
Date String
) ENGINE = Kafka('XXXX.eu-west-1.compute.amazonaws.com:9092,XXXX.eu-west-1.compute.amazonaws.com:9092,XXXX.eu-west-1.compute.amazonaws.com:9092', 'games', 'click-1', 'JSONEachRow', '3');
CREATE TABLE tests.games_transactions (
day Date,
UserId UInt32,
Amount Float32,
CurrencyId UInt8,
timevalue DateTime,
ActivityType UInt8
) ENGINE = MergeTree(day, (day, UserId), 8192);
CREATE MATERIALIZED VIEW tests.games_consumer TO tests.games_transactions
AS SELECT toDate(replaceRegexpOne(Date,'\\..*','')) as day, UserId, Amount, CurrencyId, toDateTime(replaceRegexpOne(Date,'\\..*','')) as timevalue, ActivityType
FROM default.games;
Run Code Online (Sandbox Code Playgroud)
在Kafka主题中,我每秒收到约150条消息。
一切都很好,部分原因是表中的数据更新有很大的延迟,这绝对不是实时的。
似乎只有当我到达65536个 …
我有一个名为的接口Man
.在这个接口中,我有一个getList()
返回类型T列表的方法(依赖于实现接口的类).我有3类实现Man
:small
,normal
,和big
.每个类都有方法getList()
thart返回列表small
或列表normal
或列表big
.
interface Man<T>{
List<T>getList();
}
class small : Man<small>{
List<small> getList(){
return new List<small>();
}
}
class normal : Man<normal>{
List<normal> getList(){
return new List<normal>();
}
}
class big : Man<big>{
List<big> getList(){
return new List<big>();
}
}
Run Code Online (Sandbox Code Playgroud)
现在我有了类:Home
它包含一个参数bed
,它是一个实例Man
.
Bed
可以是各种类型的:small
,normal
,big
.如何声明类型参数bed
?
class Home{
Man bed<> // …
Run Code Online (Sandbox Code Playgroud)