| 1 | #include "duckdb/main/relation/read_json_relation.hpp" | 
|---|
| 2 | #include "duckdb/parser/column_definition.hpp" | 
|---|
| 3 | namespace duckdb { | 
|---|
| 4 |  | 
|---|
| 5 | ReadJSONRelation::ReadJSONRelation(const shared_ptr<ClientContext> &context, string json_file_p, | 
|---|
| 6 | named_parameter_map_t options, bool auto_detect, string alias_p) | 
|---|
| 7 | : TableFunctionRelation(context, auto_detect ? "read_json_auto": "read_json", {Value(json_file_p)}, | 
|---|
| 8 | std::move(options)), | 
|---|
| 9 | json_file(std::move(json_file_p)), alias(std::move(alias_p)) { | 
|---|
| 10 |  | 
|---|
| 11 | if (alias.empty()) { | 
|---|
| 12 | alias = StringUtil::Split(input: json_file, split: ".")[0]; | 
|---|
| 13 | } | 
|---|
| 14 | } | 
|---|
| 15 |  | 
|---|
| 16 | string ReadJSONRelation::GetAlias() { | 
|---|
| 17 | return alias; | 
|---|
| 18 | } | 
|---|
| 19 |  | 
|---|
| 20 | } // namespace duckdb | 
|---|
| 21 |  | 
|---|