-
Notifications
You must be signed in to change notification settings - Fork 96
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
86792c1
commit e2e77a5
Showing
65 changed files
with
4,750 additions
and
3,937 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-DATASET CSV empty | ||
|
||
-- | ||
|
||
-CASE ExternalDuckDBTable | ||
|
||
-STATEMENT load extension "${KUZU_ROOT_DIRECTORY}/extension/duckdb/build/libduckdb.kuzu_extension" | ||
---- ok | ||
-STATEMENT ATTACH '${KUZU_ROOT_DIRECTORY}/dataset/databases/duckdb_database/tinysnb.db' as tinysnb (dbtype duckdb, skip_unsupported_table = true); | ||
---- 1 | ||
Attached database successfully. | ||
-STATEMENT BEGIN TRANSACTION; | ||
---- ok | ||
-STATEMENT CREATE EXTERNAL NODE TABLE duck_person AS tinysnb.person (PRIMARY KEY (ID)); | ||
---- ok | ||
-STATEMENT COMMIT; | ||
---- ok | ||
-RELOADDB | ||
-STATEMENT CALL SHOW_TABLES() RETURN *; | ||
---- 1 | ||
duck_person|EXTERNAL_NODE|local(kuzu)| | ||
-STATEMENT BEGIN TRANSACTION; | ||
---- ok | ||
-STATEMENT ALTER TABLE duck_person RENAME TO d_person; | ||
---- ok | ||
-STATEMENT COMMIT; | ||
---- ok | ||
-RELOADDB | ||
-STATEMENT CALL SHOW_TABLES() RETURN *; | ||
---- 1 | ||
d_person|EXTERNAL_NODE|local(kuzu)| | ||
-STATEMENT BEGIN TRANSACTION; | ||
---- ok | ||
-STATEMENT DROP TABLE d_person; | ||
---- ok | ||
-STATEMENT COMMIT; | ||
---- ok | ||
-RELOADDB | ||
-STATEMENT CALL SHOW_TABLES() RETURN *; | ||
---- 0 | ||
-STATEMENT load extension "${KUZU_ROOT_DIRECTORY}/extension/duckdb/build/libduckdb.kuzu_extension" | ||
---- ok | ||
-STATEMENT ATTACH '${KUZU_ROOT_DIRECTORY}/dataset/databases/duckdb_database/tinysnb.db' as tinysnb (dbtype duckdb, skip_unsupported_table = true); | ||
---- 1 | ||
Attached database successfully. | ||
-STATEMENT CREATE EXTERNAL NODE TABLE duck_person AS tinysnb.person (PRIMARY KEY (ID)); | ||
---- 1 | ||
Table duck_person has been created. | ||
-STATEMENT COPY duck_person FROM (LOAD FROM tinysnb.person RETURN ID); | ||
---- ok | ||
-STATEMENT MATCH (a:duck_person) RETURN a.ID, a.fName; | ||
---- 8 | ||
0|Alice | ||
2|Bob | ||
3|Carol | ||
5|Dan | ||
7|Elizabeth | ||
8|Farooq | ||
9|Greg | ||
10|Hubert Blaine Wolfeschlegelsteinhausenbergerdorff |
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 |
---|---|---|
@@ -1 +1 @@ | ||
bc82630bdea96b23de7acaa41822b5da | ||
4e2233175e5b207817cf6f09c1f9c14c |
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 |
---|---|---|
|
@@ -37,6 +37,7 @@ EXISTS | |
EXPLAIN | ||
EXPORT | ||
EXTENSION | ||
EXTERNAL | ||
FALSE | ||
FROM | ||
GLOB | ||
|
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,41 @@ | ||
#include "binder/binder.h" | ||
#include "main/database_manager.h" | ||
#include "common/exception/binder.h" | ||
#include "main/client_context.h" | ||
#include "catalog/catalog_entry/external_node_table_catalog_entry.h" | ||
|
||
using namespace kuzu::common; | ||
using namespace kuzu::catalog; | ||
|
||
namespace kuzu { | ||
namespace binder { | ||
|
||
catalog::TableCatalogEntry* Binder::bindExternalTableEntry(const std::string& dbName, | ||
const std::string& tableName) { | ||
auto attachedDB = clientContext->getDatabaseManager()->getAttachedDatabase(dbName); | ||
if (attachedDB == nullptr) { | ||
throw BinderException{stringFormat("No database named {} has been attached.", dbName)}; | ||
} | ||
auto attachedCatalog = attachedDB->getCatalog(); | ||
auto tableID = attachedCatalog->getTableID(clientContext->getTx(), tableName); | ||
return attachedCatalog->getTableCatalogEntry(clientContext->getTx(), tableID); | ||
} | ||
|
||
void Binder::bindExternalTableEntry(NodeOrRelExpression& nodeOrRel) { | ||
if (nodeOrRel.isMultiLabeled() || nodeOrRel.isEmpty()) { | ||
return ; | ||
} | ||
auto entry = nodeOrRel.getSingleEntry(); | ||
switch (entry->getType()) { | ||
case CatalogEntryType::EXTERNAL_NODE_TABLE_ENTRY: { | ||
auto& tableEntry = entry->constCast<ExternalNodeTableCatalogEntry>(); | ||
auto externalEntry = bindExternalTableEntry(tableEntry.getExternalDBName(), tableEntry.getExternalTableName()); | ||
nodeOrRel.setExternalEntry(externalEntry); | ||
} break ; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.