-
Notifications
You must be signed in to change notification settings - Fork 334
Initial work on DuckDB #14114
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
Initial work on DuckDB #14114
Changes from all commits
221a142
dedce22
5d9ff2c
5a49748
0478afa
c469fbd
6a01adb
c8b3cad
0f03972
f1e370b
07dc2f2
889b798
84174cd
5172630
d3ac9e5
a32b683
3a83722
f6f807c
5bef43b
4cd7f70
a2cac72
78e4dd0
2cb12f9
2cace34
2caf3c4
8d0fadc
f8497b2
101d7e0
db528ec
462ac33
066ac7f
55a364a
f90b56e
b22ca38
2be3529
8f05857
1968721
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ STDLIB_NAMES = [ | |
"AWS", | ||
"Base", | ||
"Database", | ||
"DuckDB", | ||
"Examples", | ||
"Generic_JDBC", | ||
"Geo", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,10 @@ GatherLicenses.distributions := Seq( | |
makeStdLibDistribution( | ||
"Saas", | ||
Distribution.sbtProjects(`std-saas`) | ||
), | ||
makeStdLibDistribution( | ||
"DuckDB", | ||
Distribution.sbtProjects(`std-duckdb`) | ||
) | ||
) | ||
|
||
|
@@ -400,6 +404,7 @@ lazy val enso = (project in file(".")) | |
`std-table`, | ||
`std-tableau`, | ||
`std-saas`, | ||
`std-duckdb`, | ||
`sqlite-wrapper`, | ||
`syntax-rust-definition`, | ||
`tableau-wrapper`, | ||
|
@@ -2852,6 +2857,7 @@ lazy val runtime = (project in file("engine/runtime")) | |
.dependsOn(`std-microsoft` / Compile / packageBin) | ||
.dependsOn(`std-tableau` / Compile / packageBin) | ||
.dependsOn(`std-saas` / Compile / packageBin) | ||
.dependsOn(`std-duckdb` / Compile / packageBin) | ||
.value | ||
) | ||
.dependsOn(`common-polyglot-core-utils`) | ||
|
@@ -3931,6 +3937,9 @@ lazy val `engine-runner` = project | |
.listFiles("*.jar") | ||
.map(_.getAbsolutePath()) ++ | ||
`std-tableau-polyglot-root` | ||
.listFiles("*.jar") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test code:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
.map(_.getAbsolutePath()) ++ | ||
`std-duckdb-polyglot-root` | ||
.listFiles("*.jar") | ||
.map(_.getAbsolutePath()) ++ (if ( | ||
GraalVM.EnsoLauncher.disableMicrosoft | ||
|
@@ -4063,7 +4072,8 @@ lazy val `engine-runner` = project | |
"com.tableau.hyperapi", | ||
// See https://github.com/HarrDevY/native-register-bouncy-castle | ||
"org.bouncycastle.jcajce.provider.drbg.DRBG$Default", | ||
"org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV" | ||
"org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV", | ||
"org.duckdb" | ||
), | ||
initializeAtBuildtime = NativeImage.defaultBuildTimeInitClasses ++ | ||
Seq( | ||
|
@@ -5025,6 +5035,10 @@ val `std-tableau-native-libs` = | |
stdLibComponentRoot("Tableau") / "polyglot" / "lib" | ||
val `std-saas-polyglot-root` = | ||
stdLibComponentRoot("Saas") / "polyglot" / "java" | ||
val `std-duckdb-polyglot-root` = | ||
stdLibComponentRoot("DuckDB") / "polyglot" / "java" | ||
val `std-duckdb-native-libs` = | ||
stdLibComponentRoot("DuckDB") / "polyglot" / "lib" | ||
|
||
lazy val `std-base` = project | ||
.in(file("std-bits") / "base") | ||
|
@@ -5518,6 +5532,31 @@ lazy val `sqlite-wrapper` = project | |
) | ||
) | ||
|
||
lazy val `duckdb-wrapper` = project | ||
.in(file("lib/java/duckdb-wrapper")) | ||
.enablePlugins(JarExtractPlugin) | ||
.settings( | ||
frgaalJavaCompilerSetting, | ||
autoScalaLibrary := false, | ||
libraryDependencies ++= Seq( | ||
"org.duckdb" % "duckdb_jdbc" % duckdbVersion | ||
), | ||
inputJar := "org.duckdb" % "duckdb_jdbc" % duckdbVersion, | ||
version := "0.1", | ||
jarExtractor := JarExtractor( | ||
"libduckdb_java.so_linux_amd64" -> PolyglotLib(LinuxAMD64), | ||
JaroslavTulach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"libduckdb_java.so_osx_universal" -> PolyglotLib(MacOSArm64), | ||
"libduckdb_java.so_osx_universal" -> PolyglotLib(MacOSAMD64), | ||
"libduckdb_java.so_windows_amd64" -> PolyglotLib(WindowsAMD64), | ||
"META-INF/**" -> CopyToOutputJar, | ||
"org/**/*.class" -> CopyToOutputJar | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am getting:
where the test.enso. We need to patch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, CI reports the same (it is masked by ClassNotFoundException) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related duckdb/duckdb-java#180 |
||
), | ||
inputJarResolved := assembly.value, | ||
assemblyMergeStrategy := { case _ => | ||
MergeStrategy.preferProject | ||
} | ||
) | ||
|
||
lazy val `std-image` = project | ||
.in(file("std-bits") / "image") | ||
.settings( | ||
|
@@ -6045,6 +6084,52 @@ lazy val `std-saas` = project | |
.dependsOn(`std-base` % "provided") | ||
.dependsOn(`std-table` % "provided") | ||
|
||
lazy val `std-duckdb` = project | ||
.in(file("std-bits") / "duckdb") | ||
.settings( | ||
frgaalJavaCompilerSetting, | ||
autoScalaLibrary := false, | ||
Compile / compile / compileInputs := (Compile / compile / compileInputs) | ||
.dependsOn(SPIHelpers.ensureSPIConsistency) | ||
.value, | ||
Compile / packageBin / artifactPath := | ||
`std-duckdb-polyglot-root` / "std-duckdb.jar", | ||
libraryDependencies ++= Seq( | ||
"org.duckdb" % "duckdb_jdbc" % duckdbVersion % "provided" | ||
), | ||
Compile / packageBin := { | ||
val stdDuckDBJar = (Compile / packageBin).value | ||
val cacheStoreFactory = streams.value.cacheStoreFactory | ||
StdBits | ||
.copyDependencies( | ||
`std-duckdb-polyglot-root`, | ||
Seq("std-duckdb.jar"), | ||
ignoreScalaLibrary = true, | ||
libraryUpdates = (Compile / update).value, | ||
unmanagedClasspath = (Compile / unmanagedClasspath).value, | ||
polyglotLibDir = Some(`std-duckdb-native-libs`), | ||
ignoreDependencies = None, | ||
extractedNativeLibsDirs = Seq( | ||
(`duckdb-wrapper` / extractedFilesDir).value | ||
), | ||
extraJars = Seq( | ||
(`duckdb-wrapper` / thinJarOutput).value | ||
), | ||
logger = streams.value.log, | ||
cacheStoreFactory = cacheStoreFactory | ||
) | ||
stdDuckDBJar | ||
}, | ||
clean := Def.task { | ||
val _ = clean.value | ||
IO.delete(`std-duckdb-polyglot-root`) | ||
IO.delete(`std-duckdb-native-libs`) | ||
}.value | ||
) | ||
.dependsOn(`std-base` % "provided") | ||
.dependsOn(`std-table` % "provided") | ||
.dependsOn(`std-database` % "provided") | ||
|
||
lazy val fetchZipToUnmanaged = | ||
taskKey[Seq[Attributed[File]]]( | ||
"Download zip file from an `unmanagedExternalZip` url and unpack jars to unmanaged libs directory" | ||
|
@@ -6353,7 +6438,8 @@ val stdBitsProjects = | |
"Microsoft", | ||
"Snowflake", | ||
"Table", | ||
"Saas" | ||
"Saas", | ||
"DuckDB" | ||
) ++ allStdBitsSuffix | ||
val allStdBits: Parser[String] = | ||
stdBitsProjects.map(v => v: Parser[String]).reduce(_ | _) | ||
|
@@ -6434,6 +6520,8 @@ pkgStdLibInternal := Def.inputTask { | |
(`std-tableau` / Compile / packageBin).value | ||
case "Saas" => | ||
(`std-saas` / Compile / packageBin).value | ||
case "DuckDB" => | ||
(`std-duckdb` / Compile / packageBin).value | ||
case _ if buildAllCmd => | ||
(`std-base` / Compile / packageBin).value | ||
(`enso-test-java-helpers` / Compile / packageBin).value | ||
|
@@ -6451,6 +6539,7 @@ pkgStdLibInternal := Def.inputTask { | |
(`std-microsoft` / Compile / packageBin).value | ||
(`std-tableau` / Compile / packageBin).value | ||
(`std-saas` / Compile / packageBin).value | ||
(`std-duckdb` / Compile / packageBin).value | ||
case _ => | ||
} | ||
val libs = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Enso | ||
Copyright 2020 - 2025 New Byte Order sp. z o. o. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Enso Signatures 1.0 | ||
## module Standard.DuckDB.DuckDB | ||
- type DuckDB | ||
- From_File location:Standard.Base.System.File.File= schema:Standard.Base.Data.Text.Text= read_only:Standard.Base.Data.Boolean.Boolean= | ||
- In_Memory schema:Standard.Base.Data.Text.Text= read_only:Standard.Base.Data.Boolean.Boolean= | ||
- connect self options:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- jdbc_properties self -> Standard.Base.Any.Any | ||
- jdbc_url self -> Standard.Base.Any.Any | ||
- resolve constructor:Standard.Base.Any.Any -> Standard.Base.Any.Any |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Enso Signatures 1.0 | ||
## module Standard.DuckDB.DuckDB_Connection | ||
- type DuckDB_Connection | ||
- base_connection self -> Standard.Base.Any.Any | ||
- close self -> Standard.Base.Any.Any | ||
- create url:Standard.Base.Any.Any properties:Standard.Base.Any.Any make_new:Standard.Base.Any.Any schema:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- create_table self table_name:Standard.Base.Data.Text.Text structure:(Standard.Base.Any.Any|Standard.Table.Table.Table) primary_key:(Standard.Base.Any.Any|Standard.Base.Nothing.Nothing)= temporary:Standard.Base.Data.Boolean.Boolean= allow_existing:Standard.Base.Data.Boolean.Boolean= on_problems:Standard.Base.Errors.Problem_Behavior.Problem_Behavior= -> Standard.Base.Any.Any | ||
- database self -> Standard.Base.Any.Any | ||
- databases self -> Standard.Base.Any.Any | ||
- dialect self -> Standard.Base.Any.Any | ||
- drop_table self table_name:Standard.Base.Any.Any if_exists:Standard.Base.Any.Any= -> Standard.Base.Any.Any | ||
- execute self query:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- execute_query self query:Standard.Base.Any.Any limit:Standard.Table.Rows_To_Read.Rows_To_Read= write_operation:Standard.Base.Data.Boolean.Boolean= -> Standard.Base.Any.Any | ||
- execute_update self query:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- jdbc_connection self -> Standard.Base.Any.Any | ||
- query self query:(Standard.Database.SQL_Query.SQL_Query_With_Schema|Standard.Database.SQL_Query.SQL_Query) alias:Standard.Base.Any.Any= -> Standard.Base.Any.Any | ||
- read self query:(Standard.Database.SQL_Query.SQL_Query_With_Schema|Standard.Database.SQL_Query.SQL_Query) limit:Standard.Table.Rows_To_Read.Rows_To_Read= -> Standard.Base.Any.Any | ||
- schema self -> Standard.Base.Any.Any | ||
- schemas self -> Standard.Base.Any.Any | ||
- set_database self database:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- set_schema self schema:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- table_types self -> Standard.Base.Any.Any | ||
- tables self name_like:Standard.Base.Data.Text.Text= database:Standard.Base.Data.Text.Text= schema:Standard.Base.Data.Text.Text= types:Standard.Base.Any.Any= all_fields:Standard.Base.Any.Any= -> Standard.Base.Any.Any | ||
- to_js_object self -> Standard.Base.Any.Any | ||
- truncate_table self table_name:Standard.Base.Any.Any -> Standard.Base.Any.Any | ||
- version self -> Standard.Base.Data.Text.Text | ||
- schema_black_list -> Standard.Base.Any.Any | ||
- Standard.Base.Visualization.Table_Viz_Data.Table_Viz_Data.from that:Standard.DuckDB.DuckDB_Connection.DuckDB_Connection -> Standard.Base.Visualization.Table_Viz_Data.Table_Viz_Data |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Enso Signatures 1.0 | ||
## module Standard.DuckDB.Internal.DuckDB_Entity_Naming_Properties | ||
- new -> Standard.Base.Any.Any |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.so
extension otherwiseSystem.loadLibrary("duckdb")
will not find itSystem.loadLibrary
first before trying the equilibristic with extracting toFile.createTemp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic in
DuckDBNative
appears to have been added to support local dev. I agree that logic is rather flawed if one wants to use the jar as a 3rd party dependency.