hue的hive编辑器上的语法和快捷键
一、查看快捷键的方式
单击下图中问号:
查看快捷键的方式.png
快捷键和语法
二、hive的语法
2.1 注释
A comment is text that is not executed. It can be of two types:
注释不会被执行。hive编辑器支持两种注释:
单行注释:
-- Comment
多行注释
/* Multi Line
Comment */
2.2 点击
双击:双击编辑器左边行数选择所有行。
双击行数选择所有行
拖拽
从助手拖拽表名到编辑器可以插入相应查询样例到编辑器。
插入相应查询样例到编辑器
右键单击:右键单击hql中的元素可以浏览到元素相应的信息。元素包括函数、列名、表名等。
右键单击
单击:单击左边编辑器的行数选择一整行。2.3 多语句查询
在一个编辑器里通过;分隔多个查询语句。
执行鼠标位置hql。
select * from customers;
select * from web_logs;
2.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)}"
三、快捷键
快捷键支持windows/linux系列和mac系统。
mac笔记本电脑没有delete、home 、end键。delete:fn + Backspacehome:fn + leftend: fn + right
3.1 行操作
Windows/LinuxMac描述中文描述Ctrl-DCommand-DRemove line删除行Alt-Shift-DownCommand-Option-DownCopy lines down向下复制一行Alt-Shift-UpCommand-Option-UpCopy lines up向上复制一行Alt-DownOption-DownMove lines down下移行Alt-UpOption-UpMove lines up上移行Alt-DeleteCtrl-KRemove to line end删除到行尾Alt-BackspaceCommand-BackspaceRemove to line start删除到行头Ctrl-BackspaceOption-Backspace, Ctrl-Option-BackspaceRemove word left向左边删除一个单词Ctrl-DeleteOption-DeleteRemove word right向右边删除一个单词---Ctrl-OSplit line插入一行3.2 选择
Windows/LinuxMacAction描述Ctrl-ACommand-ASelect all全选Shift-LeftShift-LeftSelect left往左边选择Shift-RightShift-RightSelect right往右边选择Ctrl-Shift-LeftOption-Shift-LeftSelect word left往左边选择一个单词Ctrl-Shift-RightOption-Shift-RightSelect word right往右边选择一个单词Shift-HomeShift-HomeSelect line start选择到行首Shift-EndShift-EndSelect line end选择到行尾Alt-Shift-RightCommand-Shift-RightSelect to line end选择到行尾Alt-Shift-LeftCommand-Shift-LeftSelect to line start选择到行首Shift-UpShift-UpSelect up向上选择一行Shift-DownShift-DownSelect down向下选择一行Shift-PageUpShift-PageUpSelect page up向上选择一页Shift-PageDownShift-PageDownSelect page down向下选择一页Ctrl-Shift-HomeCommand-Shift-UpSelect to start选择从当前到开始Ctrl-Shift-EndCommand-Shift-DownSelect to end选择从当前到结尾Ctrl-Shift-DCommand-Shift-DDuplicate selection复制Ctrl-Shift-P---Select to matching bracket 3.3 多光标
Windows/LinuxMacAction描述Ctrl-Alt-UpCtrl-Option-UpAdd multi-cursor above向上增加光标Ctrl-Alt-DownCtrl-Option-DownAdd multi-cursor below向下增加光标Ctrl-Alt-RightCtrl-Option-RightAdd next occurrence to multi-selection向下一个发生的地方增加选择Ctrl-Alt-LeftCtrl-Option-LeftAdd previous occurrence to multi-selection向上一个发生的地方增加选择Ctrl-Alt-Shift-UpCtrl-Option-Shift-UpMove multicursor from current line to the line above多个光标时将当前的光标向上移动一行Ctrl-Alt-Shift-DownCtrl-Option-Shift-DownMove multicursor from current line to the line below多个光标时将当前的光标向下移动一行Ctrl-Alt-Shift-RightCtrl-Option-Shift-RightRemove current occurrence from multi-selection and move to next多个光标时将当前的光标移动到下一个发生的位置Ctrl-Alt-Shift-LeftCtrl-Option-Shift-LeftRemove current occurrence from multi-selection and move to previous多个光标时将当前的光标移动到上一个发生的位置Ctrl-Shift-LCtrl-Shift-LSelect all from multi-selection选择光标所有地方3.4 跳转
Windows/LinuxMacAction描述LeftLeft, Ctrl-BGo to left向左跳转RightRight, Ctrl-FGo to right向右跳转Ctrl-LeftOption-LeftGo to word left跳转到左边单词Ctrl-RightOption-RightGo to word right跳转到右边单词UpUp, Ctrl-PGo line up跳转到上一行DownDown, Ctrl-NGo line down跳转到下一行Alt-Left, HomeCommand-Left, Home, Ctrl-AGo to line start跳转到行首Alt-Right, EndCommand-Right, End, Ctrl-EGo to line end跳转到行尾PageUpOption-PageUpGo to page up跳转到上一页PageDownOption-PageDown, Ctrl-VGo to page down跳转到下一页Ctrl-HomeCommand-Home, Command-UpGo to start跳转到开始Ctrl-EndCommand-End, Command-DownGo to end跳转到结尾Ctrl-L, Ctrl-JCommand-L, Command-JGo to line跳转到固定行Ctrl-DownCommand-DownScroll line down滚动轴向下移动Ctrl-Up---Scroll line up滚动轴向上移动Ctrl-P---Go to matching bracket ---Option-PageDownScroll page down滚动轴向下移动一页---Option-PageUpScroll page up滚动轴向上移动一页3.5 查找替换
Windows/LinuxMacAction描述Ctrl-FCommand-FFind查找Ctrl-HCommand-Option-FReplace替换Ctrl-KCommand-GFind next查找下一个Ctrl-Shift-KCommand-Shift-GFind previous查找上一个3.6 隐藏和展开
Windows/LinuxMacAction描述Alt-L, Ctrl-F1Command-Option-L, Command-F1Fold selection隐藏已经选择的行Alt-Shift-L, Ctrl-Shift-F1Command-Option-Shift-L, Command-Shift-F1Unfold展开Alt-0Command-Option-0Fold all隐藏所有Alt-Shift-0Command-Option-Shift-0Unfold all展开所有3.7 其他
Windows/LinuxMacAction描述Ctrl-SpaceCtrl-SpaceAutocomplete when Live Autocompletion is off Ctrl-i|Ctrl-Shift-fCommand-i|Command-Shift-fFormat selection or all格式化TabTabIndent缩进Shift-TabShift-TabOutdent删除缩进Ctrl-ZCommand-ZUndo撤销Ctrl-Shift-Z, Ctrl-YCommand-Shift-Z, Command-YRedo恢复Ctrl-/Command-/Toggle comment注释Ctrl-TCtrl-TTranspose letters Ctrl-Shift-UCtrl-Shift-UChange to lower case小写Ctrl-UCtrl-UChange to upper case大写InsertInsertOverwrite覆盖Ctrl-Shift-ECommand-Shift-EMacros replay Ctrl-Alt-E---Macros recording Delete---Delete ---Ctrl-LCenter selection游标居中3.8 设置
Windows/LinuxMacAction描述Ctrl - ,Command - ,Show the settings menu设置