kyuubi icon indicating copy to clipboard operation
kyuubi copied to clipboard

[Bug] The combination of Command and Aggregate operators causes colmun verification to fail

Open ASiegeLion opened this issue 2 years ago • 0 comments

Code of Conduct

Search before asking

  • [X] I have searched in the issues and found no similar issues.

Describe the bug

test code:

test("auth: Command and Aggregate operators causes colmun verification to fail") {
    val db = "default"
    val table = "src"
    val col = "key"
    val create = s"CREATE TABLE IF NOT EXISTS $db.$table ($col int, value int) USING $format"
    val select = s"CACHE TABLE TEST AS SELECT key FROM $db.$table group by key"
    withCleanTmpResources(Seq((s"$db.$table", "table"))) {
      doAs("bob", sql(create))
      doAs("kent", sql(select).collect())
    }
  } 
 

image

explain :

CacheTableAsSelect TEST, SELECT key  FROM default.src group by key, false, true
   +- Aggregate [key#17], [key#17]
      +- SubqueryAlias spark_catalog.default.src
         +- HiveTableRelation [`spark_catalog`.`default`.`src`, org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [key#17, value#18], Partition Cols: []]

This paln did not generate project operator, causing PrivilegesBuilder's mergeProjection to merge all columns of HiveTableRelation. image

Affects Version(s)

master

Kyuubi Server Log Output

No response

Kyuubi Engine Log Output

No response

Kyuubi Server Configurations

No response

Kyuubi Engine Configurations

No response

Additional context

No response

Are you willing to submit PR?

  • [X] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
  • [ ] No. I cannot submit a PR at this time.

ASiegeLion avatar Dec 12 '23 09:12 ASiegeLion