Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor prql-java and add JDBC driver #1929

Closed
wants to merge 0 commits into from
Closed

Conversation

zhicwu
Copy link

@zhicwu zhicwu commented Feb 22, 2023

Closes #1643

Hi @max-sixty / @snth, could you help on the following items?

  • error handling in prql-java/prql-api/src/main/rust/src/lib.rs - now a simple query fr0m table will crash the JVM
  • build multi-platform native binaries in .github/workflows/build-java.yaml so that we can pack into JDBC driver and publish for others to use - for testing or demonstration, you may use prqlc command line instead
  • sonatype account, registered maven group id org.prqllang, and gpg key for publishing signed artifacts to maven central
  • misc
    • beautiful PRQL logos, which will be later added into DBeaver - examples
    • platform to support - I only added mac, windows, and linux in the build file, but it's up to you on platforms should be supported
    • official docker image containing prqlc, I assume it's prql/prql in current implementation but it might be different

Key changes:

  • prql-api module for JNI(call rust lib) and CLI(wrapper of prqlc) integration
  • prql-jdbc module is the JDBC wrapper
  • rust lib is moved to prql-java/prql-api/src/main/rust

Build instructions:

cd prql-java
mvn clean package
# if you don't have Java and maven installed, try below using docker(should be similar using podman)
# docker run --rm -it  -v `pwd`:/data -w /data maven:3-openjdk-17-slim mvn clean package
ls -alF prql-jdbc/target/prql-jdbc-0.5.0-SNAPSHOT.jar

To use in DBeaver:

  1. Add JDBC driver in Database -> Driver Manager -> New
    image
    image
    Note: driver class is org.prqllang.jdbc.PrqlDriver.

  2. Create new connection for testing
    image
    image

  1. Issue query
    I hope you're not surprised that both PRQL and SQL will work. This is because 1) sometimes the underlying JDBC driver may issue SQL query so that wrapper has to support; 2) PRQL does not support DDL and mutation, so it's more convenient to support both instead of openning two windows one for PRQL and the other for SQL.
    As to the error message shown below, it's not friendly for PRQL user, so I'll add an option later to override that(show PRQL compilation error instead).
    image

@zhicwu zhicwu marked this pull request as draft February 22, 2023 14:21
@zhicwu zhicwu changed the title Refactor prql-java feat: refactor prql-java and add JDBC driver Feb 22, 2023
Copy link
Member

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @zhicwu !

It's difficult for me to review the Java as I don't know it well.

Could we ensure we've included links to files that we've taken from elsewhere? Same for noting the files that are autogenerated.

Are the tests running in CI?

prql-java/README.md Outdated Show resolved Hide resolved

| Database | Dialect | JDBC Driver | Connection String |
| ---------- | ---------- | ----------- | ----------------------------- |
| ClickHouse | clickhouse | | jdbc:prql:ch:http://localhost |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only DB that's currently supported, or it's a draft list?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I was too lazy as I only tried on ClickHouse and SQLite. It should work for all JDBC-compatible databases. It's going to be a long list but I'll document a few more after testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No prob! Fine to leave it as a TODO! As long as we're transparent about the current state it's fine to make incremental progress...

.github/workflows/build-java.yaml Outdated Show resolved Hide resolved
.github/workflows/build-java.yaml Outdated Show resolved Hide resolved
@max-sixty
Copy link
Member

Also just saw the full PR description, I'll respond to that now

};

let rs_sql_str: String =
prql_compiler::compile(&prql_query, &option).expect("Couldn't compile query to SQL!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re your question on handling errors — my guess is that here we need to instruct it to throw the error in Java with something like (from your link): jni-rs/jni-rs#154 (comment)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm asking for your help. I brought a book and just started to read tutorials created for Java developers, but it's going to take a while for me enhance the code. Appreciate if you can take care of changes on rust side, thanks in advance!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can likely have a look soon. But I'll need to get a Java environment set up, and I do most of my coding on the weekend.

In the meantime, I think something like this should at least raise a simple error:

Suggested change
prql_compiler::compile(&prql_query, &option).expect("Couldn't compile query to SQL!");
prql_compiler::compile(&prql_query, &option).unwrap_or(env.throw_new("java/lang/RuntimeException", "Query error (TODO a better description)"));

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but it generates compile error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhicwu this is one approach — I'm not sure it's great, but it works OK:

diff --git a/prql-java/prql-api/src/main/rust/src/lib.rs b/prql-java/prql-api/src/main/rust/src/lib.rs
index c711961..58c67d9 100644
--- a/prql-java/prql-api/src/main/rust/src/lib.rs
+++ b/prql-java/prql-api/src/main/rust/src/lib.rs
@@ -48,11 +48,23 @@ pub extern "system" fn Java_org_prqllang_internal_JniImpl_compile0<'local>(
         signature_comment,
     };
 
