Z1Wu commented on code in PR #6991: URL: https://github.com/apache/kyuubi/pull/6991#discussion_r2006831418
########## extensions/spark/kyuubi-extension-spark-3-3/src/main/scala/org/apache/kyuubi/sql/RepartitionBeforeWritingBase.scala: ########## @@ -58,7 +58,9 @@ abstract class RepartitionBeforeWritingDatasourceBase extends RepartitionBuilder val dynamicPartitionColumns = query.output.filter(attr => table.partitionColumnNames.contains(attr.name)) c.copy(query = buildRepartition(dynamicPartitionColumns, query)) - + case i @ InsertIntoDataSourceDirCommand(_, _, query, _) + if query.resolved && canInsertRepartitionByExpression(query) => + i.copy(query = buildRepartition(Seq.empty, query)) Review Comment: fixed ########## extensions/spark/kyuubi-extension-spark-3-3/src/test/scala/org/apache/spark/sql/RebalanceBeforeWritingSuite.scala: ########## @@ -272,4 +272,44 @@ class RebalanceBeforeWritingSuite extends KyuubiSparkSQLExtensionTest { } } } + + test("Test rebalance in InsertIntoHiveDirCommand") { + withSQLConf( + HiveUtils.CONVERT_METASTORE_PARQUET.key -> "false", + HiveUtils.CONVERT_METASTORE_CTAS.key -> "false", + KyuubiSQLConf.INSERT_REPARTITION_BEFORE_WRITE_IF_NO_SHUFFLE.key -> "true") { + withTempDir(tmpDir => { + spark.range(0, 1000, 1, 10).createOrReplaceTempView("tmp_table") + val df = sql(s"INSERT OVERWRITE DIRECTORY '${tmpDir.getPath}' " + + s"STORED AS parquet select * from tmp_table") Review Comment: fixed -- 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: notifications-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org