trino-to-hive-migration

trino-to-hive-migration is a skill for Claude Code from treasure-data/td-skills. It costs 51 tokens per session (645 once invoked), scanned A, original, Apache-2.0.

A guide for converting Trino SQL to Hive SQL, where Hive is another query engine with different syntax and features.

In plain words
What is it for?
Use it to translate functions and syntax such as tdtimestring, REGEXPLIKE, and ARRAYAGG, and to choose the Hive engine.
Why use it?
It helps when a Trino query runs into memory errors or when the query needs to use Hive-specific syntax.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the sql-skills plugin — 5 skills shipped together

Good fit Use it to translate functions and syntax such as tdtimestring, REGEXPLIKE, and ARRAYAGG, and to choose the Hive engine.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/treasure-data/td-skills/trino-to-hive-migration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add treasure-data/td-skills --skill trino-to-hive-migration
Clone the repo
git clone --depth 1 https://github.com/treasure-data/td-skills

Made for: Claude Code.

Or install sql-skills, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for trino-to-hive-migration

README.md
[![agentmods](https://agentmods.dev/badge/skills/treasure-data/td-skills/trino-to-hive-migration/github.svg)](https://agentmods.dev/skills/treasure-data/td-skills/trino-to-hive-migration)
Your own site
<a href="https://agentmods.dev/skills/treasure-data/td-skills/trino-to-hive-migration"><img src="https://agentmods.dev/badge/skills/treasure-data/td-skills/trino-to-hive-migration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for trino-to-hive-migration

Your own site · 80×15
<a href="https://agentmods.dev/skills/treasure-data/td-skills/trino-to-hive-migration"><img src="https://agentmods.dev/badge/skills/treasure-data/td-skills/trino-to-hive-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 645 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.00645
Opus 5.5 $0.00020 $0.00258
Sonnet 5.5 $0.00010 $0.00129
Haiku 4.5 $0.00005 $0.00064

Measured 3mo ago against content hash cacb25159168, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

trino-to-hive-migration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

sql-skills/trino-to-hive-migration/SKILL.md · 84 lines

What it actually says

Trino to Hive Migration

When to Migrate

Use Hive when Trino fails with:

  • Query exceeded per-node memory limit
  • Query exceeded distributed memory limit
  • Processing > 1 month of data, complex multi-way JOINs, high cardinality GROUP BY

Syntax Conversion

Trino Hive
td_time_string(time, 'd!', 'JST') TD_TIME_FORMAT(time, 'yyyy-MM-dd', 'JST')
approx_distinct(col) approx_distinct(col) (Hivemall - compatible!)
approx_percentile(col, 0.95) percentile(col, 0.95)
array_agg(col) collect_list(col)
string_agg(col, ',') concat_ws(',', collect_list(col))
regexp_like(col, 'pattern') col rlike 'pattern'
Automatic small table join /*+ MAPJOIN(t) */

Example Migration

Trino (fails with memory error):

select
  td_time_string(time, 'd!', 'JST') as date,
  approx_distinct(session_id) as sessions
from events
where td_time_range(time, '2024-01-01', '2024-12-31')
group by td_time_string(time, 'd!', 'JST')

Hive (works):

select
  TD_TIME_FORMAT(time, 'yyyy-MM-dd', 'JST') as date,
  approx_distinct(session_id) as sessions
from events
where td_time_range(time, '2024-01-01', '2024-12-31', 'JST')
group by TD_TIME_FORMAT(time, 'yyyy-MM-dd', 'JST')

Engine Selection

In Digdag:

+query_trino:
  td>: queries/analysis.sql
  engine: presto

+query_hive:
  td>: queries/analysis.sql
  engine: hive

In TD Toolbelt:

td query -d database_name -T presto "SELECT ..."
td query -d database_name -T hive "SELECT ..."

Performance Tips for Hive

-- MAPJOIN hint for small tables
select /*+ MAPJOIN(small_table) */ *
from large_table l
join small_table s on l.id = s.id

-- Process in chunks for very large datasets
where td_interval(time, '-1d', 'JST')  -- Daily instead of yearly

Typical Timeline

  • Trino: Fails after 5 min with memory error
  • Hive: Completes in 20-30 min successfully
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 84 lines · 51 tokens per session scan A cacb25159168

Subscribe to this mod's changes

trino-to-hive-migration is a skill published in the GitHub repository treasure-data/td-skills (23 stars, last pushed today), licensed Apache-2.0. It adds 51 tokens to every session and 645 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

trino-to-hive-migration compared with skills from other repositories

trino-to-hive-migration next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
trino-to-hive-migrationtreasure-data/td-skillsSkill23todayApache-2.0A51Claude Code
create-prprisma/ormSkill48ktodayApache-2.0A47Claude Code, Codex
schema-explorationlangchain-ai/deepagentsSkill32ktodayMITA57Claude Code, Codex
atlas-mssqlariga/atlasSkill8.9k3d agoApache-2.0A163Claude Code
ha-data-storesshiwenwen/hope-agentSkill1.9kyesterdayMITA115Claude Code, Codex
bex-keyvaluebex-co/bexSkill1.6ktodayApache-2.0A117Claude Code, Codex
pentesting-mysqlxalgorix/xalgorixSkill1.6kyesterdayApache-2.0A65Claude Code, Codex