-    let rs_sql_str: String =
-        prql_compiler::compile(&prql_query, &option).expect("Couldn't compile query to SQL!");
-    env.new_string(rs_sql_str)
-        .expect("Couldn't create java string!")
-        .into_raw()
+    match prql_compiler::compile(&prql_query, &option) {
+        Ok(sql) => env
+            .new_string(sql)
+            .expect("Couldn't create java string!")
+            .into_raw(),
+        Err(e) => {
+            env.throw_new(
+                "java/lang/RuntimeException",
+                format!("Query error: {}", e).as_str(),
+            )
+            .unwrap();
+
+            // TODO: can we return something more meaningful than an empty
+            // string? Are there better docs than https://github.com/jni-rs/jni-rs/issues/154?
+            env.new_string("").unwrap().into_raw()
+        }
+    }
 }
 
 #[no_mangle]

@max-sixty
Copy link
Member

Hi @max-sixty / @snth, could you help on the following items?

* [ ]  error handling in `prql-java/prql-api/src/main/rust/src/lib.rs` - now a simple query `fr0m table` will crash the JVM

I added a comment above, I think we can call something on the rust side to throw an error in Java rather than crashing the JVM. I can look more later if needed

* [ ]  build multi-platform native binaries in `.github/workflows/build-java.yaml` so that we can pack into JDBC driver and publish for others to use - for testing or demonstration, you may use prqlc command line instead

Yes, are there other projects that do this? Often this is the sort of thing we take from other libraries.

It looks like it's working on Ubuntu, is that correct? But not yet on Windows.

* [ ]  sonatype account, registered maven group id `org.prqllang`, and gpg key for publishing signed artifacts to maven central

Yes, I can do this later, and add them to the repo

@zhicwu
Copy link
Author

zhicwu commented Feb 23, 2023

I think we can call something on the rust side to throw an error in Java rather than crashing the JVM. I can look more later if needed.

Exactly. The was link is probably outdated. You may check more in https://github.com/exonum/exonum-java-binding. The idea is to throw a Java exception(java.lang.IllegalArgumentException if the PRQL is invalid, or java.lang.IllegalStateException if somehow failed to compile a valid query) with meaningful error message.

Yes, are there other projects that do this? Often this is the sort of thing we take from other libraries.

zstd-jni was the one I mentioned earlier but I didn't find a rust project, until I realized Deno is written in rust :)

It looks like it's working on Ubuntu, is that correct? But not yet on Windows.

Just tried to rebuild failed jobs at my end. Windows is the only one failing according to https://github.com/zhicwu/prql/actions/runs/4243658539, which is probably due to a naming issue - it's libprql_java*.* on mac and linux, but maybe prql_java.dll on windows.

Yes, I can do this later, and add them to the repo

Thank you. Please use the same repository secrets as used in build_java.yaml, if there's no concern.

@zhicwu
Copy link
Author

zhicwu commented Feb 23, 2023

Hmm... the build will never success as pre-commit kept replacing testng to testing - it's not a type but a popular testing framework :)

max-sixty added a commit to max-sixty/prql that referenced this pull request Feb 23, 2023
max-sixty added a commit that referenced this pull request Feb 23, 2023
@snth
Copy link
Member

snth commented Feb 23, 2023

Thank you @zhicwu . This looks great!

I was going to say that I don't have a java environment setup but I see you already thought of that with your docker command:
docker run --rm -it -v $(pwd):/data -w /data maven:3-openjdk-17-slim mvn clean package

I will give that a try.

@max-sixty
Copy link
Member

Hmm... the build will never success as pre-commit kept replacing testng to testing - it's not a type but a popular testing framework :)

FYI I fixed this!

@zhicwu
Copy link
Author

zhicwu commented Feb 23, 2023

I will give that a try.

In addition to build by yourself, you may download JDBC driver(bundled with JNI libs for macos, windows and linux) at https://github.com/zhicwu/prql/actions/runs/4257825932 - scroll down to bottom and download prql-jdbc in Artifacts list, unzip and prql-jdbc-0.5.0-SNAPSHOT.jar is the driver.

prql-java/README.md Outdated Show resolved Hide resolved
Comment on lines 43 to 48
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded

Suggested change
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Is matrix.target unneeded too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to put the target in the cargo command, just like you do above: https://github.com/PRQL/prql/pull/1929/files#diff-787cc4dbb3b51e6d39655bfc50bee79b4b6c34a7d629402d34342ebd0e878549R60

Unfortunately actions-rs/toolchain@v1 isn't maintained, and doesn't bring much benefit above the standard runner now. So we just use the standard runner and pass the target.

@max-sixty
Copy link
Member

@zhicwu this is looking really good. Thanks for adding tests.

Is there somewhere that describes where the Java code comes from? Is lots of it autogenerated? Could we explain that in the readme?

@max-sixty
Copy link
Member

I will give that a try.

If you can @snth, this would be great. Otherwise I can this weekend...

@zhicwu
Copy link
Author

zhicwu commented Feb 25, 2023

