I'd like to convert an expression into its output, particularly as a series
. I
couldn't find anything in the docs for doing so. I've got the following:
import polars as pl
from polars_general_plugin import get_len_keep_odd
struct Input { | |
values: Vec<u32>, | |
weights: Vec<u32>, | |
num_items: usize, | |
capacity: u32, | |
} | |
// returns a vector containing the indices of items selected | |
fn solve_knapsack(ip: &Input) -> (u32, Vec<usize>) { | |
let mut table = Vec::with_capacity(ip.num_items + 1); |
This post goes through user Stitch SSO for python-based backends. It covers
pretty much the same ground as the
Stitch docs but uses Python
instead of browser-based Javascript. It should be of help for anyone trying to
integrate Stitch in their backend server. Before proceeding, make sure you have
both a client_id
and client_secret
- they are provided by Stitch
This is directly based on the Redpanda docs for Data Transforms link.
You should probably start from there to get a rough idea of where data transforms fit in.
The following steps are for if you want to try out transforms within a single-node docker container, e.g. as part of a testing pipeline. Some if not most of the steps can be moved into the image building stage.
Start the RedPanda container:
IMAGE_TAG_REDPANDA:='docker.redpanda.com/vectorized/redpanda:latest'
CONTAINER_TAG_REDPANDA:=redpanda-1
If you're using the neovim plugin aerial and want to override the default key bindings without modifying ftplugin/aerial.vim
, replace the keys table as follows:
require("aerial.bindings").keys = {
{ "<CR>", "<cmd>lua require'aerial'.select()<CR>", "Jump to the symbol under the cursor" },
-- and so on for the rest
}
Make sure to use the format that aerial uses in aerial/binding.lua.
Also make sure that setup
is called after, not before overriding keys
, and that default_bindings
is set to true
Credits: Jonathan Katz: Lets Build a Complex Real Time Data Management Application -- PGCon 2018
Start with the following table:
create table bookings (
id int generated by default as identity primary key,
start_time timestamptz not null,
end_time timestamptz not null,
with recursive p(hops, flights, last_stop, last_arrival, total_duration, closest, found) as ( | |
select * | |
from ( | |
select | |
array[departure_airport, arrival_airport] as hops, | |
array[flight_no] as flights, | |
arrival_airport as last_stop, | |
scheduled_arrival as last_arrival, | |
scheduled_arrival - scheduled_departure as total_duration, | |
rank() over( |
// RadixSort ... | |
// credits QuestDB impl for radix sort (7104a57) | |
// core/src/main/c/share/ooo.cpp | |
func RadixSort(array []uint64) { | |
if len(array) <= 100 { | |
insertionSort(array) | |
return | |
} | |
// counts | |
type rscounts struct { |
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func generateTopicStrings(tokens []string) (generatedTopics []string) { | |
// the expected no. of generated topics. See either of the previous | |
// gists for explanation as to why this formula is used |
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
type node struct { | |
val string | |
exact *node |