当前位置: 首页 > java >正文

Hive-vscode-snippets

为了提高写HiveSQL的体验,这里通过Qwen3Coder生成了一个vscode的snippets.
欢迎体验:

关于如何创建,修改snippets,可以搜索下

{"Hive Create Table": {"prefix": "hive_create","body": ["CREATE TABLE IF NOT EXISTS ${1:table_name} (","\t${2:column1} ${3:string},","\t${4:column2} ${5:int}",")","COMMENT '${6:Table description}'","ROW FORMAT DELIMITED","FIELDS TERMINATED BY '${7:\\t}'","LINES TERMINATED BY '${8:\\n}'","STORED AS ${9:TEXTFILE};"],"description": "创建Hive表基础模板"},"Hive Create Table with Partition": {"prefix": "hive_create_partition","body": ["CREATE TABLE IF NOT EXISTS ${1:table_name} (","\t${2:column1} ${3:string},","\t${4:column2} ${5:int}",")","COMMENT '${6:Table description}'","PARTITIONED BY (${7:partition_col} ${8:string})","ROW FORMAT DELIMITED","FIELDS TERMINATED BY '${9:\\t}'","STORED AS ${10:TEXTFILE};"],"description": "创建带分区的Hive表"},"Hive Create External Table": {"prefix": "hive_create_external","body": ["CREATE EXTERNAL TABLE IF NOT EXISTS ${1:table_name} (","\t${2:column1} ${3:string},","\t${4:column2} ${5:int}",")","COMMENT '${6:Table description}'","LOCATION '${7:/path/to/data}';"],"description": "创建外部表"},"Hive Drop Table": {"prefix": "hive_drop","body": ["DROP TABLE IF EXISTS ${1:table_name};"],"description": "删除Hive表"},"Hive Drop Database": {"prefix": "hive_drop_db","body": ["DROP DATABASE IF EXISTS ${1:database_name} CASCADE;"],"description": "删除Hive数据库"},"Hive Select Basic": {"prefix": "hive_select","body": ["SELECT ${1:*} FROM ${2:table_name}${3: LIMIT 10};"],"description": "基本SELECT查询"},"Hive Select with Where": {"prefix": "hive_select_where","body": ["SELECT ${1:column1, column2}","FROM ${2:table_name}","WHERE ${3:condition};"],"description": "带WHERE条件的SELECT查询"},"Hive Select with Group By": {"prefix": "hive_select_group","body": ["SELECT ${1:group_column}, COUNT(*) as count","FROM ${2:table_name}","GROUP BY ${3:group_column}","ORDER BY ${4:count DESC};"],"description": "带GROUP BY的SELECT查询"},"Hive Insert Overwrite": {"prefix": "hive_insert_overwrite","body": ["INSERT OVERWRITE TABLE ${1:target_table}","SELECT ${2:*} FROM ${3:source_table}${4: WHERE condition};"],"description": "覆盖插入数据"},"Hive Insert Into": {"prefix": "hive_insert_into","body": ["INSERT INTO TABLE ${1:target_table}","SELECT ${2:*} FROM ${3:source_table}${4: WHERE condition};"],"description": "追加插入数据"},"Hive Load Data": {"prefix": "hive_load","body": ["LOAD DATA ${1:LOCAL} INPATH '${2:/path/to/file}'","${3:OVERWRITE} INTO TABLE ${4:table_name}${5: PARTITION (partition_col='value')};"],"description": "加载数据到表中"},"Hive Alter Table Add Column": {"prefix": "hive_alter_add","body": ["ALTER TABLE ${1:table_name} ADD COLUMNS (${2:column_name} ${3:string} COMMENT '${4:comment}');"],"description": "添加列到表中"},"Hive Alter Table Rename": {"prefix": "hive_alter_rename","body": ["ALTER TABLE ${1:old_table_name} RENAME TO ${2:new_table_name};"],"description": "重命名表"},"Hive Show Tables": {"prefix": "hive_show_tables","body": ["SHOW TABLES${1: LIKE '${2:pattern}'};"],"description": "显示表列表"},"Hive Describe Table": {"prefix": "hive_desc","body": ["DESCRIBE ${1:table_name};"],"description": "描述表结构"},"Hive Describe Extended": {"prefix": "hive_desc_ext","body": ["DESCRIBE EXTENDED ${1:table_name};"],"description": "详细描述表信息"},"Hive String Functions": {"prefix": "hive_string_funcs","body": ["-- 字符串函数示例","SELECT ","\tconcat(${1:col1}, ${2:col2}) as concatenated,","\tupper(${3:col}) as upper_case,","\tlower(${4:col}) as lower_case,","\tlength(${5:col}) as str_length,","\tsubstring(${6:col}, ${7:start_pos}, ${8:length}) as substr,","\tsplit(${9:col}, '${10:delimiter}') as split_array","FROM ${11:table_name};"],"description": "常用字符串函数"},"Hive Date Functions": {"prefix": "hive_date_funcs","body": ["-- 日期函数示例","SELECT ","\tcurrent_date() as today,","\tcurrent_timestamp() as now,","\tdate_add(${1:date_col}, ${2:days}) as date_plus,","\tdate_sub(${3:date_col}, ${4:days}) as date_minus,","\tdatediff(${5:date1}, ${6:date2}) as date_diff,","\tyear(${7:date_col}) as year_part,","\tmonth(${8:date_col}) as month_part,","\tday(${9:date_col}) as day_part","FROM ${10:table_name};"],"description": "常用日期函数"},"Hive Math Functions": {"prefix": "hive_math_funcs","body": ["-- 数学函数示例","SELECT ","\tround(${1:col}, ${2:decimal_places}) as rounded,","\tceil(${3:col}) as ceiling,","\tfloor(${4:col}) as floor_value,","\tabs(${5:col}) as absolute,","\tsqrt(${6:col}) as square_root,","\tpower(${7:col}, ${8:exponent}) as power_value","FROM ${9:table_name};"],"description": "常用数学函数"},"Hive Aggregate Functions": {"prefix": "hive_agg_funcs","body": ["-- 聚合函数示例","SELECT ","\tcount(${1:*}) as total_count,","\tcount(distinct ${2:col}) as distinct_count,","\tsum(${3:col}) as sum_value,","\tavg(${4:col}) as average_value,","\tmin(${5:col}) as min_value,","\tmax(${6:col}) as max_value","FROM ${7:table_name}","GROUP BY ${8:group_column};"],"description": "常用聚合函数"},"Hive Window Functions": {"prefix": "hive_window_funcs","body": ["-- 窗口函数示例","SELECT ","\t${1:col},","\trow_number() OVER (PARTITION BY ${2:partition_col} ORDER BY ${3:order_col}) as row_num,","\trank() OVER (PARTITION BY ${4:partition_col} ORDER BY ${5:order_col}) as rank_val,","\tdense_rank() OVER (PARTITION BY ${6:partition_col} ORDER BY ${7:order_col}) as dense_rank_val,","\tlead(${8:col}, 1) OVER (PARTITION BY ${9:partition_col} ORDER BY ${10:order_col}) as next_val,","\tlag(${11:col}, 1) OVER (PARTITION BY ${12:partition_col} ORDER BY ${13:order_col}) as prev_val","FROM ${14:table_name};"],"description": "常用窗口函数"},"Hive Join Operations": {"prefix": "hive_join","body": ["SELECT ${1:t1.col1, t2.col2}","FROM ${2:table1} t1","${3:INNER JOIN} ${4:table2} t2 ON t1.${5:join_key} = t2.${6:join_key}","${7:WHERE condition};"],"description": "JOIN操作"},"Hive Left Join": {"prefix": "hive_left_join","body": ["SELECT ${1:t1.col1, t2.col2}","FROM ${2:table1} t1","LEFT JOIN ${3:table2} t2 ON t1.${4:join_key} = t2.${5:join_key}","${6:WHERE condition};"],"description": "LEFT JOIN操作"},"Hive Case When": {"prefix": "hive_case","body": ["CASE ","\tWHEN ${1:condition1} THEN '${2:value1}'","\tWHEN ${3:condition2} THEN '${4:value2}'","\tELSE '${5:default_value}'","END AS ${6:new_column}"],"description": "CASE WHEN条件语句"},"Hive Multi-line Comment": {"prefix": "hive_comment_multi","body": ["/*"," * ${1:Multi-line comment}"," * ${2:Add more comments here}"," */"],"description": "多行注释"},"Hive Single-line Comment": {"prefix": "hive_comment_single","body": ["-- ${1:Single line comment}"],"description": "单行注释"},"Hive CTE (Common Table Expression)": {"prefix": "hive_cte","body": ["WITH ${1:cte_name} AS (","\tSELECT ${2:*}","\tFROM ${3:table_name}","\tWHERE ${4:condition}",")","SELECT ${5:*} FROM ${6:cte_name}${7: WHERE condition};"],"description": "公用表表达式(CTE)"},"Hive Create Database": {"prefix": "hive_create_db","body": ["CREATE DATABASE IF NOT EXISTS ${1:database_name}","COMMENT '${2:Database description}'","LOCATION '${3:/path/to/database}';"],"description": "创建数据库"},"Hive Use Database": {"prefix": "hive_use_db","body": ["USE ${1:database_name};"],"description": "切换数据库"},"Hive Show Databases": {"prefix": "hive_show_dbs","body": ["SHOW DATABASES;"],"description": "显示数据库列表"},"Hive Set Properties": {"prefix": "hive_set","body": ["SET ${1:property_name}=${2:property_value};"],"description": "设置Hive属性"},"Hive Set MapReduce Properties": {"prefix": "hive_set_mr","body": ["-- MapReduce相关设置","SET mapreduce.job.queuename=${1:queue_name};","SET mapreduce.job.reduces=${2:reducer_count};","SET hive.exec.reducers.bytes.per.reducer=${3:256000000};"],"description": "MapReduce属性设置"}
}
http://www.xdnf.cn/news/16298.html

