| 1 | #include "duckdb/common/exception.hpp" | 
|---|---|
| 2 | #include "duckdb/parser/tableref/table_function_ref.hpp" | 
| 3 | #include "duckdb/parser/transformer.hpp" | 
| 4 | |
| 5 | using namespace duckdb; | 
| 6 | using namespace std; | 
| 7 | |
| 8 | unique_ptr<TableRef> Transformer::TransformRangeFunction(PGRangeFunction *root) { | 
| 9 | if (root->lateral) { | 
| 10 | throw NotImplementedException( "LATERAL not implemented"); | 
| 11 | } | 
| 12 | if (root->ordinality) { | 
| 13 | throw NotImplementedException( "WITH ORDINALITY not implemented"); | 
| 14 | } | 
| 15 | if (root->is_rowsfrom) { | 
| 16 | throw NotImplementedException( "ROWS FROM() not implemented"); | 
| 17 | } | 
| 18 | if (root->functions->length != 1) { | 
| 19 | throw NotImplementedException( "Need exactly one function"); | 
| 20 | } | 
| 21 | auto function_sublist = (PGList *)root->functions->head->data.ptr_value; | 
| 22 | assert(function_sublist->length == 2); | 
| 23 | auto call_tree = (PGNode *)function_sublist->head->data.ptr_value; | 
| 24 | auto coldef = function_sublist->head->next->data.ptr_value; | 
| 25 | |
| 26 | assert(call_tree->type == T_PGFuncCall); | 
| 27 | if (coldef) { | 
| 28 | throw NotImplementedException( "Explicit column definition not supported yet"); | 
| 29 | } | 
| 30 | // transform the function call | 
| 31 | auto result = make_unique<TableFunctionRef>(); | 
| 32 | result->function = TransformFuncCall((PGFuncCall *)call_tree); | 
| 33 | result->alias = TransformAlias(root->alias); | 
| 34 | return move(result); | 
| 35 | } | 
| 36 | 
