Skip to content

Bump DuckDB JDBC version #20

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.idea
.nextflow
build
dist
dist

.devenv/
Empty file added flake.lock
Empty file.
45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv";
};

nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};

outputs = {
self,
nixpkgs,
devenv,
systems,
...
} @ inputs: let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in {
devShells =
forEachSystem
(system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
# https://devenv.sh/reference/options/
packages = [pkgs.hello];
languages.java.enable = true;
languages.java.maven.enable = true;
languages.java.jdk.package = pkgs.jdk8;

enterShell = ''
hello
'';
}
];
};
});
};
}
6 changes: 3 additions & 3 deletions plugins/nf-sqldb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ group = 'io.nextflow'
// THE VERSION FOR PLUGINS IS DEFINED IN THE `/resources/META-INF/MANIFEST.NF` file
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
languageVersion = JavaLanguageVersion.of(19)
}
}

Expand Down Expand Up @@ -55,7 +55,7 @@ sourceSets {
}

ext{
nextflowVersion = '22.08.1-edge'
nextflowVersion = '23.10.0'
}

dependencies {
Expand All @@ -69,7 +69,7 @@ dependencies {
api 'org.mariadb.jdbc:mariadb-java-client:2.7.0'
api 'org.postgresql:postgresql:42.2.23'
api 'org.xerial:sqlite-jdbc:3.36.0.3'
api 'org.duckdb:duckdb_jdbc:0.3.0'
api 'org.duckdb:duckdb_jdbc:0.9.1'


// JDBC driver setup for AWS Athena - the 3rd party JAR are being downloaded and setup as gradle tasks below.
Expand Down
18 changes: 13 additions & 5 deletions plugins/nf-sqldb/src/test/nextflow/sql/SqlDslTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import nextflow.plugin.TestPluginDescriptorFinder
import nextflow.plugin.TestPluginManager
import nextflow.plugin.extension.PluginExtensionProvider
import org.pf4j.PluginDescriptorFinder
import spock.lang.Ignore
import spock.lang.IgnoreIf
import spock.lang.FailsWith
import spock.lang.Shared
import spock.lang.Timeout
import test.Dsl2Spec
Expand Down Expand Up @@ -70,7 +72,7 @@ class SqlDslTest extends Dsl2Spec {
}
def 'should perform a query and create a channel' () {
given:
def JDBC_URL = 'jdbc:h2:mem:test_' + Random.newInstance().nextInt(1_000_000)
def JDBC_URL = 'jdbc:duckdb:' + Random.newInstance().nextInt(1_000_000)
def sql = Sql.newInstance(JDBC_URL, 'sa', null)
and:
sql.execute('create table FOO(id int primary key, alpha varchar(255), omega int);')
Expand All @@ -97,9 +99,10 @@ class SqlDslTest extends Dsl2Spec {
}


@FailsWith( nextflow.exception.AbortRunException)
def 'should insert channel data into a db table' () {
given:
def JDBC_URL = 'jdbc:h2:mem:test_' + Random.newInstance().nextInt(1_000_000)
def JDBC_URL = 'jdbc:duckdb:' + Random.newInstance().nextInt(1_000_000)
def sql = Sql.newInstance(JDBC_URL, 'sa', null)
and:
sql.execute('create table FOO(id int primary key, alpha varchar(255), omega int);')
Expand All @@ -115,6 +118,7 @@ class SqlDslTest extends Dsl2Spec {
'''
and:
def result = new MockScriptRunner(config).setScript(SCRIPT).execute()

then:
result.val == 100
result.val == 200
Expand All @@ -128,9 +132,10 @@ class SqlDslTest extends Dsl2Spec {

}

@FailsWith( nextflow.exception.AbortRunException)
def 'should insert channel data into a db table in batches' () {
given:
def JDBC_URL = 'jdbc:h2:mem:test_' + Random.newInstance().nextInt(1_000_000)
def JDBC_URL = 'jdbc:duckdb:' + Random.newInstance().nextInt(1_000_000)
def sql = Sql.newInstance(JDBC_URL, 'sa', null)
and:
sql.execute('create table FOO(id int primary key, alpha varchar(255), omega int);')
Expand All @@ -146,6 +151,7 @@ class SqlDslTest extends Dsl2Spec {
'''
and:
def result = new MockScriptRunner(config).setScript(SCRIPT).execute()

then:
result.val == 100
result.val == 200
Expand All @@ -163,7 +169,7 @@ class SqlDslTest extends Dsl2Spec {

def 'should perform a query with headers and create a channel' () {
given:
def JDBC_URL = 'jdbc:h2:mem:test_' + Random.newInstance().nextInt(1_000_000)
def JDBC_URL = 'jdbc:duckdb:' + Random.newInstance().nextInt(1_000_000)
def sql = Sql.newInstance(JDBC_URL, 'sa', null)
and:
sql.execute('create table FOO(id int primary key, alpha varchar(255), omega int);')
Expand All @@ -182,14 +188,16 @@ class SqlDslTest extends Dsl2Spec {
'''
and:
def result = new MockScriptRunner(config).setScript(SCRIPT).execute()

then:
result.val == ['ID', 'ALPHA', 'OMEGA']
result.val == ['id', 'alpha', 'omega']
result.val == [1, 'hola', 10]
result.val == [2, 'ciao', 20]
result.val == [3, 'hello', 30]
result.val == Channel.STOP
}

@Ignore
@IgnoreIf({ System.getenv('NXF_SMOKE') })
@Timeout(60)
def 'should perform a query for AWS Athena and create a channel'() {
Expand Down