一、引言
Cloudera的Hue组件提供了可视化的开发界面,可以方便进行大数据相关功能的便捷开发。
比如针对Hive开发的hive编辑器,就内置了非常多的快捷操作,善用这些操作,开发时势必会事半功倍。
二、如何查看快捷键
2.1 入口
2.2 Hive编辑器帮助文档
三、Hive编辑器的详细用法
3.1 hql注释添加方式
A comment is text that is not executed. It can be of two types:
注释不会被执行。hive编辑器支持两种注释:
单行注释:
-- Comment
多行注释
/* Multi Line
Comment */
3.2 巧妙使用点击选用需要运行的hql语句块
-
双击:双击编辑器左边行数选择所有行。
-
单击:单击编辑器左边行数,选择这一行。
-
拖拽表名
编辑器左侧选择好库、表,拖拽至Hive编辑区,可以插入相应查询样例模板到编辑区。
插入后,在右侧“助手”tab栏里,可以看到表的schema结构。
-
编辑区右键单击“表名”、“字段名”:可以预览到元素相应的信息。包括字段、表、函数等。
3.3 多语句查询支持
在一个编辑器里通过 “;” 来分隔多个查询语句。
执行鼠标位置hql。
select * from web_logs where country_code = "${country_code}";
select * from web_logs where country_code = "${country_code=US}";
select * from web_logs where country_code = "${country_code=CA, FR, US}";
select * from web_logs
where country_code = "${country_code=CA, FR, US}";
SELECT area,* FROM test.explode_lateral_view LIMIT 100;
3.4 变量
变量是为了在查询中容易配置参数。总共有两种类型变量。
- 单值变量: ${variable_name}
select * from web_logs where country_code = "${country_code}"
- 变量可以设置默认值:
select * from web_logs where country_code = "${country_code=US}"
- 多值变量:
${variable_name=variable_value1, variable_value2,...}
select * from web_logs where country_code = "${country_code=CA, FR, US}"
改变展示内容后,展示名字和变量值不一致。
select * from web_logs where country_code = "${country_code=CA(Canada), FR(France), US(United States)}"
四、快捷键
4.0 快捷键说明
快捷键支持windows/linux系列和mac系统。
mac笔记本电脑没有delete、home 、end键。
delete:fn + Backspace
home:fn + left
end: fn + right
4.1 Hive编辑区快捷键
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Ctrl-D | Command-D | Remove line | 删除行 |
Alt-Shift-Down | Command-Option-Down | Copy lines down | 向下复制一行 |
Alt-Shift-Up | Command-Option-Up | Copy lines up | 向上复制一行 |
Alt-Down | Option-Down | Move lines down | 下移行 |
Alt-Up | Option-Up | Move lines up | 上移行 |
Alt-Delete | Ctrl-K | Remove to line end | 删除到行尾 |
Alt-Backspace | Command-Backspace | Remove to line start | 删除到行头 |
Ctrl-Backspace | Option-Backspace, Ctrl-Option-Backspace | Remove word left | 向左边删除一个单词 |
Ctrl-Delete | Option-Delete | Remove word right | 向右边删除一个单词 |
— | Ctrl-O | Split line | 插入一行 |
4.2 选择
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Ctrl-A | Command-A | Select all | 全选 |
Shift-Left | Shift-Left | Select left | 往左边选择 |
Shift-Right | Shift-Right | Select right | 往右边选择 |
Ctrl-Shift-Left | Option-Shift-Left | Select word left | 往左边选择一个单词 |
Ctrl-Shift-Right | Option-Shift-Right | Select word right | 往右边选择一个单词 |
Shift-Home | Shift-Home | Select line start | 选择到行首 |
Shift-End | Shift-End | Select line end | 选择到行尾 |
Alt-Shift-Right | Command-Shift-Right | Select to line end | 选择到行尾 |
Alt-Shift-Left | Command-Shift-Left | Select to line start | 选择到行首 |
Shift-Up | Shift-Up | Select up | 向上选择一行 |
Shift-Down | Shift-Down | Select down | 向下选择一行 |
Shift-PageUp | Shift-PageUp | Select page up | 向上选择一页 |
Shift-PageDown | Shift-PageDown | Select page down | 向下选择一页 |
Ctrl-Shift-Home | Command-Shift-Up | Select to start | 选择从当前到开始 |
Ctrl-Shift-End | Command-Shift-Down | Select to end | 选择从当前到结尾 |
Ctrl-Shift-D | Command-Shift-D | Duplicate selection | 复制 |
Ctrl-Shift-P | — | Select to matching bracket |
4.3 多光标
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Ctrl-Alt-Up | Ctrl-Option-Up | Add multi-cursor above | 向上增加光标 |
Ctrl-Alt-Down | Ctrl-Option-Down | Add multi-cursor below | 向下增加光标 |
Ctrl-Alt-Right | Ctrl-Option-Right | Add next occurrence to multi-selection | 向下一个发生的地方增加选择 |
Ctrl-Alt-Left | Ctrl-Option-Left | Add previous occurrence to multi-selection | 向上一个发生的地方增加选择 |
Ctrl-Alt-Shift-Up | Ctrl-Option-Shift-Up | Move multicursor from current line to the line above | 多个光标时将当前的光标向上移动一行 |
Ctrl-Alt-Shift-Down | Ctrl-Option-Shift-Down | Move multicursor from current line to the line below | 多个光标时将当前的光标向下移动一行 |
Ctrl-Alt-Shift-Right | Ctrl-Option-Shift-Right | Remove current occurrence from multi-selection and move to next | 多个光标时将当前的光标移动到下一个发生的位置 |
Ctrl-Alt-Shift-Left | Ctrl-Option-Shift-Left | Remove current occurrence from multi-selection and move to previous | 多个光标时将当前的光标移动到上一个发生的位置 |
Ctrl-Shift-L | Ctrl-Shift-L | Select all from multi-selection | 选择光标所有地方 |
4.4 跳转
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Left Left, | Ctrl-B | Go to left | 向左跳转 |
Right Right, | Ctrl-F | Go to right | 向右跳转 |
Ctrl-Left | Option-Left | Go to word left | 跳转到左边单词 |
Ctrl-Right | Option-Right | Go to word right | 跳转到右边单词 |
Up Up, | Ctrl-P | Go line up | 跳转到上一行 |
Down Down, | Ctrl-N | Go line down | 跳转到下一行 |
Alt-Left, Home | Command-Left, Home, Ctrl-A | Go to line start | 跳转到行首 |
Alt-Right, | End Command-Right, End, Ctrl-E | Go to line end | 跳转到行尾 |
PageUp | Option-PageUp | Go to page up | 跳转到上一页 |
PageDown | Option-PageDown, Ctrl-V | Go to page down | 跳转到下一页 |
Ctrl-Home | Command-Home, Command-Up | Go to start | 跳转到开始 |
Ctrl-End | Command-End, Command-Down | Go to end | 跳转到结尾 |
Ctrl-L, Ctrl-J | Command-L, Command-J | Go to line | 跳转到固定行 |
Ctrl-Down | Command-Down | Scroll line down | 滚动轴向下移动 |
Ctrl-Up | — | Scroll line up | 滚动轴向上移动 |
Ctrl-P | — | Go to matching bracket | |
— | Option-PageDown | Scroll page down | 滚动轴向下移动一页 |
— | Option-PageUp | Scroll page up | 滚动轴向上移动一页 |
4.5 查找替换
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Ctrl-F | Command-F | Find | 查找 |
Ctrl-H | Command-Option-F | Replace | 替换 |
Ctrl-K | Command-G | Find next | 查找下一个 |
Ctrl-Shift-K | Command-Shift-G | Find previous | 查找上一个 |
4.6 隐藏和展开
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Alt-L, Ctrl-F1 | Command-Option-L, Command-F1 | Fold selection | 隐藏已经选择的行 |
Alt-Shift-L, Ctrl-Shift-F1 | Command-Option-Shift-L, Command-Shift-F1 | Unfold | 展开 |
Alt-0 | Command-Option-0 | Fold all | 隐藏所有 |
Alt-Shift-0 | Command-Option-Shift-0 | Unfold all | 展开所有 |
4.7 其他
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Ctrl-Space | Ctrl-Space | Autocomplete when Live Autocompletion is off | |
Ctrl-i | Ctrl-Shift-f Command-i,Command-Shift-f | Format selection or all | 格式化 |
Tab | Tab | Indent | 缩进 |
Shift-Tab | Shift-Tab | Outdent | 删除缩进 |
Ctrl-Z | Command-Z | Undo | 撤销 |
Ctrl-Shift-Z, Ctrl-Y | Command-Shift-Z, Command-Y | Redo | 恢复 |
Ctrl-/ | Command-/ | Toggle comment | 注释 |
Ctrl-T | Ctrl-T | Transpose | letters |
Ctrl-Shift-U | Ctrl-Shift-U | Change to lower case | 小写 |
Ctrl-U | Ctrl-U | Change to upper case | 大写 |
Insert | Insert | Overwrite | 覆盖 |
Ctrl-Shift-E | Command-Shift-E | Macros replay | |
Ctrl-Alt-E | — | Macros recording | |
Delete | — | Delete | |
— | Ctrl-L | Center selection | 游标居中 |
4.8 设置
Windows/Linux | Mac | 描述 | 中文描述 |
---|---|---|---|
Ctrl - , | Command - , | Show the settings menu | 设置 |
更多推荐
HUE上hive编辑器快捷键说明
发布评论