Fix linter errors

This commit is contained in:
Anthony Louis committed 2021-04-09 19:34:23 -03:00
1 parent adadbdd840
commit a3200b9933
5 files changed
+152 -158

No files matched your search

+4 -4
View File
@@ -212,22 +212,22 @@ typedef std::unordered_map<const FunctionSignature*, const NativeFunction*, KeyH
// - NULL handling is of type NULL_NEVER
// - can return errors
//
// The function name includes the base name & input type name. gdv_fn_sha128_from_float64
// The function name includes the base name & input type name. gdv_fn_sha128_float64
#define HASH_SHA128_NULL_NEVER(NAME, ALIASES, TYPE) \
NativeFunction(#NAME, std::vector<std::string> ALIASES, \
DataTypeVector{TYPE()}, utf8(), kResultNullNever, \
ARROW_STRINGIFY(gdv_fn_sha128_from_##TYPE), \
ARROW_STRINGIFY(gdv_fn_sha128_##TYPE), \
NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors)
// HashSHA256 functions that :
// - NULL handling is of type NULL_NEVER
// - can return errors
//
// The function name includes the base name & input type name. gdv_fn_sha256_from_float64
// The function name includes the base name & input type name. gdv_fn_sha256_float64
#define HASH_SHA256_NULL_NEVER(NAME, ALIASES, TYPE) \
NativeFunction(#NAME, std::vector<std::string> ALIASES, \
DataTypeVector{TYPE()}, utf8(), kResultNullNever, \
ARROW_STRINGIFY(gdv_fn_sha256_from_##TYPE), \
ARROW_STRINGIFY(gdv_fn_sha256_##TYPE), \
NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors)
// Iterate the inner macro over all numeric types
+119 -125
View File
@@ -125,9 +125,9 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
#define SHA128_HASH_FUNCTION(TYPE) \
GANDIVA_EXPORT \
const char *gdv_fn_sha128_from_##TYPE(int64_t context, gdv_##TYPE value, \
const char *gdv_fn_sha128_##TYPE(int64_t context, gdv_##TYPE value, \
bool validity, u_int32_t *out_length) { \
if(!validity){ \
if (!validity) { \
*out_length = 0; \
return ""; \
} \
@@ -136,30 +136,30 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
&value_as_long, \
sizeof(value_as_long), \
out_length); \
\
\
return result; \
} \
#define SHA128_HASH_FUNCTION_BUF(TYPE) \
GANDIVA_EXPORT \
const char *gdv_fn_sha128_from_##TYPE(int64_t context, \
gdv_##TYPE value, \
const char *gdv_fn_sha128_##TYPE(int64_t context, \
gdv_##TYPE value, \
int32_t value_length, \
bool value_validity, \
u_int32_t *out_length) { \
if(!value_validity){ \
if (!value_validity) { \
*out_length = 0; \
return ""; \
} \
} \
return gandiva::HashUtils::HashUsingSha128(context, value, \
value_length, out_length); \
}
#define SHA256_HASH_FUNCTION(TYPE) \
GANDIVA_EXPORT \
const char *gdv_fn_sha256_from_##TYPE(int64_t context, gdv_##TYPE value, \
const char *gdv_fn_sha256_##TYPE(int64_t context, gdv_##TYPE value, \
bool validity, u_int32_t *out_length) { \
if(!validity){ \
if (!validity) { \
*out_length = 0; \
return ""; \
} \
@@ -173,12 +173,12 @@ int32_t gdv_fn_populate_varlen_vector(int64_t context_ptr, int8_t* data_ptr,
#define SHA256_HASH_FUNCTION_BUF(TYPE) \
GANDIVA_EXPORT \
const char *gdv_fn_sha256_from_##TYPE(int64_t context, \
const char *gdv_fn_sha256_##TYPE(int64_t context, \
gdv_##TYPE value, \
int32_t value_length, \
bool value_validity, \
u_int32_t *out_length) { \
if(!value_validity){ \
if (!value_validity) { \
*out_length = 0; \
return ""; \
} \
@@ -223,11 +223,10 @@ SHA_VAR_LEN_PARAMS(SHA128_HASH_FUNCTION_BUF)
// Add functions for decimal128
GANDIVA_EXPORT
const char* gdv_fn_sha256_from_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
const char* gdv_fn_sha256_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
int32_t x_precision, int32_t x_scale,
gdv_boolean x_isvalid, u_int32_t *out_length) {
if(!x_isvalid){
if (!x_isvalid) {
*out_length = 0;
return "";
}
@@ -238,10 +237,10 @@ const char* gdv_fn_sha256_from_decimal128(int64_t context, int64_t x_high, uint6
}
GANDIVA_EXPORT
const char* gdv_fn_sha128_from_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
const char* gdv_fn_sha128_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
int32_t x_precision, int32_t x_scale,
gdv_boolean x_isvalid, u_int32_t *out_length) {
if(!x_isvalid){
if (!x_isvalid) {
*out_length = 0;
return "";
}
@@ -467,174 +466,170 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
engine->AddGlobalMappingForFunc("gdv_fn_castFLOAT8_utf8", types->double_type(), args,
reinterpret_cast<void*>(gdv_fn_castFLOAT8_utf8));
// gdv_fn_sha128_from_int8
// gdv_fn_sha128_int8
args = {
types->i64_type(), // context
types->i8_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_int8",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_int8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_int8));
reinterpret_cast<void *>(gdv_fn_sha128_int8));
// gdv_fn_sha128_from_int16
// gdv_fn_sha128_int16
args = {
types->i64_type(), // context
types->i16_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_int16",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_int16",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_int16));
reinterpret_cast<void *>(gdv_fn_sha128_int16));
// gdv_fn_sha128_from_int32
// gdv_fn_sha128_int32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_int32",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_int32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_int32));
reinterpret_cast<void *>(gdv_fn_sha128_int32));
// gdv_fn_sha128_from_int32
// gdv_fn_sha128_int32
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_int64",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_int64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_int64));
reinterpret_cast<void *>(gdv_fn_sha128_int64));
// gdv_fn_sha128_from_uint8
// gdv_fn_sha128_uint8
args = {
types->i64_type(), // context
types->i8_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_uint8",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_uint8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_uint8));
reinterpret_cast<void *>(gdv_fn_sha128_uint8));
// gdv_fn_sha128_from_uint16
// gdv_fn_sha128_uint16
args = {
types->i64_type(), // context
types->i16_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_uint16",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_uint16",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_uint16));
reinterpret_cast<void *>(gdv_fn_sha128_uint16));
// gdv_fn_sha128_from_uint32
// gdv_fn_sha128_uint32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_uint32",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_uint32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_uint32));
reinterpret_cast<void *>(gdv_fn_sha128_uint32));
// gdv_fn_sha128_from_uint64
// gdv_fn_sha128_uint64
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_uint64",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_uint64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_uint64));
reinterpret_cast<void *>(gdv_fn_sha128_uint64));
// gdv_fn_sha128_from_float32
// gdv_fn_sha128_float32
args = {
types->i64_type(), // context
types->float_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_float32",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_float32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_float32));
reinterpret_cast<void *>(gdv_fn_sha128_float32));
// gdv_fn_sha128_from_float64
// gdv_fn_sha128_float64
args = {
types->i64_type(), // context
types->double_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_float64",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_float64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_float64));
reinterpret_cast<void *>(gdv_fn_sha128_float64));
// gdv_fn_sha128_from_boolean
// gdv_fn_sha128_boolean
args = {
types->i64_type(), // context
types->i1_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_boolean",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_boolean",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_boolean));
reinterpret_cast<void *>(gdv_fn_sha128_boolean));
// gdv_fn_sha128_from_date64
// gdv_fn_sha128_date64
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_date64",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_date64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_date64));
reinterpret_cast<void *>(gdv_fn_sha128_date64));
// gdv_fn_sha128_from_date32
// gdv_fn_sha128_date32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_date32",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_date32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_date32)
);
reinterpret_cast<void *>(gdv_fn_sha128_date32));
// gdv_fn_sha128_from_time32
// gdv_fn_sha128_time32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_time32",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_time32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_time32)
);
reinterpret_cast<void *>(gdv_fn_sha128_time32));
// gdv_fn_sha128_from_timestamp
// gdv_fn_sha128_timestamp
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_timestamp",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_timestamp",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(
gdv_fn_sha128_from_timestamp
));
reinterpret_cast<void *>(gdv_fn_sha128_timestamp));
// gdv_fn_hash_sha128_from_utf8
args = {
@@ -645,9 +640,9 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
types->i32_ptr_type() // out
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_utf8",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_utf8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_utf8));
reinterpret_cast<void *>(gdv_fn_sha128_utf8));
// gdv_fn_hash_sha128_from_binary
args = {
@@ -658,175 +653,174 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
types->i32_ptr_type() // out
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_binary",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_binary",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_binary)
);
reinterpret_cast<void *>(gdv_fn_sha128_binary));
// gdv_fn_sha256_from_int8
// gdv_fn_sha256_int8
args = {
types->i64_type(), // context
types->i8_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_int8",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_int8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_int8));
reinterpret_cast<void *>(gdv_fn_sha256_int8));
// gdv_fn_sha256_from_int16
// gdv_fn_sha256_int16
args = {
types->i64_type(), // context
types->i16_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_int16",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_int16",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_int16));
reinterpret_cast<void *>(gdv_fn_sha256_int16));
// gdv_fn_sha256_from_int32
// gdv_fn_sha256_int32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_int32",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_int32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_int32));
reinterpret_cast<void *>(gdv_fn_sha256_int32));
// gdv_fn_sha256_from_int32
// gdv_fn_sha256_int32
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_int64",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_int64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_int64));
reinterpret_cast<void *>(gdv_fn_sha256_int64));
// gdv_fn_sha256_from_uint8
// gdv_fn_sha256_uint8
args = {
types->i64_type(), // context
types->i8_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_uint8",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_uint8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_uint8));
reinterpret_cast<void *>(gdv_fn_sha256_uint8));
// gdv_fn_sha256_from_uint16
// gdv_fn_sha256_uint16
args = {
types->i64_type(), // context
types->i16_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_uint16",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_uint16",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_uint16));
reinterpret_cast<void *>(gdv_fn_sha256_uint16));
// gdv_fn_sha256_from_uint32
// gdv_fn_sha256_uint32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_uint32",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_uint32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_uint32));
reinterpret_cast<void *>(gdv_fn_sha256_uint32));
// gdv_fn_sha256_from_uint64
// gdv_fn_sha256_uint64
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_uint64",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_uint64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_uint64));
reinterpret_cast<void *>(gdv_fn_sha256_uint64));
// gdv_fn_sha256_from_float32
// gdv_fn_sha256_float32
args = {
types->i64_type(), // context
types->float_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_float32",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_float32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_float32));
reinterpret_cast<void *>(gdv_fn_sha256_float32));
// gdv_fn_sha256_from_float64
// gdv_fn_sha256_float64
args = {
types->i64_type(), // context
types->double_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_float64",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_float64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_float64));
reinterpret_cast<void *>(gdv_fn_sha256_float64));
// gdv_fn_sha256_from_boolean
// gdv_fn_sha256_boolean
args = {
types->i64_type(), // context
types->i1_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_boolean",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_boolean",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_boolean));
reinterpret_cast<void *>(gdv_fn_sha256_boolean));
// gdv_fn_sha256_from_date64
// gdv_fn_sha256_date64
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_date64",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_date64",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_date64));
reinterpret_cast<void *>(gdv_fn_sha256_date64));
// gdv_fn_sha256_from_date32
// gdv_fn_sha256_date32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_date32",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_date32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_date32));
reinterpret_cast<void *>(gdv_fn_sha256_date32));
// gdv_fn_sha256_from_time32
// gdv_fn_sha256_time32
args = {
types->i64_type(), // context
types->i32_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_time32",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_time32",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_time32));
reinterpret_cast<void *>(gdv_fn_sha256_time32));
// gdv_fn_sha256_from_timestamp
// gdv_fn_sha256_timestamp
args = {
types->i64_type(), // context
types->i64_type(), // value
types->i1_type(), // validity
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_timestamp",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_timestamp",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_timestamp));
reinterpret_cast<void *>(gdv_fn_sha256_timestamp));
// gdv_fn_hash_sha256_from_utf8
args = {
@@ -837,9 +831,9 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
types->i32_ptr_type() // out
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_utf8",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_utf8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_utf8));
reinterpret_cast<void *>(gdv_fn_sha256_utf8));
// gdv_fn_hash_sha256_from_binary
args = {
@@ -850,11 +844,11 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
types->i32_ptr_type() // out
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_binary",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_binary",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_binary));
reinterpret_cast<void *>(gdv_fn_sha256_binary));
// gdv_fn_sha128_from_decimal128
// gdv_fn_sha128_decimal128
args = {
types->i64_type(), // context
types->i64_type(), // high_bits
@@ -865,10 +859,10 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
types->i32_ptr_type() // out length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha128_from_decimal128",
engine->AddGlobalMappingForFunc("gdv_fn_sha128_decimal128",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha128_from_decimal128));
// gdv_fn_sha256_from_decimal128
reinterpret_cast<void *>(gdv_fn_sha128_decimal128));
// gdv_fn_sha256_decimal128
args = {
types->i64_type(), // context
types->i64_type(), // high_bits
@@ -879,8 +873,8 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
types->i32_ptr_type() // out length
};
engine->AddGlobalMappingForFunc("gdv_fn_sha256_from_decimal128",
engine->AddGlobalMappingForFunc("gdv_fn_sha256_decimal128",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void *>(gdv_fn_sha256_from_decimal128));
reinterpret_cast<void *>(gdv_fn_sha256_decimal128));
}
} // namespace gandiva
+6 -6
View File
@@ -67,29 +67,29 @@ bool in_expr_lookup_utf8(int64_t ptr, const char* data, int data_len, bool in_va
int gdv_fn_time_with_zone(int* time_fields, const char* zone, int zone_len,
int64_t* ret_time);
const char *gdv_fn_sha256_from_float64(int64_t context, double value, bool validity,
const char *gdv_fn_sha256_float64(int64_t context, double value, bool validity,
unsigned int *out_length);
const char *gdv_fn_sha256_from_utf8(int64_t context,
const char *gdv_fn_sha256_utf8(int64_t context,
char *value,
int32_t value_length,
bool value_validity,
uint32_t *out_length);
const char *gdv_fn_sha128_from_float64(int64_t context, double value, bool validity,
const char *gdv_fn_sha128_float64(int64_t context, double value, bool validity,
unsigned int *out_length);
const char *gdv_fn_sha128_from_utf8(int64_t context,
const char *gdv_fn_sha128_utf8(int64_t context,
char *value,
int32_t value_length,
bool value_validity,
uint32_t *out_length);
const char* gdv_fn_sha256_from_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
const char* gdv_fn_sha256_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
int32_t x_precision, int32_t x_scale,
gdv_boolean x_isvalid, uint32_t *out_length);
const char* gdv_fn_sha128_from_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
const char* gdv_fn_sha128_decimal128(int64_t context, int64_t x_high, uint64_t x_low,
int32_t x_precision, int32_t x_scale,
gdv_boolean x_isvalid, uint32_t *out_length);
+2 -2
View File
@@ -18,7 +18,7 @@
#include <cstring>
#include "gandiva/hash_utils.h"
#include "openssl/evp.h"
#include "execution_context.h"
#include "gandiva/execution_context.h"
namespace gandiva {
const char* HashUtils::HashUsingSha256(int64_t context,
@@ -93,7 +93,7 @@ namespace gandiva {
for (unsigned int j = 0; j < result_length; j++) {
unsigned char hex_number = result[j];
sprintf(hex_buffer, "%02x", hex_number);
snprintf(hex_buffer, temporary_buffer_length, "%02x", hex_number);
strncat(result_buffer, hex_buffer, temporary_buffer_length);
}
+21 -21
View File
@@ -24,31 +24,31 @@
#include "openssl/evp.h"
namespace gandiva {
class GANDIVA_EXPORT HashUtils {
public:
static const char *HashUsingSha256(int64_t context,
const void *message,
size_t message_length,
u_int32_t *out_length);
class GANDIVA_EXPORT HashUtils {
public:
static const char *HashUsingSha256(int64_t context,
const void *message,
size_t message_length,
u_int32_t *out_length);
static const char *HashUsingSha128(int64_t context,
const void *message,
size_t message_length,
u_int32_t *out_length);
static const char *HashUsingSha128(int64_t context,
const void *message,
size_t message_length,
u_int32_t *out_length);
static uint64_t DoubleToLong(double value);
private:
static inline void CleanCharArray(char *buffer);
static uint64_t DoubleToLong(double value);
private:
static inline void CleanCharArray(char *buffer);
static const char *GetHash(int64_t context,
const void *message,
size_t message_length,
const EVP_MD *hash_type,
int result_buffer_size,
u_int32_t *out_length);
static const char *GetHash(int64_t context,
const void *message,
size_t message_length,
const EVP_MD *hash_type,
int result_buffer_size,
u_int32_t *out_length);
static void ErrorMessage(int64_t context_ptr, char const *err_msg);
};
static void ErrorMessage(int64_t context_ptr, char const *err_msg);
};
} // namespace gandiva
#endif //ARROW_SRC_HASH_UTILS_H_