Is there somewhere that describes where the Java code comes from? Is lots of it autogenerated? Could we explain that in the readme?

Did you mean prql-jdbc? VSCode helped to generate empty methods but I had to fill in all the blanks :) Do you want me to add author and copyright to each of the files?

Understood it's time-consuming to review a PR with a few thousands line of code. Do you think it's better to meet on Slack so that I can walk you through? And you may want to review the features implemented so far as well.

@max-sixty
Copy link
Member

max-sixty commented Feb 25, 2023

Did you mean prql-jdbc? VSCode helped to generate empty methods but I had to fill in all the blanks :) Do you want me to add author and copyright to each of the files?

For example, this file: prql-java/prql-api/src/main/java/org/prqllang/internal/Utils.java. Thanks for adding one link there for a function that was taken from Netty. What about the remainder of the file? We don't have to hit 100% on every piece of code, but if there are large amounts of code that we've copied then it's helpful for future contributors to know where it came from.

VSCode helped to generate empty methods but I had to fill in all the blanks

How about prql-java/prql-jdbc/src/main/java/org/prqllang/jdbc/PrqlCallableStatement.java? Or the 1000 line file prql-java/prql-jdbc/src/main/java/org/prqllang/jdbc/PrqlResultSet.java. It looks auto-generated — but maybe it was lots of typing? 😄

If it was auto-generated, let's make a note, so someone knows not to edit it, and how to generate it again.

We can put the details at the top of a file, or in the Readme.


I recognize this is 5K lines of Java, and we have 20K lines of Rust, so it'll be a big part of the repo, and so it's helpful to know where stuff comes from.

Is that reasonable? I'm really not trying to create more work, I very much appreciate the contribution.


Do you want me to add author and copyright to each of the files?

I'm not sure of the exact rules here. If the original file has a notice, we shouldn't remove it. But I don't think we need to write new copyright notices on everything we copy.

I'm asking because it helps the maintenance of this repo.


Re Slack — what timezone are you on? I'm on PT. We can set something up if we need to discuss live. I'm not really on IM platforms most of the day though.


Thank you @zhicwu !

@zhicwu
Copy link
Author

zhicwu commented Feb 27, 2023

What about the remainder of the file?

That'd be me :)

It looks auto-generated — but maybe it was lots of typing?

Yes, methods were initially generated by VSCode, but I have to implement each of the methods - that's why I said it's not complex but do have some workload ;)

Is that reasonable? I'm really not trying to create more work, I very much appreciate the contribution.

Of course and I totally understand. Does it make sense to create a separate repo for prql-java or just prql-jdbc?

I'm not sure of the exact rules here. If the original file has a notice, we shouldn't remove it. But I don't think we need to write new copyright notices on everything we copy.

As far as I know, many opensource projects under Apache 2.0 license have copyright header in each source file, but it's really up to you. I was just trying to align with what we have here.

Re Slack — what timezone are you on? I'm on PT. We can set something up if we need to discuss live. I'm not really on IM platforms most of the day though.

I'm on China Standard Time(UTC +8), so probably we can meet at early morning my time before I head to work or weekend.

@max-sixty
Copy link
Member

Yes, methods were initially generated by VSCode, but I have to implement each of the methods - that's why I said it's not complex but do have some workload ;)

Oh right — so lots of typing from you!

Could we just add at the top of the file that that was how it was created? This is the sort of explanation I was hoping for.

Same for files like https://github.com/PRQL/prql/pull/1929/files#diff-3ceb4a7cb5c600632a0681b0ef28bea171f39e43c8e8a4db7c16b840d2a37f76R1. So if someone else came along and wanted to make a small change, they would have some context on the origin and purpose of the code.


No need to make a separate repo (unless you have a strong preference to, in which case that would be OK)

And I think we're all fine on the licenses. If there's any code that's copied from elsewhere, we should link to it, but otherwise great.


I'm on China Standard Time(UTC +8), so probably we can meet at early morning my time before I head to work or weekend.

How about this coming weekend? I'm 16 hours behind, so anytime your morning?

@linux-china
Copy link
Contributor

A question here, how to handle parameters in PreparedStatement? Now ? is not legal parameter placeholder in PRQL.

PreparedStatement stmt = conn.prepareStatement("from employee | filter name == ?");
//  SELECT * FROM employee WHERE name = ?
stmt.setString(1, "John");

I wrote an issue here: #1987

@zhicwu
Copy link
Author

zhicwu commented Feb 28, 2023

Since C ABI was implemented in prql-lib, it's probably better to use JNA instead(10 times slower than direct JNI in general), with no additional rust code.

As to JDBC wrapper, I'll create a separate repo for that as it can be extended to support more query languages in addition to SQL and PRQL, for instance (schemaless) GraphQL.

@max-sixty
Copy link
Member

As to JDBC wrapper, I'll create a separate repo for that as it can be extended to support more query languages in addition to SQL and PRQL, for instance (schemaless) GraphQL.

Ok great, this could be a nice project.

