๐๐ฎ๐๐ฎ, ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ & ๐๐. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
This pull request introduces support for accessing Redis data from dictionaries using the dict_getfunction. Other source like MySQL, PostgreSQL will be introduced in the future PRs.
Dictionary Creation with Redis Source:
CREATE OR REPLACE DICTIONARY d(key string not null, value string not null) PRIMARY KEY key SOURCE(redis(host='127.0.0.1' port='6379'))
options are used to provide the Redis connection URL, host and port are required options, and username, password, db_index are optional options.
connect to Redis and set some test keys and values
redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> set a abc
OK
127.0.0.1:6379> set b def
OK
127.0.0.1:6379>
Data Access with dict_get Function:
MySQL [(none)]> create or replace table t(a string);
Query OK, 0 rows affected (0.201 sec)
MySQL [(none)]> insert into t values('a'),('b'),('c');
Query OK, 3 rows affected (0.095 sec)
MySQL [(none)]> select a, dict_get(d, 'value', a) from t;
+------+---------------------------------+
| a | dict_get(default.d, 'value', a) |
+------+---------------------------------+
| a | abc |
| b | def |
| c | |
+------+---------------------------------+
3 rows in set (0.173 sec)
The result corresponds to the value stored in Redis associated with the keys in table column a.
If the key is not exists in the Redis, a default value will be inserted instead.
This PR also introduces a mock_source, which simulates a Redis server to test the dict_get function. Future work will expand this mock data source functionality to include support for other sources such as MySQL, PostgreSQL, and more.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
This pull request introduces support for accessing Redis data from dictionaries using the
dict_get
function. Other source like MySQL, PostgreSQL will be introduced in the future PRs.options are used to provide the Redis connection URL,
host
andport
are required options, andusername
,password
,db_index
are optional options.connect to Redis and set some test keys and values
dict_get
Function:This PR also introduces a
mock_source
, which simulates a Redis server to test thedict_get
function. Future work will expand this mock data source functionality to include support for other sources such as MySQL, PostgreSQL, and more.part of https://github.com/datafuselabs/databend/issues/15901
Tests
Type of change
This change isโ