Skip to content

Commit

Permalink
fix empty fields
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 12, 2024
1 parent f31390c commit 8c06f0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cid/helpers/cur_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def get_sql_expression(self, field, field_type):
if not self.cur.column_exists(requirement):
missing_requirements.append(requirement)

if missing_requirements:
if missing_requirements and field_type.lower() in empty:
logger.trace(f'field {field} cannot be present as prereqs are missing in source cur: {missing_requirements}')
return empty[field_type.lower()]

Expand All @@ -508,10 +508,10 @@ def get_sql_expression(self, field, field_type):
keys_set = set(self.exposed_maps.get(field, set()))
keys_set.update(self.fields_to_expose_in_maps.get(map_field, set()))
for key in keys_set:
if f'{map_field}_{key}' in self.cur.fields:
if self.cur.column_exists(f'{map_field}_{key}'):
map_mapping[key] = f'{map_field}_{key}'
else:
map_mapping[key] = 'CAST(NULL as VARCHAR)'
map_mapping[key] = empty['string'] # all known maps have string vaules for now
if not map_mapping:
return 'cast(NULL AS MAP<VARCHAR, VARCHAR>)'
map_mapping = dict(sorted(map_mapping.items())) # ordered dict
Expand Down

0 comments on commit 8c06f0a

Please sign in to comment.