JingDas opened a new pull request, #24990:
URL: https://github.com/apache/doris/pull/24990

   ## Proposed changes
   
   Infer the column name when create view if the column is expression
   
   ## Further comments
   This is the inferred column name strategy:
   expr                       example                             Inferred 
column name(if position is 2)
   cast                      cast(1 as bigint)                     __cast_1
   function               dayofyear()                             __dayofyear_1
   anylyticExpr         min()                                       __min_1
   predicate              1 in (1,2,3)                              
__in_predicate_1
   literal                     1 or 'string_var_name'         __literal_1
   arithmeticExpr      | or *                                      
__arithmetic_expr_1
   identifier                field a or b                            a or b
   
   SQL for example:
   `CREATE VIEW v1 AS 
   SELECT 
     error_code,
     1, 
     'string', 
     now(), 
     dayofyear(op_time), 
     cast (source AS BIGINT), 
     min(`timestamp`) OVER (
       ORDER BY 
         op_time DESC ROWS BETWEEN UNBOUNDED PRECEDING
         AND 1 FOLLOWING
     ), 
     1 > 2,
     2 + 3,
     1 IN (1, 2, 3, 4), 
     remark LIKE '%like', 
     CASE WHEN remark = 's' THEN 1 ELSE 2 END,
     TRUE | FALSE 
   FROM 
     db_test.table_test1`
   
   the output column name is as following:
   
`error_code|__literal_1|__literal_2|__now_3|__dayofyear_4|__cast_expr_5|__min_6|__binary_predicate_7|__arithmetic_expr_8|__in_predicate_9|__like_predicate_10|__case_expr_11|__arithmetic_expr_12|
   
----------+-----------+-----------+-------+-------------+-------------+-------+--------------------+-------------------+----------------+-------------------+--------------+--------------------+`
   
   
   
   
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to