Skip to content

Commit

Permalink
fix(comments): address some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
thanh-nguyen-dang committed Jul 29, 2020
1 parent 9fbb696 commit 4c5d202
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tube/etl/indexers/aggregation/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ def add_program_name_to_parent(self):
found_program = -1
i = -1
for path in self.mapping["parent_props"]:
p = path.get("path")
p = path["path"]
i += 1
if p.startswith("program"):
found_program = i
break
if found_program == -1:
self.mapping["parent_props"].append(
{"path": "programs[{PROGRAM_N}:name]".format(PROGRAM_N=PROGRAM_NAME)}
Expand Down
5 changes: 5 additions & 0 deletions tube/etl/indexers/base/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ def write(self, df):
def get_props_from_data_row(self, df, props, to_tuple=False):
if df.isEmpty():
return df.mapValues(get_props_empty_values(props))
# names is dictionary which maps from the name of source fields in datatable to the list of ids
# of properties in dataframe
# example: names = {"gender": [1, 2], project_name: [3]}
names = {}
# values is a dictionary which defines the mapping values (if exist) for each field.
# values = {"code": {1: {"male": "M", "female": "F"}, 2: {"male": "Male", "female": "Female}}, "project_name": {}}
values = {}
for p in props:
n = names.get(p.src, [])
Expand Down

0 comments on commit 4c5d202

Please sign in to comment.