以下是我的规则和源配置:
{
"streams": {
"stream1": "\n CREATE STREAM stream1\n ()\n WITH (DATASOURCE=\"pack01\", FORMAT=\"json\", CONF_KEY=\"444\", TYPE=\"sql\", SHARED=\"false\", TIMESTAMP=\"create_time\", TIMESTAMP_FORMAT=\"YYYY-MM-dd HH:mm:ss\", );\n "
},
"rules": {
"rule003": "{\"triggered\":false,\"id\":\"rule003\",\"name\":\"for-stream1\",\"sql\":\"SELECT id from stream1;\",\"actions\":[{\"log\":{\"bufferLength\":1024,\"enableCache\":false,\"format\":\"json\",\"omitIfEmpty\":false,\"runAsync\":false,\"sendSingle\":true}}],\"options\":{\"debug\":false,\"logFilename\":\"\",\"isEventTime\":false,\"lateTolerance\":1000,\"concurrency\":1,\"bufferLength\":1024,\"sendMetaToSink\":false,\"sendError\":true,\"qos\":1,\"checkpointInterval\":1000,\"restartStrategy\":{\"attempts\":0,\"delay\":5000,\"multiplier\":2,\"maxDelay\":30000,\"jitter\":0.1},\"cron\":\"\",\"duration\":\"\",\"cronDatetimeRange\":null}}"
},
"nativePlugins": {
"sources_sql": "{\"name\":\"sql\",\"file\":\"https://packages.emqx.net/kuiper-plugins/1.12.3/alpine/sources/sql_arm64.zip\",\"shellParas\":[]}"
},
"portablePlugins": {},
"sourceConfig": {
"sql": "{\"444\":{\"internalSqlQueryCfg\":{\"indexField\":\"id\",\"indexFieldType\":\"bigint\",\"indexValue\":\"2\",\"limit\":1,\"table\":\"pack01\"},\"interval\":3000,\"lookup\":{\"cache\":true,\"cacheMissingKey\":true,\"cacheTtl\":600},\"templateSqlQueryCfg\":{\"TemplateSql\":\"select * from pack01 where id \\u003e 2 limit 1\",\"indexField\":\"id\",\"indexFieldType\":\"bigint\",\"indexValue\":\"2\"},\"url\":\"mysql://root:******@192.168.5.15:3306/ekuiper_test?parseTime=true\"},\"default\":{\"url\":\"mysql://username:password@127.0.0.1:3306/testdb?parseTime=true\"},\"mysql_config\":{\"url\":\"mysql://username:password@127.0.0.1:3306/testdb?parseTime=true\"},\"oracle_config\":{\"url\":\"oracle://username:password@127.0.0.1:1521/testdb\"},\"postgresql_config\":{\"url\":\"postgres://username:password@127.0.0.1:5432/testdb\"},\"sqlite_config\":{\"url\":\"sqlite:/tmp/test.db\"},\"sqlserver_config\":{\"url\":\"sqlserver://username:password@127.0.0.1:1433/testdb\"}}"
}
}
这是我的数据表建表语句:
create table ekuiper_test.pack01
(
id bigint auto_increment comment '主键'
primary key,
temp int default 0 null comment '温度',
height varchar(12) default '' null comment '高度',
ts datetime null comment '时间',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间'
)
comment '模拟pack01设备数据' collate = utf8mb4_general_ci;
以下是日志中的错误日志:
time="2024-02-26T06:27:33Z" level=info msg="drop database instance: mysql://root:******@192.168.5.15:3306/ekuiper_test?parseTime=true" file="util/pool.go:152"
goroutine 3164 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x64
runtime/debug.PrintStack()
runtime/debug/stack.go:16 +0x1c
github.com/lf-edge/ekuiper/pkg/infra.SafeRun.func1()
github.com/lf-edge/ekuiper/pkg/infra/saferun.go:34 +0x3c
panic({0x1a86ae0?, 0x400048f750?})
runtime/panic.go:914 +0x230
github.com/posener/order/internal/reflectutil.T.Convert({{0x1f384a8?, 0x1a86d20?}, 0x0?}, {0x1a86ae0, 0x4000aa5570, 0x98})
github.com/posener/order@v0.0.1/internal/reflectutil/t.go:53 +0x118
github.com/posener/order.newFn.func1({0x1a86d20?, 0x4000011d18?, 0x4000011d18?}, {0x1a86ae0?, 0x4000aa5570?, 0x4000011d18?})
github.com/posener/order@v0.0.1/fn.go:53 +0xc4
github.com/posener/order.Fns.compare(...)
github.com/posener/order@v0.0.1/fn.go:63
github.com/posener/order.Condition.Greater({{0x4000596140, 0x1, 0x1}, {0x1a86d20, 0x4000011d18, 0x86}}, {0x1a86ae0?, 0x4000aa5570?})
github.com/posener/order@v0.0.1/condition.go:30 +0x118
github.com/lf-edge/ekuiper/extensions/sqldatabase/sqlgen.(*templateSqlQuery).UpdateMaxIndexValue(0x40003b6040, 0x400059cd70?)
github.com/lf-edge/ekuiper/extensions/sqldatabase/sqlgen/templateSqlDialect.go:89 +0xb4
github.com/lf-edge/ekuiper/extensions/sources/sql/ext.(*sqlsource).Open(0x40004564c0, {0x1f35be8, 0x400026b760}, 0x303120726f727245?, 0x3030323428203436?)
github.com/lf-edge/ekuiper/extensions/sources/sql/ext/sql.go:131 +0x5cc
github.com/lf-edge/ekuiper/internal/topo/node.getSourceInstance.func1.1()
github.com/lf-edge/ekuiper/internal/topo/node/source_pool.go:80 +0xd8