1
0

[HUDI-4359] Support show_fs_path_detail command on Call Produce Command (#6042)

This commit is contained in:
ForwardXu
2022-07-05 23:56:32 +08:00
committed by GitHub
parent 23c9c5c296
commit 8570c3aab4
3 changed files with 167 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.spark.sql.hudi.procedure
import org.apache.spark.sql.hudi.HoodieSparkSqlTestBase
class TestShowFsPathDetailProcedure extends HoodieSparkSqlTestBase {
test("Test Call show_fs_path_detail Procedure") {
withTempDir { tmp =>
val tableName = generateTableName
val tablePath = tmp.getCanonicalPath + "/" + tableName
// create table
spark.sql(
s"""
|create table $tableName (
| id int,
| name string,
| price double,
| ts long
|) using hudi
| location '$tablePath'
| tblproperties (
| primaryKey = 'id',
| preCombineField = 'ts'
| )
""".stripMargin)
// insert data to table
spark.sql(s"insert into $tableName select 1, 'a1', 10, 1000")
spark.sql(s"insert into $tableName select 2, 'a2', 20, 1500")
spark.sql(s"insert into $tableName select 3, 'a3', 30, 2000")
val result = spark.sql(s"""call show_fs_path_detail(path => '$tablePath')""").collect()
assertResult(1) {
result.length
}
}
}
}