Skip to content

Commit

Permalink
Fix on review
Browse files Browse the repository at this point in the history
  • Loading branch information
manh9203 committed Apr 25, 2024
1 parent 84687ca commit f1d5220
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/binder/bind/bind_file_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ std::unique_ptr<BoundBaseScanSource> Binder::bindScanSource(BaseScanSource* sour
auto filePaths = bindFilePaths(fileSource->filePaths);
// Bind file type.
auto fileType = bindFileType(filePaths);
if (fileType != FileType::CSV && options.size() != 0) {
throw BinderException{"Only copy from CSV can have options."};
}
auto config = std::make_unique<ReaderConfig>(fileType, std::move(filePaths));
// Bind options.
config->options = bindParsingOptions(options);
Expand Down
4 changes: 4 additions & 0 deletions src/processor/operator/persistent/reader/npy/npy_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <unistd.h>
#endif

#include "common/exception/binder.h"
#include "common/exception/copy.h"
#include "common/string_format.h"
#include "common/utils.h"
Expand Down Expand Up @@ -296,6 +297,9 @@ static void bindColumns(const common::ReaderConfig& readerConfig,
static std::unique_ptr<function::TableFuncBindData> bindFunc(main::ClientContext* /*context*/,
function::TableFuncBindInput* input) {
auto scanInput = reinterpret_cast<function::ScanTableFuncBindInput*>(input);
if (!scanInput->config.options.empty()) {
throw BinderException{"Copy from Npy cannot have options."};
}
std::vector<std::string> detectedColumnNames;
std::vector<common::LogicalType> detectedColumnTypes;
bindColumns(scanInput->config, detectedColumnNames, detectedColumnTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <fcntl.h>

#include "common/exception/binder.h"
#include "common/exception/copy.h"
#include "common/file_system/virtual_file_system.h"
#include "common/string_format.h"
Expand Down Expand Up @@ -652,6 +653,9 @@ static std::unique_ptr<function::TableFuncBindData> bindFunc(main::ClientContext
function::TableFuncBindInput* input) {
auto scanInput =
ku_dynamic_cast<function::TableFuncBindInput*, function::ScanTableFuncBindInput*>(input);
if (!scanInput->config.options.empty()) {
throw BinderException{"Copy from Parquet cannot have options."};
}
std::vector<std::string> detectedColumnNames;
std::vector<common::LogicalType> detectedColumnTypes;
bindColumns(scanInput, detectedColumnNames, detectedColumnTypes);
Expand Down
2 changes: 1 addition & 1 deletion test/test_files/copy/copy_node_parquet.test
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@

-STATEMENT COPY tableOfTypes FROM "${KUZU_ROOT_DIRECTORY}/dataset/copy-test/node/parquet/types_50k*.parquet" (HEADER=true);
---- error
Binder exception: Only copy from CSV can have options.
Binder exception: Copy from Parquet cannot have options.

0 comments on commit f1d5220

Please sign in to comment.