This is an automated email from the ASF dual-hosted git repository. dzamo pushed a commit to branch gh-pages in repository https://gitbox.apache.org/repos/asf/drill.git
commit cfd7ee0e520df68c2f16dea4406948ce71dc7dd0 Author: James Turton <ja...@somecomputer.xyz> AuthorDate: Thu May 6 15:28:18 2021 +0200 Add LMT (last modified time) to the implicit columns returned for files. --- .../005-querying-a-file-system-introduction.md | 61 +++++++++++----------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/_docs/query-data/query-a-file-system/005-querying-a-file-system-introduction.md b/_docs/query-data/query-a-file-system/005-querying-a-file-system-introduction.md index c9f4eb8..b45b882 100644 --- a/_docs/query-data/query-a-file-system/005-querying-a-file-system-introduction.md +++ b/_docs/query-data/query-a-file-system/005-querying-a-file-system-introduction.md @@ -3,6 +3,7 @@ title: "Querying a File System Introduction" slug: "Querying a File System Introduction" parent: "Querying a File System" --- + Files and directories are like standard SQL tables to Drill. You can specify a file system "database" as a prefix in queries when you refer to objects across databases. In Drill, a file system database consists of a storage plugin name @@ -22,54 +23,52 @@ more information. Drill supports the following file types: - * Plain text files, including: - * Comma-separated values (CSV, type: text) - * Tab-separated values (TSV, type: text) - * Pipe-separated values (PSV, type: text) - * Structured data files: - * [Avro]({{site.baseurl}}/docs/querying-avro-files/) (type: avro) - * [JSON]({{site.baseurl}}/docs/querying-json-files/) (type: json) - * [Parquet]({{site.baseurl}}/docs/querying-parquet-files/) (type: parquet) +- Plain text files, including: + - Comma-separated values (CSV, type: text) + - Tab-separated values (TSV, type: text) + - Pipe-separated values (PSV, type: text) +- Structured data files: + - [Avro]({{site.baseurl}}/docs/querying-avro-files/) (type: avro) + - [JSON]({{site.baseurl}}/docs/querying-json-files/) (type: json) + - [Parquet]({{site.baseurl}}/docs/querying-parquet-files/) (type: parquet) The extensions for these file types must match the configuration settings for your registered storage plugins. For example, PSV files may be defined with a -`.tbl` extension, while CSV files are defined with a `.csv` extension. +`.tbl` extension, while CSV files are defined with a `.csv` extension. + +## Implicit Columns + +Drill 1.8 introduces implicit columns. Implicit columns provide file information, such as the directory path to a file and the file extension. You can query implicit columns in files, directories, nested directories, and files. + +The following table lists the implicit columns available and their descriptions: -## Implicit Columns -Drill 1.8 introduces implicit columns. Implicit columns provide file information, such as the directory path to a file and the file extension. You can query implicit columns in files, directories, nested directories, and files. +| Implicit Column Name | Description | +| -------------------- | -------------------------------------------------------------------------------------- | +| FQN | The fully qualified name. Contains the full path to the file, including the file name. | +| FILEPATH | The full path to the file, without the file name. | +| FILENAME | The file name with the file extension. Does not include the path to the file. | +| SUFFIX | The file suffix without the dot (.) at the beginning. | +| LMT | The last modification time of the file as recorded by the containing file system | -The following table lists the implicit columns available and their descriptions: - -| Implicit Column Name | Description | -|------------------------|--------------------------------------------------------------------------------------------| -| FQN | The fully qualified name. Contains the full path to the file, including the file name. | -| FILEPATH | The full path to the file, without the file name. | -| FILENAME | The file name with the file extension. Does not include the path to the file. | -| SUFFIX | The file suffix without the dot (.) at the beginning. | +To access implicit columns, you must explicitly include the columns in a query, as shown in the following example: -To access implicit columns, you must explicitly include the columns in a query, as shown in the following example: + 0: jdbc:drill:zk=local> SELECT fqn, filepath, filename, suffix FROM dfs.`/dev/data/files/test.csvh` LIMIT 1; - 0: jdbc:drill:zk=local> SELECT fqn, filepath, filename, suffix FROM dfs.`/dev/data/files/test.csvh` LIMIT 1; - |-------------------------------------|--------------------------|---------------|----------------| | fqn | filepath | filename | suffix | |-------------------------------------|--------------------------|---------------|----------------| | /dev/data/files/test.csvh | /dev/data/files | test.csvh | csvh | - |-------------------------------------|--------------------------|---------------|----------------| + |-------------------------------------|--------------------------|---------------|----------------| -{% include startnote.html %}If a table has a column with the same name as an implicit column, such as “suffix,” the implicit column overrides the table column.{% include endnote.html %} +{% include startnote.html %}If a table has a column with the same name as an implicit column, such as “suffix,” the implicit column overrides the table column.{% include endnote.html %} -If a column name has the same name as an implicit column, you can change the default implicit column name using the [ALTER SYSTEM|SESSION SET]({{site.baseurl}}/docs/alter-system/) command with the appropriate parameter, as shown in the following example: +If a column name has the same name as an implicit column, you can change the default implicit column name using the [ALTER SYSTEM|SESSION SET]({{site.baseurl}}/docs/alter-system/) command with the appropriate parameter, as shown in the following example: - ALTER SYSTEM SET `drill.exec.storage.implicit.suffix.column.label` = appendix; + ALTER SYSTEM SET `drill.exec.storage.implicit.suffix.column.label` = appendix; -Use the following configuration options to change the default implicit column names: +Use the following configuration options to change the default implicit column names: drill.exec.storage.implicit.fqn.column.label drill.exec.storage.implicit.filepath.column.label drill.exec.storage.implicit.filename.column.label drill.exec.storage.implicit.suffix.column.label - - - -