Skip to content

Commit 23e4717

Browse files
authored
Support debug mode for parquet and datafusion plugin (#20110)
Signed-off-by: Arpit Bandejiya <[email protected]>
1 parent c3a8415 commit 23e4717

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

modules/parquet-data-format/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def pluginDescription = 'Parquet data format plugin'
1313
def packagePath = 'com.parquet'
1414
def pathToPlugin = 'parquetdataformat'
1515
def pluginClassName = 'ParquetDataFormatPlugin'
16+
def buildType = project.hasProperty('rustDebug') ? 'debug' : 'release'
17+
1618
group = "ParquetDataFormatGroup"
1719

1820
java {
@@ -168,7 +170,6 @@ tasks.register('buildRust', Exec) {
168170
def libExtension = osName.contains('windows') ? '.dll' : (osName.contains('mac') ? '.dylib' : '.so')
169171

170172
// Use debug build for development, release for production
171-
def buildType = project.hasProperty('rustRelease') ? 'release' : 'debug'
172173
def targetDir = file("${workingDir}/target/")
173174

174175
// Find cargo executable - try common locations
@@ -187,9 +188,9 @@ tasks.register('buildRust', Exec) {
187188
}
188189

189190
def cargoArgs = [cargoExecutable, 'build']
190-
// if (buildType == 'release') {
191-
cargoArgs.add('--release')
192-
// }
191+
if (buildType == 'release') {
192+
cargoArgs.add('--release')
193+
}
193194

194195
if (osName.contains('windows')) {
195196
commandLine cargoArgs
@@ -202,15 +203,14 @@ tasks.register('buildRust', Exec) {
202203

203204
inputs.files fileTree("${workingDir}/src")
204205
inputs.file "${workingDir}/Cargo.toml"
205-
// outputs.files file("jni/${targetDir}/${libPrefix}opensearch_datafusion_jni${libExtension}")
206-
// System.out.println("Building Rust library in ${buildType} mode");
207-
206+
outputs.files file("jni/${targetDir}/${libPrefix}opensearch_datafusion_jni${libExtension}")
207+
System.out.println("Building Parquet plugin rust library in ${buildType} mode");
208208

209209
}
210210

211211
tasks.register('copyNativeLib', Copy) {
212212
dependsOn buildRust
213-
from "src/main/rust/target/release"
213+
from "src/main/rust/target/${buildType}"
214214
into "src/main/resources/native"
215215
include "libparquet_dataformat_jni.*"
216216
include "parquet_dataformat_jni.dll"

plugins/engine-datafusion/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def pluginDescription = 'OpenSearch plugin providing access to DataFusion via JN
1717
def projectPath = 'org.opensearch'
1818
def pathToPlugin = 'datafusion.DataFusionPlugin'
1919
def pluginClassName = 'DataFusionPlugin'
20+
def buildType = project.hasProperty('rustDebug') ? 'debug' : 'release'
2021

2122
opensearchplugin {
2223
name = pluginName
@@ -26,6 +27,7 @@ opensearchplugin {
2627
noticeFile = rootProject.file('NOTICE.txt')
2728
}
2829

30+
2931
dependencies {
3032
api project(':libs:opensearch-vectorized-exec-spi')
3133
implementation "org.apache.logging.log4j:log4j-api:${versions.log4j}"
@@ -69,8 +71,6 @@ task buildRustLibrary(type: Exec) {
6971
def libPrefix = osName.contains('windows') ? '' : 'lib'
7072
def libExtension = osName.contains('windows') ? '.dll' : (osName.contains('mac') ? '.dylib' : '.so')
7173

72-
// Use debug build for development, release for production
73-
def buildType = project.hasProperty('rustRelease') ? 'release' : 'debug'
7474
def targetDir = "target/${buildType}"
7575

7676
// Find cargo executable - try common locations
@@ -116,7 +116,6 @@ task copyNativeLibrary(type: Copy, dependsOn: buildRustLibrary) {
116116
def osName = System.getProperty('os.name').toLowerCase()
117117
def libPrefix = osName.contains('windows') ? '' : 'lib'
118118
def libExtension = osName.contains('windows') ? '.dll' : (osName.contains('mac') ? '.dylib' : '.so')
119-
def buildType = project.hasProperty('rustRelease') ? 'release' : 'debug'
120119

121120
from file("jni/target/${buildType}/${libPrefix}opensearch_datafusion_jni${libExtension}")
122121
into file('src/main/resources/native')

0 commit comments

Comments
 (0)