mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 09:05:47 +08:00
more type_name
This commit is contained in:
8 files changed
+9
-10
No files matched your search
@@ -97,6 +97,7 @@ class ARROW_DS_EXPORT DataSource {
|
||||
/// May be null, which indicates no information is available.
|
||||
const ExpressionPtr& partition_expression() const { return partition_expression_; }
|
||||
|
||||
/// \brief The name identifying the kind of data source
|
||||
virtual std::string type_name() const = 0;
|
||||
|
||||
virtual ~DataSource() = default;
|
||||
|
||||
@@ -131,7 +131,8 @@ class ARROW_DS_EXPORT FileFormat {
|
||||
public:
|
||||
virtual ~FileFormat() = default;
|
||||
|
||||
virtual std::string name() const = 0;
|
||||
/// \brief The name identifying the kind of file format
|
||||
virtual std::string type_name() const = 0;
|
||||
|
||||
/// \brief Indicate if the FileSource is supported/readable by this format.
|
||||
virtual Result<bool> IsSupported(const FileSource& source) const = 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ class ARROW_DS_EXPORT ParquetWriteOptions : public FileWriteOptions {
|
||||
/// \brief A FileFormat implementation that reads from Parquet files
|
||||
class ARROW_DS_EXPORT ParquetFileFormat : public FileFormat {
|
||||
public:
|
||||
std::string name() const override { return "parquet"; }
|
||||
std::string type_name() const override { return "parquet"; }
|
||||
|
||||
Result<bool> IsSupported(const FileSource& source) const override;
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ class ARROW_DS_EXPORT Expression {
|
||||
/// returns a debug string representing this expression
|
||||
virtual std::string ToString() const = 0;
|
||||
|
||||
/// \brief Return the expression's type identifier
|
||||
ExpressionType::type type() const { return type_; }
|
||||
|
||||
/// Copy this expression into a shared pointer.
|
||||
|
||||
@@ -179,7 +179,7 @@ class DummyFileFormat : public FileFormat {
|
||||
explicit DummyFileFormat(std::shared_ptr<Schema> schema = NULLPTR)
|
||||
: schema_(std::move(schema)) {}
|
||||
|
||||
std::string name() const override { return "dummy"; }
|
||||
std::string type_name() const override { return "dummy"; }
|
||||
|
||||
Result<bool> IsSupported(const FileSource& source) const override { return true; }
|
||||
|
||||
@@ -223,7 +223,7 @@ class JSONRecordBatchFileFormat : public FileFormat {
|
||||
explicit JSONRecordBatchFileFormat(SchemaResolver resolver)
|
||||
: resolver_(std::move(resolver)) {}
|
||||
|
||||
std::string name() const override { return "json_record_batch"; }
|
||||
std::string type_name() const override { return "json_record_batch"; }
|
||||
|
||||
/// \brief Return true if the given file extension
|
||||
Result<bool> IsSupported(const FileSource& source) const override { return true; }
|
||||
|
||||
@@ -56,7 +56,7 @@ cdef class FileFormat:
|
||||
cdef wrap(shared_ptr[CFileFormat]& sp):
|
||||
cdef FileFormat self
|
||||
|
||||
typ = frombytes(sp.get().name())
|
||||
typ = frombytes(sp.get().type_name())
|
||||
if typ == 'parquet':
|
||||
self = ParquetFileFormat.__new__(ParquetFileFormat)
|
||||
else:
|
||||
@@ -68,9 +68,6 @@ cdef class FileFormat:
|
||||
cdef inline shared_ptr[CFileFormat] unwrap(self):
|
||||
return self.wrapped
|
||||
|
||||
def name(self):
|
||||
return frombytes(self.format.name())
|
||||
|
||||
|
||||
cdef class ParquetFileFormat(FileFormat):
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ cdef extern from "arrow/dataset/api.h" namespace "arrow::dataset" nogil:
|
||||
c_string file_type()
|
||||
|
||||
cdef cppclass CFileFormat "arrow::dataset::FileFormat":
|
||||
c_string name()
|
||||
c_string type_name()
|
||||
CStatus IsSupported(const CFileSource& source, c_bool* supported) const
|
||||
CStatus Inspect(const CFileSource& source,
|
||||
shared_ptr[CSchema]* out) const
|
||||
|
||||
@@ -313,7 +313,6 @@ def test_expression(schema):
|
||||
])
|
||||
def test_file_system_discovery(mockfs, paths_or_selector, record_batch):
|
||||
format = ds.ParquetFileFormat()
|
||||
assert format.name() == 'parquet'
|
||||
|
||||
options = ds.FileSystemDiscoveryOptions('/')
|
||||
assert options.partition_base_dir == '/'
|
||||
|
||||
Reference in new issue
Block a user