I thought it was a great idea to have this for PRQL; the PRQL project could still help spread the word about it if you create a different repo.


What are good next steps for the prql-api module? Would it be helpful to chat at the weekend?

@snth let us know if you got a chance to try this out; otherwise I'll spend some time testing it.

@zhicwu
Copy link
Author

zhicwu commented Feb 28, 2023

I thought it was a great idea to have this for PRQL; the PRQL project could still help spread the word about it if you create a different repo.

That's very kind of you! And sorry for constantly changing my opinion. It's all started when I was trying to add PRQL into ClickHouse JDBC driver as preferred language(instead of SQL) for manipulating data from multiple external datasources, and then I realized it's probably better to make it a JDBC wrapper to bring PRQL to all JDBC drivers, not just ClickHouse. Now I think it can be further abstracted to support more query languages in the same way. I'm going to add GraphQL in the next following days for PoC and release the first version in case others may interest.

What are good next steps for the prql-api module?

I tried #1971 implemented by @linux-china and it works well, but maybe we don't need additional rust code for consistency, that's why I was thinking JNA even it's a bit slow. Or we probably need both and let user to choose. Let me add JNA implementation later today for comparison.

Would it be helpful to chat at the weekend?

Yes, let's meet in the coming weekend. Ping me on Slack when you're available.

@max-sixty
Copy link
Member

max-sixty commented Mar 1, 2023

Yes, let's meet in the coming weekend. Ping me on Slack when you're available.

OK, is there a good Slack workspace or should I create a new one?

(For anyone reading this — I don't think we have enough folks to be generally split across Discord & Slack, this is just for a single conversation)

@zhicwu
Copy link
Author

zhicwu commented Mar 1, 2023

OK, is there a good Slack workspace or should I create a new one?

This is the invite of my personal workspace, but you may create yours or an official workspace for PRQL :)

@max-sixty
Copy link
Member

OK great, I joined and will be around this weekend. If I'm not on, feel free to ping me on GH, or Discord if you get access.

Something that would be good to think about — what could we merge from this work to make incremental progress. There's a lot of code here, lots looks very good. There are lots of tests, and it publishes to Maven, and the API looks quite complete. The code is high quality — I just made a change in #1971 and then I see the code is already here at https://github.com/PRQL/prql/pull/1929/files#diff-d661b1ff3ea2758cbe9719c1ce84e1f2a4280b48ee645533466fb8e3f5dd3a2bR34.

So it would be great to merge some of this, even if the JDBC driver becomes separate. Could we start merging the parts that are easier / pass tests?

@linux-china
Copy link
Contributor

@zhicwu I think we should use more parameters instead of Option class for JNI method. Option object requires more invocations between Java and JNI, and not good for performance. If you want to make API clean, and you can wrap up a new PRQL class to call JNI.

#[no_mangle]
#[allow(non_snake_case)]
pub extern "system" fn Java_org_prqllang_internal_JniImpl_compile0<'local>(
    mut env: JNIEnv<'local>,
    _class: JClass<'local>,
    query: JString<'local>,
    option: JObject<'local>,
) -> jstring {
}

Parameters instead of Option object.

