-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
559a2f9
commit 41bda7f
Showing
5 changed files
with
113 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
id, field1, field2 | ||
"1", "hello", "same, field" | ||
"2", "doris", "same, field2" | ||
"3", "nereids", "same, field3" | ||
"4", "pipeline", "same, field4" | ||
"5", "storage", "same, field5" |
15 changes: 15 additions & 0 deletions
15
regression-test/data/external_table_p0/tvf/test_local_tvf_enclose.out
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,15 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !enclose_1 -- | ||
"1" "hello" "same, field" | ||
"2" "doris" "same, field2" | ||
"3" "nereids" "same, field3" | ||
"4" "pipeline" "same, field4" | ||
"5" "storage" "same, field5" | ||
|
||
-- !enclose_2 -- | ||
1 hello same, field | ||
2 doris same, field2 | ||
3 nereids same, field3 | ||
4 pipeline same, field4 | ||
5 storage same, field5 | ||
|
72 changes: 72 additions & 0 deletions
72
regression-test/suites/external_table_p0/tvf/test_local_tvf_enclose.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,72 @@ | ||
import org.junit.Assert | ||
|
||
// 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. | ||
|
||
suite("test_local_tvf_enclose", "p0,tvf") { | ||
List<List<Object>> backends = sql """ show backends """ | ||
assertTrue(backends.size() > 0) | ||
def be_id = backends[0][0] | ||
|
||
String filename = "enclose_csv.csv" | ||
|
||
def dataFilePath = context.config.dataPath + "/external_table_p0/tvf/${filename}" | ||
|
||
def outFilePath="/enclose_csv" | ||
|
||
for (List<Object> backend : backends) { | ||
def be_host = backend[1] | ||
scpFiles ("root", be_host, dataFilePath, outFilePath, false); | ||
} | ||
|
||
|
||
sql """set enable_nereids_planner=true""" | ||
sql """set enable_fallback_to_original_planner=false""" | ||
|
||
qt_enclose_1 """ | ||
select * from local( | ||
"file_path" = "${outFilePath}/${filename}", | ||
"backend_id" = "${be_id}", | ||
"format" = "csv_with_names", | ||
"column_separator" = ", ", | ||
"enclose" = "\\\"") order by id; | ||
""" | ||
|
||
qt_enclose_2 """ | ||
select * from local( | ||
"file_path" = "${outFilePath}/${filename}", | ||
"backend_id" = "${be_id}", | ||
"format" = "csv_with_names", | ||
"column_separator" = ", ", | ||
"enclose" = "\\\"", | ||
"trim_double_quotes" = "true") order by id; | ||
""" | ||
|
||
// test error case | ||
test { | ||
sql """ | ||
select * from local( | ||
"file_path" = "${outFilePath}/${filename}", | ||
"backend_id" = "${be_id}", | ||
"format" = "csv_with_names", | ||
"column_separator" = ", ", | ||
"enclose" = "\\\"\\\"") order by id; | ||
""" | ||
// check exception message contains | ||
exception "enclose should not be longer than one byte." | ||
} | ||
} |