**函数定义** `cast (input as type)` 将 input 转换成指定类型(type)的值。如cast (input as BIGINT)将当前列 input 转换为 BIGINT 类型的值。 **示例** * 将常量或表中某列转换为指定类型的值 `mysql> select cast (1 as BIGINT);` `+-------------------+` `| CAST(1 AS BIGINT) |` `+-------------------+` `| 1 |` `+-------------------+` * 导入数据时转换数据类型 `curl --location-trusted -u root: -T ~/user_data/bigint -H "columns: tmp_k1, k1=cast(tmp_k1 as BIGINT)" http://host:port/api/test/bigint/_stream_load` 从文本文件导入数据时,系统输入均为字符串。若将值为浮点数的原始数据(如12.34)通过cast函数转换为BIGINT,输出值将为 NULL 。DorisDB目前不会根据小数点截断原始数据以达到取整的效果。如果想强制将这种类型的原始数据转换为整数可参考下面写法。 `curl --location-trusted -u root: -T ~/user_data/bigint -H "columns: tmp_k1, k1=cast(cast(tmp_k1 as DOUBLE) as BIGINT)" http://host:port/api/test/bigint/_stream_load` `mysql> select cast(cast ("11.2" as double) as bigint);` `+----------------------------------------+` `| CAST(CAST('11.2' AS DOUBLE) AS BIGINT) |` `+----------------------------------------+` `| 11 |` `+----------------------------------------+` `1 row in set (0.00 sec)` **关键字** `CAST`