When big data is counted, it is necessary to calculate the opening order minus the broker's time difference, equal to n hours or weeks of orders.
The Presto SQL statements are as follows:
Select sum(profit) fromT_tablewhereOpen_time> '1970-01-01 00:00:00.0' andOpen_time< '2018-06-02 00:24:18.0' andHour (Date_parse (Open_time,'%y-%m-%d%h:%i:%s.%f'))- 6 = +;
select sum (profit) from t_table where open_time > " 1970-01-01 00:00:00.0 " and open_time < " 2018-06-02 00:24:18.0 " and Dow (Date_parse (Open_time, " %y-%m-%d%h:%i:%s.%f ")) - 6 = 2 ;
SQLAlchemy Filter Conditional notation:
Filter (Extract ('Hour',cast(T_table.open_time,TIMESTAMP))- 6 == +)--WeekFilter (Extract ('Dow',cast(cast(T_table.open_time,TIMESTAMP)- text("Interval'6'Hour "),TIMESTAMP))== 2)
and[? nd; (?) n;? nd]DetailXBasic TranslationConj. and, with; n.; (and) Names of persons; (TU, Sweden) EnderNetwork explanationAnd: And how: indeed Yuan and: Yuho
SQLAlchemy Presto Time Comparison