PavithraRamachandran opened a new pull request #32996:
URL: https://github.com/apache/spark/pull/32996


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: 
https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: 
https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., 
'[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a 
faster review.
     7. If you want to add a new configuration, please read the guideline first 
for naming configurations in
        
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error message, please read the 
guideline first:
        https://spark.apache.org/error-message-guidelines.html
   -->
   
   ### What changes were proposed in this pull request?
   
   When we use a Select filter query with struct complex type and use a 
different case in the query, nested column aliasing maps the name a different  
and throws exception
   
   Reproduce Scenario:
   create table Struct_com (CUST_ID string, YEAR int, MONTH int, AGE int, 
GENDER string, EDUCATED string, IS_MARRIED string, 
STRUCT_INT_DOUBLE_STRING_DATE 
struct<ID:int,SALARY:double,COUNTRY:STRING,CHECK_DATE:string>,CARD_COUNT 
int,DEBIT_COUNT int, CREDIT_COUNT int, DEPOSIT double, HQ_DEPOSIT double) 
stored as parquet;
   
   SELECT 
struct_int_double_string_date.COUNTRY,struct_int_double_string_date.CHECK_DATE,struct_int_double_string_date.CHECK_DATE,struct_in
 t_double_string_date.Country, SUM(struct_int_double_string_date.id) AS Sum 
FROM (select * from Struct_com) SUB_QRY WHERE struct_int_double_string_date.id 
> 5700 GRO UP BY 
struct_int_double_string_date.COUNTRY,struct_int_double_string_date.CHECK_DATE,struct_int_double_string_date.CHECK_DATE,struct_int_double_string_date.Country
 ORDER BY struct_int_double_string_date.COUNTRY 
asc,struct_int_double_string_date.CHECK_DATE 
asc,struct_int_double_string_date.CHECK_DATE asc, struct_int_double_stri 
ng_date.Country asc;
   
   Caused by: java.lang.RuntimeException: Couldn't find 
_gen_alias_139930#139930 in 
_gen_alias_139928#139928,_gen_alias_139929#139929,sum(cast(_gen_alias_139931#13993
 1 as bigint))#139901L
   at scala.sys.package$.error(package.scala:30)
   at 
org.apache.spark.sql.catalyst.expressions.BindReferences$$anonfun$bindReference$1.$anonfun$applyOrElse$1(BoundAttribute.scala:81)
   at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:52)
   ... 90 more (state=,code=0)
   
   ### Why are the changes needed?
   Select filter query with complex struct fails when query uses case 
insensitive field name.
   Issue is present only in 3.1 branch.
   
   
   ### Does this PR introduce _any_ user-facing change?
   NO
   
   ### How was this patch tested?
   UT
   


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



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

Reply via email to