Skip to content

Commit

Permalink
Fix positional args
Browse files Browse the repository at this point in the history
  • Loading branch information
auxten committed Nov 9, 2023
1 parent a0eba40 commit 29b9ffb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions programs/local/LocalChdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local_result * queryToBuffer(
const std::string & path = {},
const std::string & udfPath = {})
{
std::vector<std::string> argv = {"clickhouse", "--", "--multiquery"};
std::vector<std::string> argv = {"clickhouse", "--multiquery"};

// If format is "Debug" or "debug", then we will add `--verbose` and `--log-level=trace` to argv
if (output_format == "Debug" || output_format == "debug")
Expand All @@ -28,14 +28,6 @@ local_result * queryToBuffer(
argv.push_back("--output-format=" + output_format);
}

// If udfPath is not empty, then we will add `--user_scripts_path` and `--user_defined_executable_functions_config` to argv
// the path should be a one time thing, so the caller should take care of the temporary files deletion
if (!udfPath.empty())
{
argv.push_back("--user_scripts_path=" + udfPath);
argv.push_back("--user_defined_executable_functions_config=" + udfPath + "/*.xml");
}

// If path is not empty, then we will add `--path` to argv. This is used for chdb.Session to support stateful query
if (!path.empty())
{
Expand All @@ -45,6 +37,15 @@ local_result * queryToBuffer(
// Add query string
argv.push_back("--query=" + queryStr);

// If udfPath is not empty, then we will add `--user_scripts_path` and `--user_defined_executable_functions_config` to argv
// the path should be a one time thing, so the caller should take care of the temporary files deletion
if (!udfPath.empty())
{
argv.push_back("--");
argv.push_back("--user_scripts_path=" + udfPath);
argv.push_back("--user_defined_executable_functions_config=" + udfPath + "/*.xml");
}

// Convert std::string to char*
std::vector<char *> argv_char;
for (auto & arg : argv)
Expand Down
2 changes: 1 addition & 1 deletion src/Storages/System/StorageSystemJemalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ UInt64 getJeMallocValue(const char * name)
{
UInt64 value{};
size_t size = sizeof(value);
mallctl(name, &value, &size, nullptr, 0);
je_mallctl(name, &value, &size, nullptr, 0);
/// mallctl() fills the value with 32 bit integer for some queries("arenas.nbins" for example).
/// In this case variable 'size' will be changed from 8 to 4 and the 64 bit variable 'value' will hold the 32 bit actual value times 2^32 on big-endian machines.
/// We should right shift the value by 32 on big-endian machines(which is unnecessary on little-endian machines).
Expand Down

0 comments on commit 29b9ffb

Please sign in to comment.