Skip to content

Commit dd4a16c

Browse files
committed
remove annotation for drift.recursive_reference when generating json
1 parent 53b7153 commit dd4a16c

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

presto-native-execution/presto_cpp/main/thrift/presto_thrift.thrift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ struct TaskUpdateRequest {
495495
struct ExecutionFailureInfo {
496496
1: string type;
497497
2: string message;
498-
3: optional ExecutionFailureInfo cause (cpp.ref_type="shared");
498+
3: optional ExecutionFailureInfo cause (cpp.ref_type="shared", drift.recursive_reference=true);
499499
4: list<ExecutionFailureInfo> suppressed;
500500
5: list<string> stack;
501501
6: ErrorLocation errorLocation;

presto-native-execution/presto_cpp/main/thrift/thrift2json.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import json
1515
import sys
16+
import os
1617

1718
from ptsd_jbroll import ast
1819
from ptsd_jbroll.loader import Loader
@@ -31,7 +32,19 @@ class attrdict(dict):
3132
__setattr__ = dict.__setitem__
3233

3334

34-
loader = Loader(sys.argv[1], logger=devnull)
35+
def preprocess(file_path, output_temp_path):
36+
with open(file_path, 'r') as file:
37+
lines = file.readlines()
38+
modified_lines = []
39+
for line in lines:
40+
if '(cpp.ref_type="shared", drift.recursive_reference=true)' in line:
41+
modified_line = line.replace('(cpp.ref_type="shared", drift.recursive_reference=true)', '(cpp.ref_type="shared")')
42+
modified_lines.append(modified_line)
43+
else:
44+
modified_lines.append(line)
45+
with open(output_temp_path, 'w') as file:
46+
file.writelines(modified_lines)
47+
3548

3649
typeMap = {
3750
"byte": "byte",
@@ -104,8 +117,16 @@ def items(module):
104117
return i
105118

106119

107-
everything = [{"comment": "// This file is generated DO NOT EDIT @" + "generated"}]
108-
for module in loader.modules.values():
109-
everything.extend(items(module))
120+
def main():
121+
preprocess(sys.argv[1], "temp_presto_thrift.thrift")
122+
loader = Loader("temp_presto_thrift.thrift", logger=devnull)
123+
everything = [{"comment": "// This file is generated DO NOT EDIT @" + "generated"}]
124+
for module in loader.modules.values():
125+
everything.extend(items(module))
126+
127+
print(json.dumps(everything))
128+
os.remove("temp_presto_thrift.thrift")
129+
110130

111-
print(json.dumps(everything))
131+
if __name__ == "__main__":
132+
sys.exit(main())

0 commit comments

Comments
 (0)