Skip to content

Commit e2e77a5

Browse files
committed
Add external node table
1 parent 86792c1 commit e2e77a5

File tree

65 files changed

+4750
-3937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4750
-3937
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
-DATASET CSV empty
2+
3+
--
4+
5+
-CASE ExternalDuckDBTable
6+
7+
-STATEMENT load extension "${KUZU_ROOT_DIRECTORY}/extension/duckdb/build/libduckdb.kuzu_extension"
8+
---- ok
9+
-STATEMENT ATTACH '${KUZU_ROOT_DIRECTORY}/dataset/databases/duckdb_database/tinysnb.db' as tinysnb (dbtype duckdb, skip_unsupported_table = true);
10+
---- 1
11+
Attached database successfully.
12+
-STATEMENT BEGIN TRANSACTION;
13+
---- ok
14+
-STATEMENT CREATE EXTERNAL NODE TABLE duck_person AS tinysnb.person (PRIMARY KEY (ID));
15+
---- ok
16+
-STATEMENT COMMIT;
17+
---- ok
18+
-RELOADDB
19+
-STATEMENT CALL SHOW_TABLES() RETURN *;
20+
---- 1
21+
duck_person|EXTERNAL_NODE|local(kuzu)|
22+
-STATEMENT BEGIN TRANSACTION;
23+
---- ok
24+
-STATEMENT ALTER TABLE duck_person RENAME TO d_person;
25+
---- ok
26+
-STATEMENT COMMIT;
27+
---- ok
28+
-RELOADDB
29+
-STATEMENT CALL SHOW_TABLES() RETURN *;
30+
---- 1
31+
d_person|EXTERNAL_NODE|local(kuzu)|
32+
-STATEMENT BEGIN TRANSACTION;
33+
---- ok
34+
-STATEMENT DROP TABLE d_person;
35+
---- ok
36+
-STATEMENT COMMIT;
37+
---- ok
38+
-RELOADDB
39+
-STATEMENT CALL SHOW_TABLES() RETURN *;
40+
---- 0
41+
-STATEMENT load extension "${KUZU_ROOT_DIRECTORY}/extension/duckdb/build/libduckdb.kuzu_extension"
42+
---- ok
43+
-STATEMENT ATTACH '${KUZU_ROOT_DIRECTORY}/dataset/databases/duckdb_database/tinysnb.db' as tinysnb (dbtype duckdb, skip_unsupported_table = true);
44+
---- 1
45+
Attached database successfully.
46+
-STATEMENT CREATE EXTERNAL NODE TABLE duck_person AS tinysnb.person (PRIMARY KEY (ID));
47+
---- 1
48+
Table duck_person has been created.
49+
-STATEMENT COPY duck_person FROM (LOAD FROM tinysnb.person RETURN ID);
50+
---- ok
51+
-STATEMENT MATCH (a:duck_person) RETURN a.ID, a.fName;
52+
---- 8
53+
0|Alice
54+
2|Bob
55+
3|Carol
56+
5|Dan
57+
7|Elizabeth
58+
8|Farooq
59+
9|Greg
60+
10|Hubert Blaine Wolfeschlegelsteinhausenbergerdorff

scripts/antlr4/Cypher.g4

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ EXPORT : ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'P' | 'p' ) ( 'O' | 'o' ) ( 'R' | 'r' ) (
9292

9393
EXTENSION : ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'N' | 'n' ) ( 'S' | 's' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ;
9494

95+
EXTERNAL : ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'N' | 'n' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ;
96+
9597
FALSE : ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) ;
9698

9799
FROM : ( 'F' | 'f' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'M' | 'm' ) ;
@@ -225,6 +227,7 @@ oC_Cypher
225227
oC_Statement
226228
: oC_Query
227229
| kU_CreateNodeTable
230+
| kU_CreateExternalNodeTable
228231
| kU_CreateRelTable
229232
| kU_CreateRelTableGroup
230233
| kU_CreateRdfGraph
@@ -312,10 +315,13 @@ kU_IfNotExists
312315
: IF SP NOT SP EXISTS ;
313316

314317
kU_CreateNodeTable
315-
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint ) SP? ')' ;
318+
: CREATE SP NODE SP TABLE SP ( kU_IfNotExists SP )? oC_SchemaName SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_PrimaryKey ) SP? ')' ;
319+
320+
kU_CreateExternalNodeTable
321+
: CREATE SP EXTERNAL SP NODE SP TABLE SP oC_SchemaName SP AS SP oC_SchemaName kU_TableLookup SP? '(' SP? kU_PrimaryKey SP? ')' ;
316322

