暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

VerticaTips-Getting a Word Count

原创 simonchiang 2021-12-15
455

VerticaTips-Getting a Word Count

Vertica REGEXP_COUNT 函数返回正则表达式与字符串匹配的次数。您可以使用它来创建自己的用户定义 SQL 函数,用于计算字符串中的单词数。

dbadmin=> CREATE OR REPLACE FUNCTION get_word_count(x varchar) RETURN INT dbadmin-> AS dbadmin-> BEGIN dbadmin-> RETURN regex_count(x, '[\w-]+'); dbadmin-> END; CREATE FUNCTION dbadmin=> SELECT get_word_count('The Vertica Analytics Platform is purpose built from the very first line of code for Big Data analytics.'); get_word_count ---------------- 18 (1 row) dbadmin=> SELECT get_word_count('Vertica allows you to analyze your data not only in place, but in the right place – without data movement – while supporting any major cloud deployment for fast and reliable read and write for multiple data formats!'); get_word_count ---------------- 36 (1 row) dbadmin=> SELECT get_word_count('Vertica relies on a tested, reliable distributed architecture and columnar compression to deliver blazingly fast speed. A simplified license and the capability to deploy anywhere delivers on the promise of big data analytics like no other solution.'); get_word_count ---------------- 37 (1 row)

二维码.png

最后修改时间:2024-08-29 11:06:57
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论