⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k
DuckDB 2.0 ドキュメント 全文検索
per page, with , order by , clip by
Results of 1 - 10 of about 32 for series (0.003 sec.)
GROUPING SETS 12259
GROUPING SETS , ROLLUP and CUBE can be used in the GROUP BY clause to perform a grouping over multiple dimensions within the same query. Note that this syntax is not compatible with GROUP BY ALL . Examples Compute the average income along t ... ate is generated. At this point, an example might help. Consider the following query: WITH days AS ( SELECT year("generate_series") AS y, quarter("generate_series") AS q, month("generate_series") AS m FROM generate_series(DATE '2023-01-01', DATE '2023- ... GROUPING_ID() , and so on. This may become clearer by casting GROUPING_ID() to BIT : WITH days AS ( SELECT year("generate_series") AS y, quarter("generate_series") AS q, month("generate_series") AS m FROM generate_series(DATE '2023-01-01', DATE '2023- ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/grouping_sets.html
List Functions 11454
Function Description list[index] Extracts a single list element using a (1-based) index . list[begin[:end][:step]] Extracts a sublist using slice conventions . Negative values are accepted. list1 && list2 Alias for list_has_any . list1 <-> ... ement . filter(list, lambda(x)) Alias for list_filter . flatten(nested_list) Flattens a nested list by one level. generate_series(start[, stop][, step]) Creates a list of values between start and stop - the stop parameter is inclusive. grade_up(list[, ... | Flattens a nested list by one level. | | Example | flatten([[1, 2, 3], [4, 5]]) | | Result | [1, 2, 3, 4, 5] | generate_series(start[, stop][, step]) | Description | Creates a list of values between start and stop - the stop parameter is inclusive. ... | | Example | generate_series(2, 5, 3) | | Result | [2, 5] | length(list) | Description | Returns the length of the list . | | Example | length([1,2,3]) ...
https://man.mtool.work/duckdb/2.0/sql/functions/list.html
Write User Defined Functions 11196
Overview The JDBC driver can register user-defined functions (UDFs) written in Java, including scalar functions and table functions. This page covers building and registering both, from the simple functional-interface overloads to the vecto ... local-init) state so it survives across calls, rather than in a local variable. The apply below streams a bounded integer series in chunks. It also dispatches on each column's declared type with DuckDBWritableVector.getType() , which is convenient whe ... populates columns of different types: // Held in the init state so the position survives across apply() calls. final class Series { long next; final long end; Series(long end) { this.end = end; } } DuckDBFunctions.tableFunction() .withName("java_series ... ") .withParameter(long.class) .withFunction(new DuckDBTableFunction<Long, Series, Object>() { @Override public Long bind(DuckDBTableFunctionBindInfo info) throws Exception { info.addResultColumn("n", Lon ...
https://man.mtool.work/duckdb/2.0/clients/java/functions.html
Run Queries 10648
Overview DuckDB-Wasm provides functions for querying data. Queries are run sequentially: First, create a connection by calling connect . Then, run queries by calling query to materialize the whole result, or send to fetch result chunks lazi ... n = await db.connect(); // Either materialize the query result await conn.query<{ v: arrow.Int }>(` SELECT * FROM generate_series(1, 100) t(v) `); // ..., or fetch the result chunks lazily for await (const batch of await conn.send<{ v: arrow.Int }>(` S ... ELECT * FROM generate_series(1, 100) t(v) `)) { // ... } // Close the connection to release memory await conn.close(); Prepared Statements Prepared sta ... nnection const conn = await db.connect(); // Prepare the query const stmt = await conn.prepare(`SELECT v + ? FROM generate_series(0, 10_000) t(v);`); // ... and run it with materialized results await stmt.query(234); // ... or as result chunks for awai ...
https://man.mtool.work/duckdb/2.0/clients/wasm/query.html
Create Synthetic Data 10245
DuckDB lets you quickly generate synthetic datasets by combining a few building blocks: functions and clauses that generate rows , functions that generate values to fill those rows, and extensions that generate whole benchmark datasets. Thi ... , sha256 the Faker Python package via the Python function API using cross products (Cartesian products) range and generate_series The range functions turn a start, stop, and step into a table of rows, which is the usual starting point for a synthetic d ... (1, 4) t(i); ┌───────┐ │ i │ │ int64 │ ├───────┤ │ 1 │ │ 2 │ │ 3 │ └───────┘ range excludes the stop value, while generate_series includes it. VALUES The VALUES clause generates rows from literal tuples, which is convenient for a small fixed set of val ... ding values to a target length: SELECT repeat('ab', 3) AS padded; Sequences A sequence produces a monotonically increasing series of numbers. nextval('sequence_name') advances the sequence and returns the next value, while currval('sequence_name') retu ...
https://man.mtool.work/duckdb/2.0/guides/snippets/create_synthetic_data.html
Command Line Client 9714
Installation To use the DuckDB CLI client, visit the CLI installation page . The latest stable version of the DuckDB command line client is 2.0.0. Installation The DuckDB CLI (Command Line Interface) is a single, dependency-free executable. ... xample.sql is located in the same directory as duckdb.exe and contains the following SQL statement: SELECT * FROM generate_series(5); To execute it from the CLI, the .read command is used. .read select_example.sql The output below is returned to the te ... rminal by default. The formatting of the table can be adjusted using the .output or .once commands. | generate_series | |----------------:| | 0 | | 1 | | 2 | | 3 | | 4 | | 5 | Multiple commands, including both SQL and dot commands, can also ... own_to_file.sql is located in the same directory as duckdb.exe and contains the following commands: .mode markdown .output series.md SELECT * FROM generate_series(5); To execute it from the CLI, the .read command is used as before. .read write_markdown ...
https://man.mtool.work/duckdb/2.0/clients/cli/overview.html
Reading and Writing Parquet Files 9714
Examples Read a single Parquet file: SELECT * FROM 'test.parquet'; Figure out which columns/types are in a Parquet file: DESCRIBE SELECT * FROM 'test.parquet'; Create a table from a Parquet file: CREATE TABLE test AS SELECT * FROM 'test.par ... rquet); Write the results from a query to a Parquet file with specific compression and row group size: COPY (FROM generate_series(100_000)) TO 'test.parquet' (FORMAT parquet, COMPRESSION zstd, ROW_GROUP_SIZE 100_000); Export the table contents of the e ... , COMPRESSION uncompressed); Write a query to a Parquet file with zstd-compression and row group size: COPY (FROM generate_series(100_000)) TO 'row-groups-zstd.parquet' (FORMAT parquet, COMPRESSION zstd, ROW_GROUP_SIZE 100_000); Write data to an LZ4-co ... mpressed Parquet file: COPY (FROM generate_series(100_000)) TO 'result-lz4.parquet' (FORMAT parquet, COMPRESSION lz4); Or, equivalently: COPY (FROM generate_series(100_000) ...
https://man.mtool.work/duckdb/2.0/data/parquet/overview.html
Parquet Tips 9311
Below is a collection of tips to help when dealing with Parquet files. Tips for Reading Parquet Files Use union_by_name When Loading Files with Different Schemas The union_by_name option can be used to unify the schema of files that have di ... of Parquet files is not important, writing one file per thread can significantly improve performance: COPY (FROM generate_series(10_000_000)) TO 'test.parquet' (FORMAT parquet, PER_THREAD_OUTPUT); Selecting a ROW_GROUP_SIZE The ROW_GROUP_SIZE paramete ... whole file like aggregations. To write a query to a Parquet file with a different row group size, run: COPY (FROM generate_series(100_000)) TO 'row-groups.parquet' (FORMAT parquet, ROW_GROUP_SIZE 100_000); The ROW_GROUPS_PER_FILE Option The ROW_GROUPS_ ... PER_FILE parameter creates a new Parquet file if the current one has a specified number of row groups. COPY (FROM generate_series(100_000)) TO 'output-directory' (FORMAT parquet, ROW_GROUP_SIZE 20_000, ROW_GROUPS_PER_FILE 2); If multiple threads are ac ...
https://man.mtool.work/duckdb/2.0/data/parquet/tips.html
FILTER Clause 8634
The FILTER clause may optionally follow an aggregate function in a SELECT statement. This will filter the rows of data that are fed into the aggregate function in the same way that a WHERE clause filters rows, but localized to the specific ... is odd SELECT count() AS total_rows, count() FILTER (i <= 5) AS lte_five, count() FILTER (i % 2 = 1) AS odds FROM generate_series(1, 10) tbl(i); total_rows lte_five odds 10 5 5 Simply counting rows that satisfy a condition can also be achieved without ... median(i) FILTER (i % 2 = 1) AS odds_median, median(i) FILTER (i % 2 = 1 AND i <= 5) AS odds_lte_five_median FROM generate_series(1, 10) tbl(i); lte_five_sum odds_median odds_lte_five_median 15 5.0 3.0 The FILTER clause can also be used to pivot data f ... 5 THEN 2024 WHEN i <= rows * 0.875 THEN 2025 ELSE NULL END AS year FROM ( SELECT i, count(*) OVER () AS rows FROM generate_series(1, 100_000_000) tbl(i) ) tbl; “Pivot” the data out by year (move each year out to a separate column): SELECT count(i) FILT ...
https://man.mtool.work/duckdb/2.0/sql/query_syntax/filter.html
Casting 8361
Casting refers to the operation of converting a value in a particular data type to the corresponding value in another data type. Casting can occur either implicitly or explicitly. The syntax described here performs an explicit cast. More in ... supports the shorthand expr::TYPENAME , which is also present in PostgreSQL. SELECT CAST(i AS VARCHAR) AS i FROM generate_series(1, 3) tbl(i); i 1 2 3 SELECT i::DOUBLE AS i FROM generate_series(1, 3) tbl(i); i 1.0 2.0 3.0 Casting Rules Not all casts a ...
https://man.mtool.work/duckdb/2.0/sql/expressions/cast.html
PREV 1 2 3 4 NEXT
DuckDB 2.0 Documentation / man.mtool.work