mirror of
https://github.com/apache/arrow.git
synced 2026-10-28 16:47:19 +08:00
Refactor methods names to follow cpp patterns
This commit is contained in:
1 parent
7a0ca5c5f4
commit
f7d1c17d6a
3 files changed
+31
-31
No files matched your search
@@ -132,9 +132,9 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
|
||||
return ""; \
|
||||
} \
|
||||
\
|
||||
auto value_as_long = gandiva::HashUtils::double_to_long((double)value); \
|
||||
auto value_as_long = gandiva::HashUtils::DoubleToLong((double)value); \
|
||||
\
|
||||
const char *result = gandiva::HashUtils::hash_using_SHA128(context, \
|
||||
const char *result = gandiva::HashUtils::HashUsingSha128(context, \
|
||||
&value_as_long, \
|
||||
sizeof(value_as_long), \
|
||||
out_length); \
|
||||
@@ -154,7 +154,7 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
|
||||
return ""; \
|
||||
} \
|
||||
\
|
||||
return gandiva::HashUtils::hash_using_SHA128(context, value, value_length, out_length); \
|
||||
return gandiva::HashUtils::HashUsingSha128(context, value, value_length, out_length); \
|
||||
}
|
||||
|
||||
#define SHA256_HASH_FUNCTION(TYPE) \
|
||||
@@ -166,9 +166,9 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
|
||||
return ""; \
|
||||
} \
|
||||
\
|
||||
auto value_as_long = gandiva::HashUtils::double_to_long((double)value); \
|
||||
auto value_as_long = gandiva::HashUtils::DoubleToLong((double)value); \
|
||||
\
|
||||
const char *result = gandiva::HashUtils::hash_using_SHA256(context, \
|
||||
const char *result = gandiva::HashUtils::HashUsingSha256(context, \
|
||||
&value_as_long, \
|
||||
sizeof(value_as_long), \
|
||||
out_length); \
|
||||
@@ -188,7 +188,7 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
|
||||
return ""; \
|
||||
} \
|
||||
\
|
||||
return gandiva::HashUtils::hash_using_SHA256(context, value, value_length, out_length); \
|
||||
return gandiva::HashUtils::HashUsingSha256(context, value, value_length, out_length); \
|
||||
}
|
||||
|
||||
// Expand inner macro for all numeric types.
|
||||
|
||||
@@ -21,26 +21,26 @@
|
||||
#include "execution_context.h"
|
||||
|
||||
namespace gandiva {
|
||||
const char* HashUtils::hash_using_SHA256(int64_t context,
|
||||
const char* HashUtils::HashUsingSha256(int64_t context,
|
||||
const void* message,
|
||||
size_t message_length,
|
||||
u_int32_t* out_length) {
|
||||
return HashUtils::get_hash(context, message, message_length, EVP_sha256(), out_length);
|
||||
return HashUtils::GetHash(context, message, message_length, EVP_sha256(), out_length);
|
||||
}
|
||||
const char* HashUtils::hash_using_SHA128(int64_t context,
|
||||
const char* HashUtils::HashUsingSha128(int64_t context,
|
||||
const void* message,
|
||||
size_t message_length,
|
||||
u_int32_t* out_length) {
|
||||
return HashUtils::get_hash(context, message, message_length, EVP_sha1(), out_length);
|
||||
return HashUtils::GetHash(context, message, message_length, EVP_sha1(), out_length);
|
||||
}
|
||||
|
||||
const char* HashUtils::get_hash(int64_t context,
|
||||
const void* message,
|
||||
size_t message_length,
|
||||
const EVP_MD *hash_type,
|
||||
u_int32_t* out_length) {
|
||||
const char* HashUtils::GetHash(int64_t context,
|
||||
const void* message,
|
||||
size_t message_length,
|
||||
const EVP_MD *hash_type,
|
||||
u_int32_t* out_length) {
|
||||
if(message == nullptr){
|
||||
HashUtils::error_message(context, "A null value was given to be hashed.");
|
||||
HashUtils::ErrorMessage(context, "A null value was given to be hashed.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace gandiva {
|
||||
char* hex_buffer = new char[4];
|
||||
char* result_buffer = new char[65];
|
||||
|
||||
clean_char_array(hex_buffer);
|
||||
clean_char_array(result_buffer);
|
||||
CleanCharArray(hex_buffer);
|
||||
CleanCharArray(result_buffer);
|
||||
|
||||
for (unsigned int j = 0; j < result_length; j++) {
|
||||
unsigned char hex_number = result[j];
|
||||
@@ -80,17 +80,17 @@ namespace gandiva {
|
||||
return result_buffer;
|
||||
}
|
||||
|
||||
uint64_t HashUtils::double_to_long(double value) {
|
||||
uint64_t HashUtils::DoubleToLong(double value) {
|
||||
uint64_t result;
|
||||
memcpy(&result, &value, sizeof(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
void HashUtils::clean_char_array(char *buffer) {
|
||||
void HashUtils::CleanCharArray(char *buffer) {
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
void HashUtils::error_message(int64_t context_ptr, char const *err_msg){
|
||||
void HashUtils::ErrorMessage(int64_t context_ptr, char const *err_msg){
|
||||
auto context = reinterpret_cast<gandiva::ExecutionContext*>(context_ptr);
|
||||
context->set_error_msg(err_msg);
|
||||
}
|
||||
|
||||
@@ -26,27 +26,27 @@
|
||||
namespace gandiva {
|
||||
class GANDIVA_EXPORT HashUtils {
|
||||
public:
|
||||
static const char *hash_using_SHA256(int64_t context,
|
||||
static const char *HashUsingSha256(int64_t context,
|
||||
const void *message,
|
||||
size_t message_length,
|
||||
u_int32_t *out_length);
|
||||
|
||||
static const char *hash_using_SHA128(int64_t context,
|
||||
static const char *HashUsingSha128(int64_t context,
|
||||
const void *message,
|
||||
size_t message_length,
|
||||
u_int32_t *out_length);
|
||||
|
||||
static uint64_t double_to_long(double value);
|
||||
static uint64_t DoubleToLong(double value);
|
||||
private:
|
||||
static inline void clean_char_array(char *buffer);
|
||||
static inline void CleanCharArray(char *buffer);
|
||||
|
||||
static const char *get_hash(int64_t context,
|
||||
const void *message,
|
||||
size_t message_length,
|
||||
const EVP_MD *hash_type,
|
||||
u_int32_t *out_length);
|
||||
static const char *GetHash(int64_t context,
|
||||
const void *message,
|
||||
size_t message_length,
|
||||
const EVP_MD *hash_type,
|
||||
u_int32_t *out_length);
|
||||
|
||||
static void error_message(int64_t context_ptr, char const *err_msg);
|
||||
static void ErrorMessage(int64_t context_ptr, char const *err_msg);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user