一、查看快捷键的方式

单击下图中问号:

 

hive 字段添加注释 hive表字段加注释_hive 字段添加注释

查看快捷键的方式.png

 

hive 字段添加注释 hive表字段加注释_Mac_02

快捷键和语法


二、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笔记本电脑没有deletehomeend键。
deletefn + Backspacehomefn + leftend: fn + right

3.1 行操作

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

插入一行

3.2 选择

Windows/Linux

Mac

Action

描述

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

 

3.3 多光标

Windows/Linux

Mac

Action

描述

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

选择光标所有地方

3.4 跳转

Windows/Linux

Mac

Action

描述

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

滚动轴向上移动一页

3.5 查找替换

Windows/Linux

Mac

Action

描述

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

查找上一个

3.6 隐藏和展开

Windows/Linux

Mac

Action

描述

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

展开所有

3.7 其他

Windows/Linux

Mac

Action

描述

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

游标居中

3.8 设置

Windows/Linux

Mac

Action

描述

Ctrl - ,

Command - ,

Show the settings menu

设置