File tree Expand file tree Collapse file tree 1 file changed +79
-0
lines changed
docs/cn/guides/40-load-data/04-transform Expand file tree Collapse file tree 1 file changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : 在Stage中查询ORC文件
3
+ sidebar_label : 查询ORC文件
4
+ ---
5
+
6
+ import StepsWrap from '@site/src /components/StepsWrap';
7
+ import StepContent from '@site/src /components/Steps/step-content';
8
+
9
+ ## 语法
10
+
11
+ ``` sql
12
+ SELECT [< alias> .]< column> [, < column> ...] | [< alias> .]$< col_position> [, $< col_position> ...]
13
+ FROM {@< stage_name> [/ < path > ] [< table_alias> ] | ' <uri>' [< table_alias> ]}
14
+ [(
15
+ [< connection_parameters> ],
16
+ [ PATTERN => ' <regex_pattern>' ],
17
+ [ FILE_FORMAT => ' ORC | <custom_format_name>' ],
18
+ [ FILES => ( ' <file_name>' [ , ' <file_name>' ] [ , ... ] ) ]
19
+ )]
20
+ ```
21
+
22
+ ## 教程
23
+
24
+ 在本教程中,我们将引导您完成以下步骤:下载 Iris 数据集(ORC 格式),将其上传至 Amazon S3 桶,创建外部 Stage,并直接从 ORC 文件查询数据。
25
+
26
+ <StepsWrap >
27
+ <StepContent number =" 1 " >
28
+
29
+ ### 下载 Iris 数据集
30
+
31
+ 从https://github.com/tensorflow/io/raw/master/tests/test_orc/iris.orc下载Iris数据集,然后将其上传至您的Amazon S3 桶。
32
+
33
+ Iris 数据集包含 3 类,每类 50 个实例,每类代表一种鸢尾植物。它有 4 个属性:(1) 萼片长度,(2) 萼片宽度,(3) 花瓣长度,(4) 花瓣宽度,最后一列包含类别标签。
34
+
35
+ </StepContent >
36
+ <StepContent number =" 2 " >
37
+
38
+ ### 创建外部 Stage
39
+
40
+ 创建一个外部 Stage,指向存储您的 Iris 数据集文件的 Amazon S3 桶。
41
+
42
+ ``` sql
43
+ CREATE STAGE orc_query_stage
44
+ URL = ' s3://databend-doc'
45
+ CONNECTION = (
46
+ AWS_KEY_ID = ' <your-key-id>' ,
47
+ AWS_SECRET_KEY = ' <your-secret-key>'
48
+ );
49
+ ```
50
+
51
+ </StepContent >
52
+ <StepContent number =" 3 " >
53
+
54
+ ### 查询 ORC 文件
55
+
56
+ ``` sql
57
+ SELECT *
58
+ FROM @orc_query_stage
59
+ (
60
+ FILE_FORMAT => ' orc' ,
61
+ PATTERN => ' .*[.]orc'
62
+ );
63
+ ```
64
+
65
+ ``` sql
66
+ SELECT * FROM orc_table;
67
+ ```
68
+
69
+ 这将直接从远程的 ORC 文件中检索数据。
70
+
71
+ ``` sql
72
+ SELECT
73
+ *
74
+ FROM
75
+ ' https://github.com/tensorflow/io/raw/master/tests/test_orc/iris.orc' (file_format => ' orc' );
76
+ ```
77
+
78
+ </StepContent >
79
+ </StepsWrap >
You can’t perform that action at this time.
0 commit comments