317323
kU_CreateRelTable
318-
: CREATE SP REL SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_RelTableConnection SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
324+
: CREATE SP REL SP TABLE SP ( kU_IfNotExists SP )? oC_SchemaName SP? '(' SP? kU_RelTableConnection SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
319325

320326
kU_CreateRelTableGroup
321327
: CREATE SP REL SP TABLE SP GROUP SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_RelTableConnection ( SP? ',' SP? kU_RelTableConnection )+ SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
@@ -324,10 +330,10 @@ kU_RelTableConnection
324330
: FROM SP oC_SchemaName SP TO SP oC_SchemaName ;
325331

326332
kU_CreateRdfGraph
327-
: CREATE SP RDFGRAPH SP (kU_IfNotExists SP)? oC_SchemaName ;
333+
: CREATE SP RDFGRAPH SP ( kU_IfNotExists SP )? oC_SchemaName ;
328334

329335
kU_CreateSequence
330-
: CREATE SP SEQUENCE SP (kU_IfNotExists SP)? oC_SchemaName (SP kU_SequenceOptions)* ;
336+
: CREATE SP SEQUENCE SP ( kU_IfNotExists SP )? oC_SchemaName ( SP kU_SequenceOptions )* ;
331337

332338
kU_CreateType
333339
: CREATE SP TYPE SP oC_SchemaName SP AS SP kU_DataType SP? ;
@@ -387,7 +393,7 @@ kU_PropertyDefinitions : kU_PropertyDefinition ( SP? ',' SP? kU_PropertyDefiniti
387393

388394
kU_PropertyDefinition : kU_ColumnDefinition ( SP kU_Default )? ;
389395

390-
kU_CreateNodeConstraint : PRIMARY SP KEY SP? '(' SP? oC_PropertyKeyName SP? ')' ;
396+
kU_PrimaryKey : PRIMARY SP KEY SP? '(' SP? oC_PropertyKeyName SP? ')' ;
391397

392398
DECIMAL: ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'C' | 'c' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ;
393399

@@ -788,6 +794,9 @@ kU_CountSubquery
788794
oC_PropertyLookup
789795
: '.' SP? ( oC_PropertyKeyName | STAR ) ;
790796

797+
kU_TableLookup
798+
: '.' SP? oC_SchemaName ;
799+
791800
oC_CaseExpression
792801
: ( ( CASE ( SP? oC_CaseAlternative )+ ) | ( CASE SP? oC_Expression ( SP? oC_CaseAlternative )+ ) ) ( SP? ELSE SP? oC_Expression )? SP? END ;
793802

scripts/antlr4/hash.md5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bc82630bdea96b23de7acaa41822b5da
1+
4e2233175e5b207817cf6f09c1f9c14c

src/antlr4/Cypher.g4

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ oC_Cypher
88
oC_Statement
99
: oC_Query
1010
| kU_CreateNodeTable
11+
| kU_CreateExternalNodeTable
1112
| kU_CreateRelTable
1213
| kU_CreateRelTableGroup
1314
| kU_CreateRdfGraph
@@ -95,10 +96,13 @@ kU_IfNotExists
9596
: IF SP NOT SP EXISTS ;
9697

9798
kU_CreateNodeTable
98-
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint ) SP? ')' ;
99+
: CREATE SP NODE SP TABLE SP ( kU_IfNotExists SP )? oC_SchemaName SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_PrimaryKey ) SP? ')' ;
100+
101+
kU_CreateExternalNodeTable
102+
: CREATE SP EXTERNAL SP NODE SP TABLE SP oC_SchemaName SP AS SP oC_SchemaName kU_TableLookup SP? '(' SP? kU_PrimaryKey SP? ')' ;
99103

100104
kU_CreateRelTable
101-
: CREATE SP REL SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_RelTableConnection SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
105+
: CREATE SP REL SP TABLE SP ( kU_IfNotExists SP )? oC_SchemaName SP? '(' SP? kU_RelTableConnection SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
102106

103107
kU_CreateRelTableGroup
104108
: CREATE SP REL SP TABLE SP GROUP SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_RelTableConnection ( SP? ',' SP? kU_RelTableConnection )+ SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
@@ -107,10 +111,10 @@ kU_RelTableConnection
107111
: FROM SP oC_SchemaName SP TO SP oC_SchemaName ;
108112

109113
kU_CreateRdfGraph
110-
: CREATE SP RDFGRAPH SP (kU_IfNotExists SP)? oC_SchemaName ;
114+
: CREATE SP RDFGRAPH SP ( kU_IfNotExists SP )? oC_SchemaName ;
111115

