From 3a1531d3e274cf7f074f23882f4156c115b91cfa Mon Sep 17 00:00:00 2001 From: Thomas Ubensee <34603111+tomuben@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:51:43 -0300 Subject: [PATCH] #986: Added environment variable for new ScriptOptionsLine parser in UDF client (#463) related to exasol/script-languages-release#986 --- exaudfclient/base/javacontainer/javacontainer_builder.cc | 4 ++-- exaudfclient/base/javacontainer/javacontainer_builder.h | 2 +- exaudfclient/exaudfclient.cc | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/exaudfclient/base/javacontainer/javacontainer_builder.cc b/exaudfclient/base/javacontainer/javacontainer_builder.cc index ebbaab74..5eef3ef9 100644 --- a/exaudfclient/base/javacontainer/javacontainer_builder.cc +++ b/exaudfclient/base/javacontainer/javacontainer_builder.cc @@ -10,8 +10,8 @@ namespace SWIGVMContainers { JavaContainerBuilder::JavaContainerBuilder() : m_useCtpgParser(false) {} -JavaContainerBuilder& JavaContainerBuilder::useCtpgParser(const bool useCtpgParser) { - m_useCtpgParser = useCtpgParser; +JavaContainerBuilder& JavaContainerBuilder::useCtpgParser() { + m_useCtpgParser = true; return *this; } diff --git a/exaudfclient/base/javacontainer/javacontainer_builder.h b/exaudfclient/base/javacontainer/javacontainer_builder.h index 5893b6d2..2e427671 100644 --- a/exaudfclient/base/javacontainer/javacontainer_builder.h +++ b/exaudfclient/base/javacontainer/javacontainer_builder.h @@ -18,7 +18,7 @@ class JavaContainerBuilder { public: JavaContainerBuilder(); - JavaContainerBuilder& useCtpgParser(const bool value); + JavaContainerBuilder& useCtpgParser(); JavaVMach* build(); diff --git a/exaudfclient/exaudfclient.cc b/exaudfclient/exaudfclient.cc index 40756f18..e2f06442 100644 --- a/exaudfclient/exaudfclient.cc +++ b/exaudfclient/exaudfclient.cc @@ -129,6 +129,9 @@ int main(int argc, char **argv) { cerr << "Usage: " << argv[0] << " lang=python|lang=r|lang=java|lang=streaming|lang=benchmark" << endl; return 1; } + const char* script_options_parser_env_val = ::getenv("SCRIPT_OPTIONS_PARSER_VERSION"); + const bool useCtpgScriptOptionsParser = script_options_parser_env_val != nullptr && + ::strcmp(script_options_parser_env_val, "2") == 0; #endif if (::setenv("HOME", "/tmp", 1) == -1) @@ -160,7 +163,11 @@ int main(int argc, char **argv) { } else if (strcmp(argv[2], "lang=java")==0) { #ifdef ENABLE_JAVA_VM - vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().build();}; + if (useCtpgScriptOptionsParser) { + vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().useCtpgParser().build();}; + } else { + vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().build();}; + } #else throw SWIGVM::exception("this exaudfclient has been compilied without Java support"); #endif