You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2019/11/29 12:50:45 UTC
[incubator-doris] branch master updated: Make FE compile support
Mac (#2334)
This is an automated email from the ASF dual-hosted git repository.
zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 8787a59 Make FE compile support Mac (#2334)
8787a59 is described below
commit 8787a59cb4a1bc68a222a8cdb9e53d787a540d09
Author: kangkaisen <ka...@apache.org>
AuthorDate: Fri Nov 29 20:50:35 2019 +0800
Make FE compile support Mac (#2334)
---
gensrc/script/doris_builtins_functions.py | 3 +++
gensrc/script/doris_functions.py | 13 ++++++++-----
gensrc/script/gen_builtins_functions.py | 3 +++
gensrc/script/gen_functions.py | 23 +++++++++++++----------
gensrc/script/gen_opcodes.py | 19 +++++++++++--------
gensrc/script/gen_vector_functions.py | 23 +++++++++++++----------
6 files changed, 51 insertions(+), 33 deletions(-)
diff --git a/gensrc/script/doris_builtins_functions.py b/gensrc/script/doris_builtins_functions.py
index d5e1abc..9e262da 100755
--- a/gensrc/script/doris_builtins_functions.py
+++ b/gensrc/script/doris_builtins_functions.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
diff --git a/gensrc/script/doris_functions.py b/gensrc/script/doris_functions.py
index 31b8786..e6e7742 100755
--- a/gensrc/script/doris_functions.py
+++ b/gensrc/script/doris_functions.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -189,9 +192,9 @@ functions = [
['Timestamp_months_sub', 'DATETIME', ['DATETIME', 'INT'], \
'TimestampFunctions::months_sub', ['months_sub']],
['Timestamp_weeks_add', 'DATETIME', ['DATETIME', 'INT'], \
- 'TimestampFunctions::weeks_add', ['weeks_add']],
+ 'TimestampFunctions::weeks_add', ['weeks_add']],
['Timestamp_weeks_sub', 'DATETIME', ['DATETIME', 'INT'], \
- 'TimestampFunctions::weeks_sub', ['weeks_sub']],
+ 'TimestampFunctions::weeks_sub', ['weeks_sub']],
['Timestamp_days_add', 'DATETIME', ['DATETIME', 'INT'], \
'TimestampFunctions::days_add', ['days_add', 'date_add', 'adddate']],
['Timestamp_days_sub', 'DATETIME', ['DATETIME', 'INT'], \
@@ -309,10 +312,10 @@ udf_functions = [
''],
['Udf_Math_Abs', 'DECIMALV2', ['DECIMALV2'], 'UdfBuiltins::decimal_abs', ['udf_abs'],
''],
- ['Udf_Sub_String', 'VARCHAR', ['VARCHAR', 'INT', 'INT'],
- ['Udf_Sub_String', 'VARCHAR', ['VARCHAR', 'INT', 'INT'],
+ ['Udf_Sub_String', 'VARCHAR', ['VARCHAR', 'INT', 'INT'],
+ ['Udf_Sub_String', 'VARCHAR', ['VARCHAR', 'INT', 'INT'],
'UdfBuiltins::sub_string', ['udf_substring'], ''],
- ['Udf_Add_Two_Number', 'BIGINT', ['BIGINT', 'BIGINT'],
+ ['Udf_Add_Two_Number', 'BIGINT', ['BIGINT', 'BIGINT'],
'UdfBuiltins::add_two_number', ['udf_add_two_number'], ''],
['Udf_Math_Pi', 'DOUBLE', [], 'UdfBuiltins::pi', ['udf_pi'],
'_ZN6impala11UdfBuiltins2PiEPN10impala_udf15FunctionContextE'],
diff --git a/gensrc/script/gen_builtins_functions.py b/gensrc/script/gen_builtins_functions.py
index 6cef755..8e906b7 100755
--- a/gensrc/script/gen_builtins_functions.py
+++ b/gensrc/script/gen_builtins_functions.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
"""
This module is doris builtin functions
"""
diff --git a/gensrc/script/gen_functions.py b/gensrc/script/gen_functions.py
index 0a04aa8..ad3a969 100755
--- a/gensrc/script/gen_functions.py
+++ b/gensrc/script/gen_functions.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -674,7 +677,7 @@ if __name__ == "__main__":
h_file.write(h_preamble)
cc_file.write(cc_preamble)
python_file.write(python_preamble)
-
+
# Generate functions and headers
for func_data in functions:
op = func_data[0]
@@ -686,7 +689,7 @@ if __name__ == "__main__":
if not op in templates:
continue
template = templates[op]
-
+
# Expand all arguments
return_types = []
for ret in func_data[1]:
@@ -699,48 +702,48 @@ if __name__ == "__main__":
for t in types[arg]:
expanded_arg.append(t)
signatures.append(expanded_arg)
-
+
# Put arguments into substitution structure
num_functions = 0
for args in signatures:
num_functions = max(num_functions, len(args))
num_functions = max(num_functions, len(return_types))
num_args = len(signatures)
-
+
# Validate the input is correct
if len(return_types) != 1 and len(return_types) != num_functions:
print "Invalid Declaration: " + func_data
sys.exit(1)
-
+
for args in signatures:
if len(args) != 1 and len(args) != num_functions:
print "Invalid Declaration: " + func_data
sys.exit(1)
-
+
# Iterate over every function signature to generate
for i in range(0, num_functions):
if len(return_types) == 1:
return_type = return_types[0]
else:
return_type = return_types[i]
-
+
arg_types = []
for j in range(0, num_args):
if len(signatures[j]) == 1:
arg_types.append(signatures[j][0])
else:
arg_types.append(signatures[j][i])
-
+
# At this point, 'return_type' is a single type and 'arg_types'
# is a list of single types
sub = initialize_sub(op, return_type, arg_types)
if template == binary_func:
sub["native_func"] = native_funcs[op.upper()]
-
+
h_file.write(header_template.substitute(sub))
cc_file.write(template.substitute(sub))
python_file.write(python_template.substitute(sub))
-
+
h_file.write(h_epilogue)
cc_file.write(cc_epilogue)
python_file.write(python_epilogue)
diff --git a/gensrc/script/gen_opcodes.py b/gensrc/script/gen_opcodes.py
index e14d8f5..94ce47e 100755
--- a/gensrc/script/gen_opcodes.py
+++ b/gensrc/script/gen_opcodes.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -203,7 +206,7 @@ def add_function(fn_meta_data, udf_interface, is_vector_function=False):
ret_type = fn_meta_data[1]
args = fn_meta_data[2]
be_fn = fn_meta_data[3]
-
+
entry = {}
entry["fn_name"] = fn_name
entry["ret_type"] = fn_meta_data[1]
@@ -216,7 +219,7 @@ def add_function(fn_meta_data, udf_interface, is_vector_function=False):
else:
entry["symbol"] = "<no symbol specified>"
entry["udf_interface"] = udf_interface
-
+
if fn_name in meta_data_entries:
meta_data_entries[fn_name].append(entry)
else:
@@ -260,7 +263,7 @@ def generate_be_registry_init(filename):
"""
cc_registry_file = open(filename, "w")
cc_registry_file.write(cc_registry_preamble)
-
+
for fn in meta_data_entries:
entries = meta_data_entries[fn]
for entry in entries:
@@ -275,7 +278,7 @@ def generate_be_registry_init(filename):
cc_output = 'TExprOpcode::%s, (void*)(Expr::ComputeFn)%s, "%s"' \
% (opcode, be_fn, symbol)
cc_registry_file.write(" this->add(%s);\n" % (cc_output))
-
+
cc_registry_file.write(cc_registry_epilogue)
cc_registry_file.close()
@@ -288,7 +291,7 @@ def generate_fe_registry_init(filename):
"""
java_registry_file = open(filename, "w")
java_registry_file.write(java_registry_preamble)
-
+
for fn in meta_data_entries:
entries = meta_data_entries[fn]
for entry in entries:
@@ -314,9 +317,9 @@ def generate_fe_registry_init(filename):
java_output += ", PrimitiveType." + arg
java_registry_file.write(" result &= registry.add(%s);\n" % java_output)
java_registry_file.write("\n")
-
+
mappings = {}
-
+
for fn in meta_data_entries:
entries = meta_data_entries[fn]
for entry in entries:
@@ -334,7 +337,7 @@ def generate_fe_registry_init(filename):
java_registry_file.write(" result &= registry.addFunctionMapping(%s);\n" \
% java_output)
java_registry_file.write("\n")
-
+
java_registry_file.write(java_registry_epilogue)
java_registry_file.close()
diff --git a/gensrc/script/gen_vector_functions.py b/gensrc/script/gen_vector_functions.py
index b1aa3e1..75ecbfe 100755
--- a/gensrc/script/gen_vector_functions.py
+++ b/gensrc/script/gen_vector_functions.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -487,7 +490,7 @@ if __name__ == "__main__":
h_file.write(h_preamble)
cc_file.write(cc_preamble)
python_file.write(python_preamble)
-
+
# Generate functions and headers
for func_data in functions:
op = func_data[0]
@@ -499,7 +502,7 @@ if __name__ == "__main__":
if not op in templates:
continue
template = templates[op]
-
+
# Expand all arguments
return_types = []
for ret in func_data[1]:
@@ -512,46 +515,46 @@ if __name__ == "__main__":
for t in types[arg]:
expanded_arg.append(t)
signatures.append(expanded_arg)
-
+
# Put arguments into substitution structure
num_functions = 0
for args in signatures:
num_functions = max(num_functions, len(args))
num_functions = max(num_functions, len(return_types))
num_args = len(signatures)
-
+
# Validate the input is correct
if len(return_types) != 1 and len(return_types) != num_functions:
print "Invalid Declaration: " + func_data
sys.exit(1)
-
+
for args in signatures:
if len(args) != 1 and len(args) != num_functions:
print "Invalid Declaration: " + func_data
sys.exit(1)
-
+
# Iterate over every function signature to generate
for i in range(0, num_functions):
if len(return_types) == 1:
return_type = return_types[0]
else:
return_type = return_types[i]
-
+
arg_types = []
for j in range(0, num_args):
if len(signatures[j]) == 1:
arg_types.append(signatures[j][0])
else:
arg_types.append(signatures[j][i])
-
+
# At this point, 'return_type' is a single type and 'arg_types'
# is a list of single types
sub = initialize_sub(op, return_type, arg_types)
-
+
h_file.write(header_template.substitute(sub))
cc_file.write(template.substitute(sub))
python_file.write(python_template.substitute(sub))
-
+
h_file.write(h_epilogue)
cc_file.write(cc_epilogue)
python_file.write(python_epilogue)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org