112116
kU_CreateSequence
113-
: CREATE SP SEQUENCE SP (kU_IfNotExists SP)? oC_SchemaName (SP kU_SequenceOptions)* ;
117+
: CREATE SP SEQUENCE SP ( kU_IfNotExists SP )? oC_SchemaName ( SP kU_SequenceOptions )* ;
114118

115119
kU_CreateType
116120
: CREATE SP TYPE SP oC_SchemaName SP AS SP kU_DataType SP? ;
@@ -170,7 +174,7 @@ kU_PropertyDefinitions : kU_PropertyDefinition ( SP? ',' SP? kU_PropertyDefiniti
170174

171175
kU_PropertyDefinition : kU_ColumnDefinition ( SP kU_Default )? ;
172176

173-
kU_CreateNodeConstraint : PRIMARY SP KEY SP? '(' SP? oC_PropertyKeyName SP? ')' ;
177+
kU_PrimaryKey : PRIMARY SP KEY SP? '(' SP? oC_PropertyKeyName SP? ')' ;
174178

175179
DECIMAL: ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'C' | 'c' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ;
176180

@@ -571,6 +575,9 @@ kU_CountSubquery
571575
oC_PropertyLookup
572576
: '.' SP? ( oC_PropertyKeyName | STAR ) ;
573577

578+
kU_TableLookup
579+
: '.' SP? oC_SchemaName ;
580+
574581
oC_CaseExpression
575582
: ( ( CASE ( SP? oC_CaseAlternative )+ ) | ( CASE SP? oC_Expression ( SP? oC_CaseAlternative )+ ) ) ( SP? ELSE SP? oC_Expression )? SP? END ;
576583

src/antlr4/keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ EXISTS
3737
EXPLAIN
3838
EXPORT
3939
EXTENSION
40+
EXTERNAL
4041
FALSE
4142
FROM
4243
GLOB

src/binder/bind/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ add_library(
2020
bind_transaction.cpp
2121
bind_updating_clause.cpp
2222
bind_extension.cpp
23+
bind_external.cpp
2324
bind_export_database.cpp
2425
bind_import_database.cpp
2526
bind_use_database.cpp)

src/binder/bind/bind_ddl.cpp

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ static void validatePrimaryKey(const std::string& pkColName,
108108
}
109109
}
110110