相关文章:

  • [特殊字符] 第9篇:《SQL高阶 SELECT 技巧:DISTINCT、ORDER BY、LIMIT 全家桶》
  • CN3798-2A 降压型单节锂电池充电芯片
  • Androidstudio 上传当前module 或本地jar包到maven服务器。
  • 二分查找----6.寻找两个正序数组的中位数
  • Python 数据分析(一):NumPy 基础知识
  • PI 思维升级 PI设计的典范转移:从阻抗思维到谐振控制
  • 【办公类-107-03】20250725通义万相2.1“动物拟人化”视频,优化关键词(图片转视频MP4转gif))
  • 我的世界之战争星球 暮色苍茫篇 第二十三章、出发!暮色森林!
  • 【硬件-笔试面试题】硬件/电子工程师,笔试面试题-26,(知识点:硬件电路的调试方法:信号追踪,替换,分段调试)
  • 恋爱时间倒计时网页设计与实现方案
  • 数据仓库深度探索系列 | 开篇:开启数仓建设新征程
  • Homebrew 更换镜像源加速软件安装:详细操作指南
  • NVM踩坑实录:配置了npm的阿里云cdn之后,下载nodejs老版本(如:12.18.4)时,报404异常,下载失败的问题解决
  • 壁纸管理 API 文档
  • PPIO上线阿里旗舰推理模型Qwen3-235B-A22B-Thinking-2507
  • [特殊字符] VLA 如何“绕过”手眼标定?—— 当机器人学会了“看一眼就动手”
  • Qt 与 SQLite 嵌入式数据库开发
  • ✨ 使用 Flask 实现头像文件上传与加载功能
  • 工业缺陷检测的计算机视觉方法总结
  • 【C++ python cython】C++如何调用python,python 运行速度如何提高?
  • 工程项目管理软件评测:13款热门平台一览
  • mysql 和oracle的选择
  • JMeter每次压测前清除全部以确保异常率准确(以黑马点评为例、详细图解)
  • Springboot整合springmvc
  • 微信小程序动态切换窗口主题色
  • SpringBoot3(若依框架)集成Mybatis-Plus和单元测试功能,以及问题解决
  • 全面解析MySQL(3)——CRUD进阶与数据库约束:构建健壮数据系统的基石
  • 关于回归决策树CART生成算法中的最优化算法详解
  • Android Kotlin 协程全面指南
  • 详解软件需求中的外部接口需求