Skip to content

Tag: presto

Creating bins in presto sql – programmatically

I am new to Presto SQL syntax and and wondering if a function exists that will bin rows into n bins in a certain range. For example, I have a a table with 1m different integers that range from 1 – 100. What can I do to create 20 bins between 1 and 100 (a bin for 1-5, 6-10, 11-15

Presto – hex string to int

I’m trying to convert hex string (starts with ‘0x’) to it’s integer value using presto. For example 0x100 to 256. My hex string is called msg_id. I tried to use this- But I run into a problem, because from_hex expect even number of hex digits (0100 instead of 100). I decided to try and…

Presto create table with ‘with’ queries

typically to create a table in Presto (from existing db tables), I do: But to make my code simple, I’ve broken out subqueries like this: Where do I put the create table statement here? The actual query is more complex than the above so I am trying to avoid having to put the subqueries within the main qu…