111-
BoundCreateTableInfo Binder::bindCreateTableInfo(const parser::CreateTableInfo* info) {
112-
switch (info->tableType) {
111+
BoundCreateTableInfo Binder::bindCreateTableInfo(const parser::CreateTableInfo& info) {
112+
switch (info.tableType) {
113113
case TableType::NODE: {
114114
return bindCreateNodeTableInfo(info);
115115
}
116+
case TableType::EXTERNAL_NODE: {
117+
return bindCreateExternalNodeTableInfo(info);
118+
}
116119
case TableType::REL: {
117120
return bindCreateRelTableInfo(info);
118121
}
@@ -128,24 +131,57 @@ BoundCreateTableInfo Binder::bindCreateTableInfo(const parser::CreateTableInfo*
128131
}
129132
}
130133

131-
BoundCreateTableInfo Binder::bindCreateNodeTableInfo(const CreateTableInfo* info) {
132-
auto propertyDefinitions = bindPropertyDefinitions(info->propertyDefinitions, info->tableName);
133-
auto& extraInfo = info->extraInfo->constCast<ExtraCreateNodeTableInfo>();
134+
BoundCreateTableInfo Binder::bindCreateNodeTableInfo(const CreateTableInfo& info) {
135+
auto propertyDefinitions = bindPropertyDefinitions(info.propertyDefinitions, info.tableName);
136+
auto& extraInfo = info.extraInfo->constCast<ExtraCreateNodeTableInfo>();
134137
validatePrimaryKey(extraInfo.pKName, propertyDefinitions);
135138
auto boundExtraInfo = std::make_unique<BoundExtraCreateNodeTableInfo>(extraInfo.pKName,
136139
std::move(propertyDefinitions));
137-
return BoundCreateTableInfo(TableType::NODE, info->tableName, info->onConflict,
140+
return BoundCreateTableInfo(TableType::NODE, info.tableName, info.onConflict,
138141
std::move(boundExtraInfo));
139142
}
140143

141-
BoundCreateTableInfo Binder::bindCreateRelTableInfo(const CreateTableInfo* info) {
144+
static PropertyDefinition getDefinition(const std::vector<PropertyDefinition>& definitions, const std::string& name) {
145+
for (auto& definition : definitions) {
146+
if (definition.getName() == name) {
147+
return definition.copy();
148+
}
149+
}
150+
// LCOV_EXCL_START
151+
throw BinderException(stringFormat("Cannot find property with name {}.", name));
152+
// LCOV_EXCL_STOP
153+
}
154+
155+
static std::string getPhysicalTableName(std::string name) {
156+
return "_" + name;
157+
}
158+
159+
BoundCreateTableInfo Binder::bindCreateExternalNodeTableInfo(const CreateTableInfo& info) {
160+
auto& extraInfo = info.extraInfo->constCast<ExtraCreateExternalNodeTableInfo>();
161+
auto entry = bindExternalTableEntry(extraInfo.dbName, extraInfo.tableName);
162+
auto& propertyDefinitions = entry->getProperties();
163+
// Bind physical create node table info
164+
auto pkDefinition = getDefinition(propertyDefinitions, extraInfo.pkName);
165+
std::vector<PropertyDefinition> physicalPropertyDefinitions;
166+
physicalPropertyDefinitions.push_back(pkDefinition.copy());
167+
auto boundPhysicalExtraInfo = std::make_unique<BoundExtraCreateNodeTableInfo>(extraInfo.pkName, std::move(physicalPropertyDefinitions));
168+
auto boundPhysicalCreateInfo = BoundCreateTableInfo(TableType::NODE,
169+
getPhysicalTableName(info.tableName), ConflictAction::ON_CONFLICT_THROW,
170+
std::move(boundPhysicalExtraInfo));
171+
// Bind create node table reference info
172+
auto boundExtraInfo = std::make_unique<BoundExtraCreateExternalNodeTableInfo>(extraInfo.pkName,
173+
extraInfo.dbName, extraInfo.tableName, std::move(boundPhysicalCreateInfo), copyVector(propertyDefinitions));
174+
return BoundCreateTableInfo(TableType::EXTERNAL_NODE, info.tableName, info.onConflict, std::move(boundExtraInfo));
175+
}
176+
177+
BoundCreateTableInfo Binder::bindCreateRelTableInfo(const CreateTableInfo& info) {
142178
std::vector<PropertyDefinition> propertyDefinitions;
143179
propertyDefinitions.emplace_back(
144180
ColumnDefinition(InternalKeyword::ID, LogicalType::INTERNAL_ID()));
145-
for (auto& definition : bindPropertyDefinitions(info->propertyDefinitions, info->tableName)) {
181+
for (auto& definition : bindPropertyDefinitions(info.propertyDefinitions, info.tableName)) {
146182
propertyDefinitions.push_back(definition.copy());
147183
}
148-
auto& extraInfo = info->extraInfo->constCast<ExtraCreateRelTableInfo>();
184+
auto& extraInfo = info.extraInfo->constCast<ExtraCreateRelTableInfo>();
149185
auto srcMultiplicity = RelMultiplicityUtils::getFwd(extraInfo.relMultiplicity);
150186
auto dstMultiplicity = RelMultiplicityUtils::getBwd(extraInfo.relMultiplicity);
151187
auto srcTableID = bindTableID(extraInfo.srcTableName);
@@ -154,7 +190,7 @@ BoundCreateTableInfo Binder::bindCreateRelTableInfo(const CreateTableInfo* info)
154190
validateTableType(dstTableID, TableType::NODE);
155191
auto boundExtraInfo = std::make_unique<BoundExtraCreateRelTableInfo>(srcMultiplicity,
156192
dstMultiplicity, srcTableID, dstTableID, std::move(propertyDefinitions));
157-
return BoundCreateTableInfo(TableType::REL, info->tableName, info->onConflict,
193+
return BoundCreateTableInfo(TableType::REL, info.tableName, info.onConflict,
158194
std::move(boundExtraInfo));
159195
}
160196

@@ -163,29 +199,29 @@ static std::string getRelGroupTableName(const std::string& relGroupName,
163199
return relGroupName + "_" + srcTableName + "_" + dstTableName;
164200
}
165201

166-
BoundCreateTableInfo Binder::bindCreateRelTableGroupInfo(const CreateTableInfo* info) {
167-
auto relGroupName = info->tableName;
168-
auto& extraInfo = info->extraInfo->constCast<ExtraCreateRelTableGroupInfo>();
202+
BoundCreateTableInfo Binder::bindCreateRelTableGroupInfo(const CreateTableInfo& info) {
203+
auto relGroupName = info.tableName;
204+
auto& extraInfo = info.extraInfo->constCast<ExtraCreateRelTableGroupInfo>();
169205
auto relMultiplicity = extraInfo.relMultiplicity;
170206
std::vector<BoundCreateTableInfo> boundCreateRelTableInfos;
171-
auto relCreateInfo = std::make_unique<CreateTableInfo>(TableType::REL, "", info->onConflict);
172-
relCreateInfo->propertyDefinitions = copyVector(info->propertyDefinitions);
207+
auto relCreateInfo = CreateTableInfo(TableType::REL, "", info.onConflict);
208+
relCreateInfo.propertyDefinitions = copyVector(info.propertyDefinitions);
173209
for (auto& [srcTableName, dstTableName] : extraInfo.srcDstTablePairs) {
174-
relCreateInfo->tableName = getRelGroupTableName(relGroupName, srcTableName, dstTableName);
175-
relCreateInfo->extraInfo =
210+
relCreateInfo.tableName = getRelGroupTableName(relGroupName, srcTableName, dstTableName);
211+
relCreateInfo.extraInfo =
176212
std::make_unique<ExtraCreateRelTableInfo>(relMultiplicity, srcTableName, dstTableName);
177-
boundCreateRelTableInfos.push_back(bindCreateRelTableInfo(relCreateInfo.get()));
213+
boundCreateRelTableInfos.push_back(bindCreateRelTableInfo(relCreateInfo));
178214
}
179215
auto boundExtraInfo =
180216
std::make_unique<BoundExtraCreateRelTableGroupInfo>(std::move(boundCreateRelTableInfos));
181-
return BoundCreateTableInfo(TableType::REL_GROUP, info->tableName, info->onConflict,
217+
return BoundCreateTableInfo(TableType::REL_GROUP, info.tableName, info.onConflict,
182218
std::move(boundExtraInfo));
183219
}
184220

185221
std::unique_ptr<BoundStatement> Binder::bindCreateTable(const Statement& statement) {
186222
auto createTable = statement.constPtrCast<CreateTable>();
187-
auto tableName = createTable->getInfo()->tableName;
188-
switch (createTable->getInfo()->onConflict) {
223+
auto tableName = createTable->getInfo().tableName;
224+
switch (createTable->getInfo().onConflict) {
189225
case common::ConflictAction::ON_CONFLICT_THROW: {
190226
if (clientContext->getCatalog()->containsTable(clientContext->getTx(), tableName)) {
191227
throw BinderException(tableName + " already exists in catalog.");

src/binder/bind/bind_external.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include "binder/binder.h"
2+
#include "main/database_manager.h"
3+
#include "common/exception/binder.h"
4+
#include "main/client_context.h"
5+
#include "catalog/catalog_entry/external_node_table_catalog_entry.h"
6+
7+
using namespace kuzu::common;
8+
using namespace kuzu::catalog;
9+
10+
namespace kuzu {
11+
namespace binder {
12+
13+
catalog::TableCatalogEntry* Binder::bindExternalTableEntry(const std::string& dbName,
14+
const std::string& tableName) {
15+
auto attachedDB = clientContext->getDatabaseManager()->getAttachedDatabase(dbName);
16+
if (attachedDB == nullptr) {
17+
throw BinderException{stringFormat("No database named {} has been attached.", dbName)};
18+
}
19+
auto attachedCatalog = attachedDB->getCatalog();
20+
auto tableID = attachedCatalog->getTableID(clientContext->getTx(), tableName);
21+
return attachedCatalog->getTableCatalogEntry(clientContext->getTx(), tableID);
22+
}
23+
24+
void Binder::bindExternalTableEntry(NodeOrRelExpression& nodeOrRel) {
25+
if (nodeOrRel.isMultiLabeled() || nodeOrRel.isEmpty()) {
26+
return ;
27+
}
28+
auto entry = nodeOrRel.getSingleEntry();
29+
switch (entry->getType()) {
30+
case CatalogEntryType::EXTERNAL_NODE_TABLE_ENTRY: {
31+
auto& tableEntry = entry->constCast<ExternalNodeTableCatalogEntry>();
32+
auto externalEntry = bindExternalTableEntry(tableEntry.getExternalDBName(), tableEntry.getExternalTableName());
33+
nodeOrRel.setExternalEntry(externalEntry);
34+
} break ;
35+
default:
36+
break;
37+
}
38+
}
39+
40+
}
41+
}

0 commit comments

Comments
 (0)