Git Product home page Git Product logo

mzfmt's People

Contributors

mjibson avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mzfmt's Issues

darwin isn't building

https://github.com/mjibson/mzfmt/actions/runs/7919361445/job/21619951773

Compiling mzfmt v0.2.3 (/github/workspace)
error: linking with `/opt/osxcross/target/bin/x86_64-apple-darwin14-clang` failed: exit status: 1
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin:/opt/osxcross/target/bin:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" ZERO_AR_DATE="1" "/opt/osxcross/target/bin/x86_64-apple-darwin14-clang" "-arch" "x86_64" "-m64" "/tmp/rustcuRw29u/symbols.o" "/github/workspace/./target/x86_64-apple-darwin/release/deps/mzfmt-c2080ca5e8ee7e49.mzfmt.2c82a2da94509c53-cgu.0.rcgu.o" "/github/workspace/./target/
...
          ld: warning: object file (/github/workspace/target/x86_64-apple-darwin/release/deps/libregex_syntax-98337405bcd5a470.rlib(regex_syntax-98337405bcd5a470.regex_syntax.60778c56f295029b-cgu.04.rcgu.o)) was built for newer macOS version (10.12) than being linked (10.8)
          Undefined symbols for architecture x86_64:
            "_getentropy", referenced from:
                std::sys::unix::rand::hashmap_random_keys::ha92d0a2687c22b7a in libstd-4b3c9502f998a9c9.rlib(std-4b3c9502f998a9c9.std.ccb858c55971878c-cgu.0.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `mzfmt` (bin "mzfmt") due to 1 previous error

No idea what's going on here. I looked around and couldn't find anything obvious. Maybe something to do with the github actions builder or the rust version used in something.

the `) AS` formatting newlines should be improved

SELECT
    origins.id,
    (
            SELECT count(*)
            FROM events
            WHERE
                (
                    (payload ->> 'foo_865' = '843' OR payload ->> 'bar_449' = '658' OR payload ->> 'qux_600' = '583') AND mz_logical_timestamp() BETWEEN (1000 * date_part('epoch', timestamp_col)::numeric) AND (1000 * date_part('epoch', timestamp_col + INTERVAL '30 days')::numeric) AND category_id = origins.category_id AND origin_id = origins.id
                )
        )
        AS foo__m4__count_30_days,
    (
            SELECT max(timestamp_col)
            FROM events
            WHERE
                (
                    (payload ->> 'foo_573' = '43' OR payload ->> 'bar_727' = '631' OR payload ->> 'qux_976' = '262') AND category_id = origins.category_id AND origin_id = origins.id
                )
        )
        AS foo__m19__max_time
FROM
    origins
        JOIN
            categories
            ON categories.id = origins.category_id
WHERE categories.type = 'foo';

correctly nest things, don't always group

SELECT
    title,
    array_agg(first_name || ' ' || last_name ORDER BY last_name)
        AS actors
FROM film
GROUP BY title;

for example is weird because the select args are nested, but the from and group by aren't. Make this consistent. Probably need to remove some inner groups?

some things to improve here

WITH
    cities (city, state, pop) AS
    (
        SELECT city, state, pop
        FROM
            (
                        VALUES
                            ('Los_Angeles', 'CA', 3979576),
                            ('Phoenix', 'AZ', 1680992),
                            ('Houston', 'TX', 2320268),
                            ('San_Diego', 'CA', 1423851),
                            ('San_Francisco', 'CA', 881549),
                            ('New_York', 'NY', 8336817),
                            ('Dallas', 'TX', 1343573),
                            ('San_Antonio', 'TX', 1547253),
                            ('San_Jose', 'CA', 1021795),
                            ('Chicago', 'IL', 2695598),
                            ('Austin', 'TX', 978908)
                    )
                    AS cities (city, state, pop)
    )
SELECT state, city
FROM
    (SELECT DISTINCT state FROM cities) AS states (state),
    LATERAL (SELECT city FROM cities WHERE state = states.state ORDER BY pop DESC LIMIT 3) AS subquery
ORDER BY state, city;

weird looking query

SELECT id, ts, status FROM (SELECT id, ts, status, LAG(status) OVER (PARTITION BY id ORDER BY ts) AS last_status FROM t) t WHERE status != last_status OR last_status IS NULL;
SELECT id, ts, status
FROM
    (
                SELECT
                    id,
                    ts,
                    status,
                    lag(status) OVER (PARTITION BY id ORDER BY ts)
                        AS last_status
                FROM t
            )
            AS t
WHERE
    status
    <> last_status
        OR
    last_status
        IS
    NULL;

Probably need to teach SELECT to de-indent things? This query looks pretty good on the cockroach site.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.