[ 
https://issues.apache.org/jira/browse/SPARK-30203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kent Yao updated SPARK-30203:
-----------------------------
    Description: 
h3. 9.2 Store assignment
h4. Syntax Rules

1) Let T be the TARGET and let V be the VALUE in an application of the Syntax 
Rules of this Subclause.
 2) Let TD and SD be the declared types of T and V, respectively.
 3) If TD is character string, binary string, numeric, boolean, datetime, 
interval, or a user-defined type, then
 either SD shall be assignable to TD or there shall exist an appropriate 
user-defined cast function UDCF
 from SD to TD.
 _NOTE 319 — “Appropriate user-defined cast function” is defined in Subclause 
4.11, “Data conversions”_
h3.  4.11 Data conversions

Implicit type conversion can occur in expressions, fetch operations, single row 
select operations, inserts, deletes,
 and updates. Explicit type conversions can be specified by the use of the CAST 
operator.

 

The current implementation for ANSI store assignment is totally out of context. 

According to this rule, `there shall exist an appropriate user-defined cast 
function UDCF`, the spark legacy store assignment is just fine because we do 
have *appropriate cast* _*functions.*_

At least according to the ansi cast rule, the current ANSI assignment policy is 
too strict to the ANSI cast rules

 
{code:java}
* (SD) --------------------- (TD) -------------------------
*     | EN  AN  C  D  T  TS  YM  DT  BO  UDT  B  RT  CT  RW
* EN  |  Y   Y  Y  N  N   N   M   M   N   M   N   M   N   N
* AN  |  Y   Y  Y  N  N   N   N   N   N   M   N   M   N   N
*  C  |  Y   Y  Y  Y  Y   Y   Y   Y   Y   M   N   M   N   N
*  D  |  N   N  Y  Y  N   Y   N   N   N   M   N   M   N   N
*  T  |  N   N  Y  N  Y   Y   N   N   N   M   N   M   N   N
* TS  |  N   N  Y  Y  Y   Y   N   N   N   M   N   M   N   N
* YM  |  M   N  Y  N  N   N   Y   N   N   M   N   M   N   N
* DT  |  M   N  Y  N  N   N   N   Y   N   M   N   M   N   N
* BO  |  N   N  Y  N  N   N   N   N   Y   M   N   M   N   N
* UDT |  M   M  M  M  M   M   M   M   M   M   M   M   M   N
*  B  |  N   N  N  N  N   N   N   N   N   M   Y   M   N   N
* RT  |  M   M  M  M  M   M   M   M   M   M   M   M   N   N
* CT  |  N   N  N  N  N   N   N   N   N   M   N   N   M   N
* RW  |  N   N  N  N  N   N   N   N   N   N   N   N   N   M
*
* Where:
* EN = Exact Numeric
* AN = Approximate Numeric
* C = Character (Fixed- or Variable-Length, or Character Large Object)
* D = Date
* T = Time
* TS = Timestamp
* YM = Year-Month Interval
* DT = Day-Time Interval
* BO = Boolean
* UDT = User-Defined Type
* B = Binary (Fixed- or Variable-Length or Binary Large Object)
* RT = Reference type
* CT = Collection type
* RW = Row type
{code}
 

 

_cc [~cloud_fan] [~gengliang]_ [~maropu] 

 

  was:
h3. 9.2 Store assignment
h4. Syntax Rules

1) Let T be the TARGET and let V be the VALUE in an application of the Syntax 
Rules of this Subclause.
 2) Let TD and SD be the declared types of T and V, respectively.
 3) If TD is character string, binary string, numeric, boolean, datetime, 
interval, or a user-defined type, then
 either SD shall be assignable to TD or there shall exist an appropriate 
user-defined cast function UDCF
 from SD to TD.
 _NOTE 319 — “Appropriate user-defined cast function” is defined in Subclause 
4.11, “Data conversions”_
h3.  4.11 Data conversions

Implicit type conversion can occur in expressions, fetch operations, single row 
select operations, inserts, deletes,
and updates. Explicit type conversions can be specified by the use of the CAST 
operator.

 

The current implementation for ANSI store assignment is totally out of context. 

According to this rule, `there shall exist an appropriate user-defined cast 
function UDCF`, the spark legacy store assignment is just fine because we do 
have *a_ppropriate cast_* _*functions.*_

