uranusjr commented on code in PR #24219:
URL: https://github.com/apache/airflow/pull/24219#discussion_r889827616
##########
airflow/providers/apache/hive/operators/hive_stats.py:
##########
@@ -100,15 +100,15 @@ def get_default_exprs(self, col: str, col_type: str) ->
Dict[Any, Any]:
if col in self.excluded_columns:
return {}
exp = {(col, 'non_null'): f"COUNT({col})"}
- if col_type in ['double', 'int', 'bigint', 'float']:
+ if col_type in {'double', 'int', 'bigint', 'float'}:
Review Comment:
For short literal lists, converting to set is actually not a significant
gain since creating a set is slower than list. (And tuple is probably faster.)
But this is OK either way.
##########
airflow/providers/apache/hive/operators/hive_stats.py:
##########
@@ -100,15 +100,15 @@ def get_default_exprs(self, col: str, col_type: str) ->
Dict[Any, Any]:
if col in self.excluded_columns:
return {}
exp = {(col, 'non_null'): f"COUNT({col})"}
- if col_type in ['double', 'int', 'bigint', 'float']:
+ if col_type in {'double', 'int', 'bigint', 'float'}:
exp[(col, 'sum')] = f'SUM({col})'
exp[(col, 'min')] = f'MIN({col})'
exp[(col, 'max')] = f'MAX({col})'
exp[(col, 'avg')] = f'AVG({col})'
elif col_type == 'boolean':
exp[(col, 'true')] = f'SUM(CASE WHEN {col} THEN 1 ELSE 0 END)'
exp[(col, 'false')] = f'SUM(CASE WHEN NOT {col} THEN 1 ELSE 0 END)'
- elif col_type in ['string']:
+ elif col_type in {'string'}:
Review Comment:
```suggestion
elif col_type == 'string':
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]