ClickHouse/src/TableFunctions/ITableFunctionFileLike.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.4 KiB
C++
Raw Normal View History

2018-06-11 12:13:00 +00:00
#pragma once
#include <TableFunctions/ITableFunction.h>
2022-04-27 12:15:52 +00:00
#include "Parsers/IAST_fwd.h"
2018-06-11 12:13:00 +00:00
namespace DB
{
2019-08-01 01:53:38 +00:00
class ColumnsDescription;
class Context;
2019-08-01 01:53:38 +00:00
2018-06-11 12:13:00 +00:00
/*
* function(source, format, structure[, compression_method]) - creates a temporary storage from formatted source
2018-06-11 12:13:00 +00:00
*/
class ITableFunctionFileLike : public ITableFunction
{
public:
bool needStructureHint() const override { return structure == "auto"; }
void setStructureHint(const ColumnsDescription & structure_hint_) override { structure_hint = structure_hint_; }
2021-09-08 19:28:22 +00:00
bool supportsReadingSubsetOfColumns() override;
2021-09-08 19:28:22 +00:00
protected:
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
virtual void parseFirstArguments(const ASTPtr & arg, const ContextPtr & context);
2022-04-27 12:15:52 +00:00
virtual String getFormatFromFirstArgument();
2021-09-08 19:28:22 +00:00
String filename;
String format = "auto";
String structure = "auto";
2021-09-08 19:28:22 +00:00
String compression_method = "auto";
ColumnsDescription structure_hint;
2021-09-08 19:28:22 +00:00
2018-06-11 12:13:00 +00:00
private:
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns) const override;
2018-06-11 12:13:00 +00:00
virtual StoragePtr getStorage(
const String & source, const String & format, const ColumnsDescription & columns, ContextPtr global_context,
const std::string & table_name, const String & compression_method) const = 0;
bool hasStaticStructure() const override { return structure != "auto"; }
2018-06-11 12:13:00 +00:00
};
2018-06-11 12:13:00 +00:00
}