At least according to the ansi cast rule, the current ANSI assignment policy is 
too strict to the ANSI cast rules

 
{code:java}
* (SD) --------------------- (TD) -------------------------
*     | EN  AN  C  D  T  TS  YM  DT  BO  UDT  B  RT  CT  RW
* EN  |  Y   Y  Y  N  N   N   M   M   N   M   N   M   N   N
* AN  |  Y   Y  Y  N  N   N   N   N   N   M   N   M   N   N
*  C  |  Y   Y  Y  Y  Y   Y   Y   Y   Y   M   N   M   N   N
*  D  |  N   N  Y  Y  N   Y   N   N   N   M   N   M   N   N
*  T  |  N   N  Y  N  Y   Y   N   N   N   M   N   M   N   N
* TS  |  N   N  Y  Y  Y   Y   N   N   N   M   N   M   N   N
* YM  |  M   N  Y  N  N   N   Y   N   N   M   N   M   N   N
* DT  |  M   N  Y  N  N   N   N   Y   N   M   N   M   N   N
* BO  |  N   N  Y  N  N   N   N   N   Y   M   N   M   N   N
* UDT |  M   M  M  M  M   M   M   M   M   M   M   M   M   N
*  B  |  N   N  N  N  N   N   N   N   N   M   Y   M   N   N
* RT  |  M   M  M  M  M   M   M   M   M   M   M   M   N   N
* CT  |  N   N  N  N  N   N   N   N   N   M   N   N   M   N
* RW  |  N   N  N  N  N   N   N   N   N   N   N   N   N   M
*
* Where:
* EN = Exact Numeric
* AN = Approximate Numeric
* C = Character (Fixed- or Variable-Length, or Character Large Object)
* D = Date
* T = Time
* TS = Timestamp
* YM = Year-Month Interval
* DT = Day-Time Interval
* BO = Boolean
* UDT = User-Defined Type
* B = Binary (Fixed- or Variable-Length or Binary Large Object)
* RT = Reference type
* CT = Collection type
* RW = Row type
{code}
 

 

_cc [~cloud_fan] [~gengliang]_ [~maropu] 

 


> store assignable if there exists an appropriate user-defined cast function
> --------------------------------------------------------------------------
>
>                 Key: SPARK-30203
>                 URL: https://issues.apache.org/jira/browse/SPARK-30203
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Kent Yao
>            Priority: Major
>
> h3. 9.2 Store assignment
> h4. Syntax Rules
> 1) Let T be the TARGET and let V be the VALUE in an application of the Syntax 
> Rules of this Subclause.
>  2) Let TD and SD be the declared types of T and V, respectively.
>  3) If TD is character string, binary string, numeric, boolean, datetime, 
> interval, or a user-defined type, then
>  either SD shall be assignable to TD or there shall exist an appropriate 
> user-defined cast function UDCF
>  from SD to TD.
>  _NOTE 319 — “Appropriate user-defined cast function” is defined in Subclause 
> 4.11, “Data conversions”_
> h3.  4.11 Data conversions
> Implicit type conversion can occur in expressions, fetch operations, single 
> row select operations, inserts, deletes,
>  and updates. Explicit type conversions can be specified by the use of the 
> CAST operator.
>  
> The current implementation for ANSI store assignment is totally out of 
> context. 
> According to this rule, `there shall exist an appropriate user-defined cast 
> function UDCF`, the spark legacy store assignment is just fine because we do 
> have *appropriate cast* _*functions.*_
> At least according to the ansi cast rule, the current ANSI assignment policy 
> is too strict to the ANSI cast rules
>  
> {code:java}
> * (SD) --------------------- (TD) -------------------------
> *     | EN  AN  C  D  T  TS  YM  DT  BO  UDT  B  RT  CT  RW
> * EN  |  Y   Y  Y  N  N   N   M   M   N   M   N   M   N   N
> * AN  |  Y   Y  Y  N  N   N   N   N   N   M   N   M   N   N
> *  C  |  Y   Y  Y  Y  Y   Y   Y   Y   Y   M   N   M   N   N
> *  D  |  N   N  Y  Y  N   Y   N   N   N   M   N   M   N   N
> *  T  |  N   N  Y  N  Y   Y   N   N   N   M   N   M   N   N
> * TS  |  N   N  Y  Y  Y   Y   N   N   N   M   N   M   N   N
> * YM  |  M   N  Y  N  N   N   Y   N   N   M   N   M   N   N
> * DT  |  M   N  Y  N  N   N   N   Y   N   M   N   M   N   N
> * BO  |  N   N  Y  N  N   N   N   N   Y   M   N   M   N   N
> * UDT |  M   M  M  M  M   M   M   M   M   M   M   M   M   N
> *  B  |  N   N  N  N  N   N   N   N   N   M   Y   M   N   N
> * RT  |  M   M  M  M  M   M   M   M   M   M   M   M   N   N
> * CT  |  N   N  N  N  N   N   N   N   N   M   N   N   M   N
> * RW  |  N   N  N  N  N   N   N   N   N   N   N   N   N   M
> *
> * Where:
> * EN = Exact Numeric
> * AN = Approximate Numeric
> * C = Character (Fixed- or Variable-Length, or Character Large Object)
> * D = Date
> * T = Time
> * TS = Timestamp
> * YM = Year-Month Interval
> * DT = Day-Time Interval
> * BO = Boolean
> * UDT = User-Defined Type
> * B = Binary (Fixed- or Variable-Length or Binary Large Object)
> * RT = Reference type
> * CT = Collection type
> * RW = Row type
> {code}
>  
>  
> _cc [~cloud_fan] [~gengliang]_ [~maropu] 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to