#[no_mangle]
#[allow(non_snake_case)]
pub extern "system" fn Java_org_prql_prql4j_PrqlCompiler_toSql(
    env: JNIEnv,
    _class: JClass,
    query: JString,
    target: JString,
    format: jboolean,
    signature: jboolean,
) -> jstring {

# -Dmaven.wagon.rto=30000
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
# nexus_username: ${{ secrets.SONATYPE_USER }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into getting a username & password. But:

  • I see that the action has been archived. Are there any alternatives?
  • Are you familiar with how to get a Sonatype login? I can look more if not, but I couldn't immediately find how to get one.

@zhicwu
Copy link
Author

zhicwu commented Mar 1, 2023

Option object requires more invocations between Java and JNI, and not good for performance. If you want to make API clean, and you can wrap up a new PRQL class to call JNI.

Thanks @linux-china for pointing that out! It was a copy-n-paste without thinking :p Yes, there's a PrqlCompileOptions for the same purpose.

@linux-china
Copy link
Contributor

@zhicwu could you share your prql-jdbc? It's good implementation for PRQL over JDBC. I can not find the code on your fork. thanks.

@zhicwu
Copy link
Author

zhicwu commented Mar 6, 2023

@zhicwu could you share your prql-jdbc? It's good implementation for PRQL over JDBC. I can not find the code on your fork. thanks.

Sorry I discarded all the changes trying to come up with a new PR for pushing prql-java to maven central. I'll create a personal repo jdbc-wrapper for the JDBC implementation. Will update here once it's released.

@linux-china
Copy link
Contributor

@zhicwu I got your code from commit, and it works well.

Snip20230306_94

@zhicwu
Copy link
Author

zhicwu commented Mar 6, 2023

@zhicwu I got your code from commit, and it works well.

Thanks @linux-china. It has glitches handling jni and cli, and the driver does not support dialect mapping. I fixed some of the issues and tried schemaless graphql for testing. Will add a few more changes(e.g. templating and scripting etc.) before publishing to maven central.

max-sixty added a commit that referenced this pull request Mar 8, 2023
* chore: Add changelog template for 0.5.3 (#1892)

* feat!: loop (#1642)

* feat: Generate C header file for prql-lib (#1879)

* fix: website tests (#1894)

* feat(prqlc)!: preprocess Jinja templates (#1722)

* docs: Fix "LSP server" (#1896)

Fix "LSP server"

* docs: Added C header file (#1898)

Added C header file

* revert: "feat!: loop" (#1899)

Revert "feat!: loop (#1642)"

This reverts commit c79c5f1.

* revert: #1894 (#1901)

(Possibly fixing would have been easier, sorry if this is creating more work. I do think running all tests is worthwhile with this sort of wide-ranging change...)

* test: Refactor book snapshot tests (#1900)

* tests: Refactor book snapshot tests

Modularizes these tests, potentially in preparation for #1895

* revert: test: Refactor book snapshot tests (#1903)

Revert "test: Refactor book snapshot tests (#1900)"

This reverts commit abc61ff.

* build: Disable prql-elixir on Mac (#1902)

* build: Disable prql-elixir on Mac

A temporary pause on building `prql-elixir` on Mac, as it's causing some build caching issues, as described in the Readme

There are lots of ways to re-enable when we're ready.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* test: Refactor book snapshot tests (#1904)

* test: Refactor book snapshot tests

Re-reverting #1900

* build: use released minijinja (#1906)

* refactor: Options as &Options (#1905)

* refactor: Options as &Options

Not sure if this is worthwhile — I started in one function and then kept on replacing. Fine to close if not an improvement.

* .

* chore: pre-commit autoupdate (#1908)

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.246 → v0.0.248](astral-sh/ruff-pre-commit@v0.0.246...v0.0.248)
- [github.com/pre-commit/mirrors-mypy: v1.0.0 → v1.0.1](pre-commit/mirrors-mypy@v1.0.0...v1.0.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: Add a doc on `prql-elixir` on Mac (#1909)

* docs: Add a doc on `prql-elixir` on Mac

* ci: Run non-core tests through `test-all.yaml` (#1911)

* ci: Run non-core tests through `test-all.yaml`

As pointed out in https://github.com/PRQL/prql/pull/1860/files#r1112279486, we're currently running these tests twice — once because they're in the `test-all.yaml` workflow, which is called on `main` commits, and once because they're called on `main` themselves.

This disables them being called by `main` commits.

It's possible the existing mode is required to generate caches; let's try disabling and assess, though.

* build: Add PHP binding (#1860)

* Update README.md

* Create php.md

* Create .gitignore

* Add files via upload

* Update composer.json

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update composer.json

* Update Compiler.php

* Update prql-php/.gitignore

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Add composer lock file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Create test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update composer.json

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update composer.json

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Uncomment unit tests

* Pass test dir as args

* Bootstrap the autoloader

* Build library and copy library file

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Update test-php.yaml

* Add more unit tests

* Update CompilerTest.php

* Update test-php.yaml

* Update CompilerTest.php

* Update test-php.yaml

* Add test-php

* Add concurrency thing

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Remove php-actions/phpunit

* Update .github/workflows/test-php.yaml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>

* chore: Add PHP bindings changelog (#1914)

Add PHP bindings

* build: Package prqlc as .deb package (#1883)

* Create create-deb.yaml

* Update create-deb.yaml

* Update create-deb.yaml

* Update create-deb.yaml

* Add build-deb-package job

* Delete create-deb.yaml

* Update .github/workflows/release.yaml

* Update .github/workflows/release.yaml

* Update .github/workflows/release.yaml

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>

* test: Add `--quiet` to fast-loop taskfile command (#1916)

Otherwise cargo lists the name of every test; very verbose IMO.

* build: Package`prqlc` as Snap (#1881)

* Create snapcraft.yaml

* Update snapcraft.yaml

* Create publish-snap.yaml

* Update publish-snap.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update prql-compiler/snap/snapcraft.yaml

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update publish-snap.yaml

* Update snapcraft.yaml

* Update and rename prql-compiler/snap/snapcraft.yaml to snap/snapcraft.yaml

* Update publish-snap.yaml

* Update snap/snapcraft.yaml

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Add step to build and publish Snap

* Delete publish-snap.yaml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* chore: Add changelog for #1883 (#1920)

As requested by @vanillajonathan.

@vanillajonathan one thing we could add for all these is to upload them as artifacts, as an easy way to have them published, using something like #1883 (comment).

It's less permanent than publishing them as release assets, but we can do the artifact upload now without changing our release process.

* chore: Add Snap package changelog (#1921)

* Add Snap package

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* build: Package prqlc as .rpm package (#1918)

* Create create-rpm.yaml

* Update create-rpm.yaml

* Add job for building .rpm package

* Delete create-rpm.yaml

* Update .github/workflows/release.yaml

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update .github/workflows/release.yaml

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update release.yaml

* Update .github/workflows/release.yaml

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update .github/workflows/release.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: Add .NET bindings (#1917)

* fix: Return a non-zero exit code for `prqlc compile` errors (#1924)

* fix: Return a non-zero exit code for `prqlc compile` errors

* .

* ci: Add `internal` & `devops` to semantic commit options (#1926)

* ci: Add `internal` & `devops` to semantic commit options

* internal: Enable auto-conversion of anyhow's error to `ErrorMessages` (#1913)

* internal: Implement std::error::Error for ErrorMessages (#1925)

* build: Bump dependencies (#1927)

* docs: Embolden `prqlc` description (#1919)

* revert: "build: Bump dependencies (#1927)" (#1935)

Revert "build: Bump dependencies (#1927)"

This reverts commit 7c317ad.

* devops: Add `web` to semantic commit categories (#1938)

* build: Re-revert #1935 (#1937)

Locked wasm-bindgen, I think because of a wasm-pack problem

* refactor: remove trailing whitespace (#1943)

* build: update prql-lib API (#1941)

* docs: prql-lib docs (#1945)

* fix: Panic with multiple terms after a `from` transform (#1928)

* chore: bump chumsky from 0.8.0 to 0.9.0 (#1723)

* build: Fix .NET bindings (#1946)

* Update CompilerTest.cs

* Update README.md

* Update PrqlCompilerOptions.cs

* Update PrqlCompiler.cs

* test: Disable PHP tests until aligned with `prql-lib` (#1947)

Just to ensure the build stays green as discussed in https://discord.com/channels/936728116712316989/1078360136978022510.

Thanks to @aljazerzen & @vanillajonathan for the changes.

* chore: Add `testng` to typos exclusion (#1948)

Required in #1929 (comment)

* docs: Add a note re reverting (#1952)

* revert: re-revert loop (#1951)

* revert: re-revert loop

Re-reverts #1899 & #1901

* fix book link

* ci: Only cache docker on main branch (#1953)

* revert: #1953 (#1954)

Revert "ci: Only cache docker on main branch (#1953)"

This reverts commit 5a382e7.

* refactor: Improve PHP bindings (#1949)

* chore: bump monaco-editor from 0.35.0 to 0.36.0 in /playground (#1955)

Bumps [monaco-editor](https://github.com/microsoft/monaco-editor) from 0.35.0 to 0.36.0.
- [Release notes](https://github.com/microsoft/monaco-editor/releases)
- [Changelog](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md)
- [Commits](microsoft/monaco-editor@v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: monaco-editor
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* internal: Defer to auto-conversion of some errors (#1931)

Follow-up to #1914

* web: Attempt to default to the SQL view in playground (#1939)

web: Default to the SQL view in playground

* feat: Add a `--format=yaml` option to `prqlc parse` (#1962)

* refactor: Refactor CLI arg handling (#1963)

* feat: Add a `--format=yaml` option to `prqlc parse`

* refactor: Refactor CLI arg handling

Based of #1912

* Update prql-compiler/prqlc/src/cli.rs

Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>

* .

---------

Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>

* chore: Add changelog for `--format` (#1968)

* chore: pre-commit autoupdate (#1975)

updates:
- [github.com/crate-ci/typos: typos-dict-v0.9.16 → v1.13.12](crate-ci/typos@typos-dict-v0.9.16...v1.13.12)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.248 → v0.0.252](astral-sh/ruff-pre-commit@v0.0.248...v0.0.252)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: rewrite parser with chumsky (#1818)

* feat: parse and compile params (#1957)

* chore: Remove reference to pest grammar (#1977)

This was causing a build failure on main

* docs: update tree-sitter information (#1976)

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* ci: Move to `baptiste0928/cargo-install` for CI (#1979)

We were getting 404s on the existing action, and this is also faster once it's cached

* test: repro timestamp parsing issue (#1980)

* test: repro timestamp parsing issue

* Update prql-compiler/src/test.rs

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update prql-compiler/src/test.rs

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* chore: Fix typo (#1981)

* chore: Remove extraneous file (#1984)

I must have committed this by mistake

* fix: Attempt to fix the chumsky break on MacOS (#1978)

* fix: Attempt to fix the chumsky break on MacOS

* Re-enable workflows

* Excluding features from macos vs. wasm

* ci: Reset cache (#1986)

* test: Add test for query which blocks on chumsky (#1982)

* test: Add test for query which blocks on chumsky

Based on #1978.

It will block tests, probably until timeout

* Add a very minimal test

* chore: fix typo (#1988)

* refactor: Attempt to replace our `IntoOnly` with `ExactlyOne` (#1915)

* refactor: Attempt to replace our `IntoOnly` with `ExactlyOne`

Since I originally wrote this (and others have iterated on it), Itertools released `ExactlyOne`, which has better errors and reduces our custom code.

Unfortunately, I couldn't fix a rust type error, and spent too long on it already. So pushing what I have in case anyone wants to take a look.

There's also a decent chance that we replace the `parser.rs` code, in which case this type error becomes moot, and we can merge this anyway.

* remove IntoOnly completely - even from public API

* Allow multiple ErrorMessages in prql-python

---------

Co-authored-by: Aljaž Mur Eržen <aljaz.erzen@gmail.com>

* devops: Add `bacon` config file (#1989)

* devops: Add `bacon` config file

I recently discovered `bacon`, which is great (thanks to @snth for the link), and replaces some of the `watchexec` and `task` watch tasks.

This is an initial config file; it'll get some updates as folks use it more. I'll also update `development.md` once I've used it more (unless anyone gets there first...).

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix: Allow no `:` in timezones (#1991)

feat: Allow no `:` in timezones

Fixes issue in #1818

* fix: Fix sqlite datetime output (#1970)

* test: add test case for sqlite datetime

* feat: implement `is` helper for DialectHandler

* fix: use datetime functions for sqlite dialect

* style: fix lint issues

* Update prql-compiler/src/sql/gen_expr.rs

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update prql-compiler/src/sql/gen_expr.rs

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* Update prql-compiler/src/sql/gen_expr.rs

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* test: move tests to test.rs

* style: lint fix

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* feat: adjust panic to Java Exception (#1971)

* build: update to version 0.5.2

* feat: add Exception for method signature

* chore: add Exception for test method

* feat: adjust panic to Java Exception and add format method

* chore: use implicit return

* test: add compileWithError() to test compile with error

* feat: add dialect, format and signature parameters for toSql method

* chore: update toSql method signature

* lint: code polishing reported by clippy

* chore: code format

* docs: adjust signature for toSQL()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: format

* chore: introduce target dialect from https://github.com/PRQL/prql/blob/main/book/src/language-features/target.md

* chore: rename dialect to target

* Use target rather than dialect

* lint

* docs: add javadoc for toSql()

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>

* build: add very experimental MegaLinter config files (#1974)

* build: add MegaLinter config files

* build: disable errors of some linters

* chore: temporarily enable linting for all codes

* build: disable stylelint because of looong time required in CI

* chore: auto formatting

* build: disable all Linter errors that are currently causing errors

* build: disable markdown-link-chack's error

* build: disable megalinter's GitHub comment reporter

* chore: add comments in megalinter config files

* docs: add note about MegaLinter

* Revert "chore: temporarily enable linting for all codes"

This reverts commit a665b2d.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* build: fix workflow trigger not to run twice in PR from other branch

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: error code (#1993)

* feat: validate Options.target and allow sql.any (#1995)

* test: Fix Elixir test from #1995 (#1999)

* chore: bump @duckdb/duckdb-wasm from 1.21.0 to 1.24.0 in /playground (#2000)

Bumps [@duckdb/duckdb-wasm](https://github.com/duckdb/duckdb-wasm) from 1.21.0 to 1.24.0.
- [Release notes](https://github.com/duckdb/duckdb-wasm/releases)
- [Commits](duckdb/duckdb-wasm@v1.21.0...v1.24.0)

---
updated-dependencies:
- dependency-name: "@duckdb/duckdb-wasm"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: Allow unicode in identifiers (#2005)

* fix: Allow unicode in identifiers

Closes #2003. Thanks to @vanillajonathan for the report.

* test: convert a few unit tests to integration (#2006)

* feat: Improve lexer error recovery (#2002)

* feat: Improve lexer error recovery

Upgrade to Chumsky 0.9.2 and add back recovery

* feat: Improve error messages on EOI (#2008)

* feat: Improve lexer error recovery

Upgrade to Chumsky 0.9.2 and add back recovery

* feat: Improve error messages on EOI

Based on #2002 (comment)

Also simplifies a code block

* .

* devops: Adjust gitignore so `bacon` works with `insta` (#2011)

* feat: Improve error messages for EOI more (#2012)

Follow-up to #2008

* fix: Fix regression in @2012 (#2013)

Demonstrates we don't have enough tests for error messages! (And that I was not conscientious...)

* chore: bump sqlparser from 0.30.0 to 0.31.0 (#2001)

* chore: bump sqlparser from 0.30.0 to 0.31.0

Bumps [sqlparser](https://github.com/sqlparser-rs/sqlparser-rs) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/sqlparser-rs/sqlparser-rs/releases)
- [Changelog](https://github.com/sqlparser-rs/sqlparser-rs/blob/main/CHANGELOG.md)
- [Commits](sqlparser-rs/sqlparser-rs@v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: sqlparser
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* .

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

* docs: Add error messages to the book (#2015)

* docs: Add error messages to the book

This allows us to show and test error messages in the book, and adds an initial example.

Unfortunately the initial example doesn't have a great error message! So that's something we could work on.

It also updates the docs to add late binding — now functions support that!

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* .

* .

* .

* .

* .

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: Remove double-negatives (#2007)

* docs: update changelog about sql.any (#2017)

* feat: upper and lower function (#2019)

* docs: fix website landing page (#2021)

* chore: Fix typo in changelog (#2023)

* test: Test formatted examples can compile (#2016)

* docs: Add error messages to the book

This allows us to show and test error messages in the book, and adds an initial example.

Unfortunately the initial example doesn't have a great error message! So that's something we could work on.

It also updates the docs to add late binding — now functions support that!

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* .

* .

* .

* .

* .

* test: Test formatted examples can compile

We remove the snapshot output of them all -- even having written these, I was getting confused what all the snapshots were. And we don't use them at all. I added a TODO in the code for a good design if we could make progress on the autoformatter.

* Revert ""

This reverts commit 1937692.

* clean up merge diff

* .

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* build: add definitions for devcontainer base image (#2025)

* build: add definitions for devcontainer base image

* build: split install-cargo-tools task to another Taskfile

* build: fix concurrency of devcontainer.yaml (#2027)

* build: fix docker build workflows (#2028)

* build: always build amd64 and arm64

* build: fix copying Taskfile

* chore: bump base image version and pin to bullseye

* build: try only build arm64

* build: build amd64 only for now

* chore: pre-commit autoupdate (#2032)

updates:
- [github.com/crate-ci/typos: v1.13.12 → v1.13.18](crate-ci/typos@v1.13.12...v1.13.18)
- [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.4 → v3.0.0-alpha.6](pre-commit/mirrors-prettier@v3.0.0-alpha.4...v3.0.0-alpha.6)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.252 → v0.0.254](astral-sh/ruff-pre-commit@v0.0.252...v0.0.254)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* devops: Add shortcuts for insta in `bacon` (#2037)

* devops: Add shortcuts for insta in `bacon`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* devops: Sync bacon command with `test-rust` (#2038)

* devops: Sync bacon command with `test-rust`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat!: Rename `switch` to `case` (#2036)

* feat: Rename `switch` to `case`

In case `switch` is confusing, this switches `switch` for `case`. Hopefully the switch won't lead to a case of confusion; or we can case the decision again.

* build: add basic devcontainer.json (for Rust, JavaScript, Python) (#1893)

* chore: add devcontainer config file

* build: add base devcontainer definition and build workflow file

* First cut, very low-quality draft for Dev Containers

I have written about 98% of what I know. Let's all contribute to strengthen this document. Thanks.

* Remove "will" in favor of direct action words.

It's almost always better to write documentation saying "thing X _does_ action Y" instead of "thing X will do action Y".

* Update using-dev-container.md

* Update using-dev-container.md

* Final editorial tweak for first-cut description

* Update to reflect @eitsupi's comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: some updates about VS Code Dev Containers

* docs: update title and add note

* docs: add a link to containers.dev

* docs: formatting lists

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* build: use only Dockerfile for base pre-built image

* ci: update workflow to use docker/build-push-action

* chore: autoformatting

* build: fix workflow trigger

* chore: fix path

* fix: fix GHA syntax

* fix: fix typo

* ci: use docker/metadata-action to prepare tags

* build: use pre-built image as devcontainer base image

* build: remove task for devcontainer setup for now

* chore: sync vscode extensions in devcontainer.json

* docs: some document update and install zsh completion

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: add the page about devcontainers to the book

* build: set postCreateCommand

* chore: fix version of go-task Dev Container Feature

* docs: remove superfluous comment

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: Rich Brown <richb.hanover@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: Wordsmith #1893 (#2045)

* docs: Wordsmith #1893

* docs: Move task docs out of devcontainers (#2046)

These are good docs, but there's no reason for them to be here. They'd be good in the Taskfile, or very open to other suggestions

While I _really_ appreciate docs that we write (CC @richbhanover), it's important that they're focused, concise, and close to the code that they document -- because they also need to be maintained, and the project takes on that responsibility.

I really don't want to lose folks' generosity and ideas, but I'm going to start being a bit firmer on these sorts of things, because we're already starting to see some stale docs (#2044). There are other ways of writing things that have fewer guarantees of continued support -- blog posts, gists, etc.

* chore: Fix footnote in a doc (#2047)

* chore: Redirect case.html

This will fix the tests in #2040

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>
Co-authored-by: Jonathan <vanillajonathan@users.noreply.github.com>
Co-authored-by: Rich Brown <richb.hanover@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias Q <35303817+matthias-Q@users.noreply.github.com>
Co-authored-by: hbc <me@hbc.rocks>
Co-authored-by: eitsupi <50911393+eitsupi@users.noreply.github.com>
Co-authored-by: Aljaž Mur Eržen <aljaz.erzen@gmail.com>
Co-authored-by: Libing Chen <libing.chen@gmail.com>
Co-authored-by: Jelenkee <59470612+Jelenkee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publishing prql-java to maven central
5 participants