问题标签 [trino]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
377 浏览

presto - 从 Athena/Presto 中的 JSON 中提取对象值

我有一个包含JSON对象的列。我需要从这些对象中提取所有值。问题是键不固定并且包含一些 id,所以我无法通过确切的键值提取值。这是一个例子:

所以我想得到一个数组:

Presto 对 JSONPath 的支持有限,$.*无法正常工作。有什么解决方法吗?

0 投票
1 回答
1079 浏览

hive - 通过 prestosql 创建 Hive 表时如何指定 SERDEPROPERTIES 和 TBLPROPERTIES

我正在尝试按照Hive 连接器的示例来创建配置单元表。我可以编写 HQL 通过直线创建表。但想知道如何通过 prestosql 制作它。

给定表

  1. 如何指定SERDEPROPERTIES喜欢separatorCharquoteChar
  2. 如何指定TBLPROPERTIES喜欢skip.header.line.count
0 投票
2 回答
683 浏览

sql - 无法运行简单的 presto shell 查询

我正在尝试运行最简单的查询。但是它不起作用。

但是 --file 选项工作正常

有任何想法吗?UPD:试图逃避';' 带反斜杠没有帮助(

0 投票
1 回答
904 浏览

kubernetes - Presto 313 密码验证器。属性不适用于文件

我正在 K8s 中运行 presto,我正在尝试为服务启用基于文件的身份验证(使用此作为指南https://prestosql.io/docs/current/security/password-file.html)。但是,当应用程序启动时,我收到一条错误消息:

java.lang.IllegalStateException:密码验证器文件未注册

配置属性

密码验证器.properties

配置的其余部分看起来非常正常,所以有人知道我在这里可能错过了什么吗?谢谢,

0 投票
1 回答
8997 浏览

window-functions - Difference between "ROWS BETWEEN" and "RANGE BETWEEN" in (Presto) window function "OVER" clause

This question is primarily about older versions of PrestoSQL, which have been resolved in the (now renamed) Trino project as of versions 346. However, Amazon's Athena project is based off of Presto versions 0.217 (Athena Engine 2) and 0.172 (Athena Engine 1), which does have the issues described below. This question was written specifically around Athena Engine 1 / PrestoSQL version 0.172

Questions (tl;dr)

  1. What is the difference between ROWS BETWEEN and RANGE BETWEEN in Presto window Functions?
    • Are these just synonyms for each other, or are there core conceptual differences?
    • If they are just synonyms, why does ROWS BETWEEN allow more options than RANGE BETWEEN?
  2. Is there a query scenario where it's possible to use the exact same parameters on ROWS BETWEEN and RANGE BETWEEN and get different results?
    • If using just unbounded/current row, is there a scenario where you'd use RANGE instead of ROWS (or vice-versa)?
  3. Since ROWS has more options, why isn't it mentioned at all in the documentation? o_O

Comments

The presto documentation is fairly quiet about even RANGE, and doesn't mention ROWS. I haven't found many discussions or examples around window functions in Presto. I'm starting to set through the Presto code-base to try to figure this out. Hopefully someone can save me from that, and we can improve the documentation together.

The Presto code has a parser and test cases for the ROWS variant, but there's no mention in the documentation of ROWS.

The test cases I found with both ROWS and RANGE don't test anything different between the two syntaxes.

They almost look like synonyms, but they do behave differently in my testing, and have different allowed parameters and validation rules.

The following examples can be run with the starburstdata/presto Docker image running Presto 0.213-e-0.1. Typically I run Presto 0.172 through Amazon Athena, and have almost always ended up using ROWS.

RANGE

RANGE seems to be limited to "UNBOUNDED" and "CURRENT ROW". The following returns an error:

range between 1 preceding and 1 following

ERROR: Window frame RANGE PRECEDING is only supported with UNBOUNDED

The following range syntaxes do work fine (with expected differing results). All following examples based on the above query, just changing the range

range between unbounded preceding and current row

range between current row and unbounded following

range between unbounded preceding and unbounded following

ROWS

The three working examples for RANGE above all work for ROWS and produce identical output.

output omitted - identical to above

However, ROWS allows for far more control, since you can also do the syntax above that fails with range:

rows between 1 preceding and 1 following

rows between current row and 1 following

rows between 5 preceding and 2 preceding

0 投票
1 回答
49 浏览

presto - PrestoSql DistributedExecutionPlanner.Visitor中DynamicFilters的作用是什么?

DynamicFiltersPrestoSql 中的功能是什么DistributedExecutionPlanner.Visitor

0 投票
1 回答
182 浏览

mongodb - 通过 PrestoDB 从 MongoDB ObjectId 获取时间戳

我正在使用 PrestoDB 查询一些 MongoDB 集合。MongoDB 有一种getTimestamp() 方法来获取 ObjectId 的时间戳部分。如何在 PrestoDB 上获得类似的时间戳?

0 投票
0 回答
209 浏览

mongodb - 如何在 PrestoDB/PrestoSQL 上读取 MongoDB DBRef?

MongoDB 使用DBRefs从一个文档到另一个文档的引用(类似于外键),这些就像具有两部分的其他属性,它们引用的集合的名称($ref)和它们引用Id的文档的名称($id)。

它们都以 开头$,查询集合时不会自动拾取这些 DBRef。

我在_schema集合中手动定义它们,如下所示:

但它在查询时抛出异常。我正在使用 PrestoDB v0.232,但计划迁移到 PrestoSQL。

有没有办法阅读这些领域?

更新: 我尝试迁移到 PrestoSQL 最新版本 (331) 并使用",如下所示:

并且该列开始显示在查询中,但内容始终为空。也尝试过,'但在这种情况下得到了这个例外:

0 投票
0 回答
683 浏览

sql - 在序列函数 PrestoSQL 中使用子查询

用例 - 我正在尝试从数据集中查找客户的每周频率。现在,并非所有客户在所有几周内都发生了“事件”,我需要在“计数”列中用零值填充它们。

我试图使用 PrestoSQL 的序列函数来做到这一点。但是,这需要我从客户的订单本身中获取 max week 的值(我不想硬编码,因为结果将进入 BI 工具,我不想每周手动更新)

Presto 抱怨这句话——

任何线索如何做到这一点?

0 投票
1 回答
441 浏览

presto - 在 prestosql/presto 容器中创建目录/模式/表

我想使用 prestosql/presto 容器进行自动化测试。为此,我希望能够以编程方式创建目录/模式/表。不幸的是,我没有通过 docker 环境变量找到该选项。如果我尝试通过 jdbc 连接器执行此操作,我会收到以下错误:“此连接器不支持创建表”

如何使用 prestosql/presto 容器创建模式或表?