forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improve](complex-type) update for array/map element_at with nested c…
…omplex type with local tvf (apache#22927)
- Loading branch information
Showing
8 changed files
with
550 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
385 changes: 385 additions & 0 deletions
385
...data/correctness_p0/table_valued_function/test_local_tvf_with_complex_type_element_at.out
Large diffs are not rendered by default.
Oops, something went wrong.
120 changes: 120 additions & 0 deletions
120
...sion-test/suites/external_table_p0/tvf/test_local_tvf_with_complex_type_element_at.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// 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. | ||
|
||
// This suit test the `backends` tvf | ||
suite("test_local_tvf_with_complex_type_element_at", "p0") { | ||
List<List<Object>> table = sql """ select * from backends(); """ | ||
assertTrue(table.size() > 0) | ||
def be_id = table[0][0] | ||
def dataFilePath = context.config.dataPath + "/external_table_p0/tvf/" | ||
|
||
/** | ||
* here is file schema | ||
* var schema = StructType( | ||
StructField("id", IntegerType, true) :: | ||
StructField("arr_arr", ArrayType(ArrayType(StringType), true), true):: | ||
StructField("arr_map", ArrayType(MapType(StringType, DateType)), true) :: | ||
StructField("arr_struct", ArrayType(StructType(StructField("vin", StringType, true)::StructField("charge_id", IntegerType, true)::Nil))) :: | ||
StructField("map_map", MapType(StringType, MapType(StringType, DoubleType)), true):: | ||
StructField("map_arr", MapType(IntegerType, ArrayType(DoubleType)), true):: | ||
StructField("map_struct", MapType(TimestampType, StructType(StructField("vin", StringType, true)::StructField("charge_id", IntegerType, true)::StructField("start_time", DoubleType, true)::Nil), true)):: | ||
StructField("struct_arr_map", StructType(StructField("aa", ArrayType(StringType), true)::StructField("mm", MapType(DateType, StringType), true)::Nil)):: | ||
Nil | ||
) | ||
*/ | ||
|
||
qt_sql """ | ||
select * from local( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
|
||
qt_sql """ | ||
select count(*) from local( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
|
||
qt_sql """ select arr_arr[1][1] from local ( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
|
||
qt_sql """ select arr_map[1] from local ( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
qt_sql """ select arr_map[1]["WdTnFb-LHW8Nel-laB-HCQA"] from local ( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
|
||
qt_sql """ select map_map["W1iF16-DE1gzJx-avC-Mrf6"]["HJVQSC-46l3xm7-J6c-moIH"] from local ( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
|
||
qt_sql """ select map_arr[1] from local ( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
qt_sql """ select map_arr[1][7] from local ( | ||
"file_path" = "${dataFilePath}/t.orc", | ||
"backend_id" = "${be_id}", | ||
"format" = "orc");""" | ||
|
||
qt_sql """ | ||
select * from local( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet"); """ | ||
|
||
qt_sql """ | ||
select count(*) from local( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet"); """ | ||
|
||
|
||
qt_sql """ select arr_arr[1][1] from local ( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet");""" | ||
|
||
qt_sql """ select arr_map[1] from local ( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet");""" | ||
qt_sql """ select arr_map[1]["WdTnFb-LHW8Nel-laB-HCQA"] from local ( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet");""" | ||
|
||
qt_sql """ select map_map["W1iF16-DE1gzJx-avC-Mrf6"]["HJVQSC-46l3xm7-J6c-moIH"] from local ( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet");""" | ||
|
||
qt_sql """ select map_arr[1] from local ( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet");""" | ||
qt_sql """ select map_arr[1][7] from local ( | ||
"file_path" = "${dataFilePath}/t.parquet", | ||
"backend_id" = "${be_id}", | ||
"format" = "parquet");""" | ||
} |