wolfier opened a new issue #15976:
URL: https://github.com/apache/airflow/issues/15976


   **Apache Airflow version**: 2.0.2
   
   **What happened**:
   
   Under Browse, when querying with any empty datetime fields, I received the 
mushroom cloud.
   
   ```
   Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in 
wsgi_app
       response = self.full_dispatch_request()
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in 
full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in 
handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, 
in reraise
       raise value
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in 
dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/security/decorators.py",
 line 109, in wraps
       return f(self, *args, **kwargs)
     File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/views.py", 
line 551, in list
       widgets = self._list()
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/baseviews.py", line 
1127, in _list
       page_size=page_size,
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/baseviews.py", line 
1026, in _get_list_widget
       page_size=page_size,
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/models/sqla/interface.py",
 line 425, in query
       count = self.query_count(query, filters, select_columns)
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/models/sqla/interface.py",
 line 347, in query_count
       query, filters, select_columns=select_columns, aliases_mapping={}
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/models/sqla/interface.py",
 line 332, in _apply_inner_all
       query = self.apply_filters(query, inner_filters)
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/models/sqla/interface.py",
 line 187, in apply_filters
       return filters.apply_all(query)
     File 
"/usr/local/lib/python3.7/site-packages/flask_appbuilder/models/filters.py", 
line 298, in apply_all
       query = flt.apply(query, value)
     File "/usr/local/lib/python3.7/site-packages/airflow/www/utils.py", line 
373, in apply
       value = timezone.parse(value, timezone=timezone.utc)
     File "/usr/local/lib/python3.7/site-packages/airflow/utils/timezone.py", 
line 173, in parse
       return pendulum.parse(string, tz=timezone or TIMEZONE, strict=False)  # 
type: ignore
     File "/usr/local/lib/python3.7/site-packages/pendulum/parser.py", line 29, 
in parse
       return _parse(text, **options)
     File "/usr/local/lib/python3.7/site-packages/pendulum/parser.py", line 45, 
in _parse
       parsed = base_parse(text, **options)
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/parsing/__init__.py", line 74, 
in parse
       return _normalize(_parse(text, **_options), **_options)
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/parsing/__init__.py", line 
120, in _parse
       return _parse_common(text, **options)
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/parsing/__init__.py", line 
177, in _parse_common
       return date(year, month, day)
   ValueError: year 0 is out of range
   ```
   
   **What you expected to happen**:
   
   Perhaps give a warning/error banner that indicate Airflow cannot perform the 
search with bad input. I think it'll also work if the datetime picker defaults 
the timestamp to the current time.
   
   It looks like some fields are equipped to do that but not all.
   
   **How to reproduce it**:
   1. Go under Browse
   2. Try to query with empty datetime picket
   
   **Anything else we need to know**:
   ![Screen Shot 2021-05-20 at 5 12 54 
PM](https://user-images.githubusercontent.com/5952735/119063940-12b13f80-b98f-11eb-9b6f-a4d5c396e971.png)
   ![Screen Shot 2021-05-20 at 5 13 36 
PM](https://user-images.githubusercontent.com/5952735/119063945-1349d600-b98f-11eb-91cd-92d813414eba.png)
   ![Screen Shot 2021-05-20 at 5 12 35 
PM](https://user-images.githubusercontent.com/5952735/119063948-13e26c80-b98f-11eb-945f-1439a263fc58.png)
   ![Screen Shot 2021-05-20 at 5 14 17 
PM](https://user-images.githubusercontent.com/5952735/119063949-147b0300-b98f-11eb-8e8c-d5ee1e23bfc1.png)
   ![Screen Shot 2021-05-20 at 5 14 37 
PM](https://user-images.githubusercontent.com/5952735/119063950-147b0300-b98f-11eb-9055-c89518bf8524.png)
   ![Screen Shot 2021-05-20 at 5 15 01 
PM](https://user-images.githubusercontent.com/5952735/119063951-147b0300-b98f-11eb-8323-7602bf673205.png)
   
   


-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to