Skip to content

Commit

Permalink
Remove redundant else branches
Browse files Browse the repository at this point in the history
  • Loading branch information
hashhar committed Jan 21, 2024
1 parent 2c8418b commit 7f831dc
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions trino/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _create_value_mapper(self, column) -> ValueMapper:
if col_type == 'array':
value_mapper = self._create_value_mapper(column['arguments'][0]['value'])
return ArrayValueMapper(value_mapper)
elif col_type == 'row':
if col_type == 'row':
mappers = []
names = []
types = []
Expand All @@ -221,30 +221,29 @@ def _create_value_mapper(self, column) -> ValueMapper:
names.append(arg['value']['fieldName']['name'] if "fieldName" in arg['value'] else None)
types.append(arg['value']['typeSignature']['rawType'])
return RowValueMapper(mappers, names, types)
elif col_type == 'map':
if col_type == 'map':
key_mapper = self._create_value_mapper(column['arguments'][0]['value'])
value_mapper = self._create_value_mapper(column['arguments'][1]['value'])
return MapValueMapper(key_mapper, value_mapper)
elif col_type.startswith('decimal'):
if col_type.startswith('decimal'):
return DecimalValueMapper()
elif col_type.startswith('double') or col_type.startswith('real'):
if col_type.startswith('double') or col_type.startswith('real'):
return DoubleValueMapper()
elif col_type.startswith('timestamp') and 'with time zone' in col_type:
if col_type.startswith('timestamp') and 'with time zone' in col_type:
return TimestampWithTimeZoneValueMapper(self._get_precision(column))
elif col_type.startswith('timestamp'):
if col_type.startswith('timestamp'):
return TimestampValueMapper(self._get_precision(column))
elif col_type.startswith('time') and 'with time zone' in col_type:
if col_type.startswith('time') and 'with time zone' in col_type:
return TimeWithTimeZoneValueMapper(self._get_precision(column))
elif col_type.startswith('time'):
if col_type.startswith('time'):
return TimeValueMapper(self._get_precision(column))
elif col_type == 'date':
if col_type == 'date':
return DateValueMapper()
elif col_type == 'varbinary':
if col_type == 'varbinary':
return BinaryValueMapper()
elif col_type == 'uuid':
if col_type == 'uuid':
return UuidValueMapper()
else:
return NoOpValueMapper()
return NoOpValueMapper()

def _get_precision(self, column: Dict[str, Any]):
args = column['arguments']
Expand Down

0 comments on commit 7f831dc

Please sign in to comment.