select * from nginx_log where log['ip'] = '205.91.162.148';
+----+----------------------------------------+
| id | log |
+----+----------------------------------------+
| 1 | {'ip':'205.91.162.148','url':'test-1'} |
+----+----------------------------------------+
如果你想了解更多关于 MAP 数据类型的信息,请阅读以下材料:
Docs | Data Types - Map
Data Transformation During Loading Process
你还记得上周提到的两个 RFC 吗?现在,Databend 已经支持在加载数据到表的过程中进行数据转换。使用 COPY INTO
命令即可实现基本的转换操作。
CREATE TABLE my_table(id int, name string, time date);COPY INTO my_table
FROM (SELECT t.id, t.name, to_date(t.timestamp) FROM @mystage t)
FILE_FORMAT = (type = parquet) PATTERN='.*parquet';
/// Run multiple futures parallel
/// using a semaphore to limit the parallelism number, and a specified thread pool to run the futures.
/// It waits for all futures to complete and returns their results.
pub async fn execute_futures_in_parallel(futures: impl IntoIterator,thread_nums: usize,permit_nums: usize,thread_name: String,
) -> Result>
whereFut: Future + Send + 'static,Fut::Output: Send + 'static,
{// 1. build the runtime.let semaphore = Semaphore::new(permit_nums);let runtime = Arc::new(Runtime::with_worker_threads(thread_nums,Some(thread_name),)?);// 2. spawn all the tasks to the runtime with semaphore.let join_handlers = runtime.try_spawn_batch(semaphore, futures).await?;// 3. get all the result.future::try_join_all(join_handlers).await.map_err(|e| ErrorCode::Internal(format!("try join all futures failure, {}", e)))
}
如果你对这个 Rust 技巧感兴趣,可以阅读这个 PR feat: improve the parquet get splits to parallel 。