A few more test fixes

This commit is contained in:
kssenii 2024-04-04 13:21:22 +02:00
parent be30806dbe
commit b24a2afd5f
3 changed files with 13 additions and 6 deletions

View File

@ -17,9 +17,8 @@ namespace DB
template <typename Definition, typename StorageSettings, typename Configuration>
StoragePtr TableFunctionObjectStorageCluster<Definition, StorageSettings, Configuration>::executeImpl(
const ASTPtr & /*function*/, ContextPtr context,
const std::string & table_name, ColumnsDescription /*cached_columns*/, bool is_insert_query) const
const std::string & table_name, ColumnsDescription cached_columns, bool is_insert_query) const
{
using Base = TableFunctionObjectStorage<Definition, StorageSettings, Configuration>;
auto configuration = Base::getConfiguration();
ColumnsDescription columns;
@ -27,6 +26,8 @@ StoragePtr TableFunctionObjectStorageCluster<Definition, StorageSettings, Config
columns = parseColumnsListFromString(configuration->structure, context);
else if (!Base::structure_hint.empty())
columns = Base::structure_hint;
else if (!cached_columns.empty())
columns = cached_columns;
auto object_storage = Base::getObjectStorage(context, !is_insert_query);
StoragePtr storage;

View File

@ -67,6 +67,8 @@ public:
String getSignature() const override { return signature; }
protected:
using Base = TableFunctionObjectStorage<Definition, StorageSettings, Configuration>;
StoragePtr executeImpl(
const ASTPtr & ast_function,
ContextPtr context,
@ -75,6 +77,12 @@ protected:
bool is_insert_query) const override;
const char * getStorageTypeName() const override { return Definition::storage_type_name; }
bool hasStaticStructure() const override { return Base::getConfiguration()->structure != "auto"; }
bool needStructureHint() const override { return Base::getConfiguration()->structure == "auto"; }
void setStructureHint(const ColumnsDescription & structure_hint_) override { Base::structure_hint = structure_hint_; }
};
#if USE_AWS_S3

View File

@ -58,10 +58,8 @@ SELECT * FROM \"abacaba/file.tsv\"
""" 2>&1 | tr '\n' ' ' | grep -oF "CANNOT_EXTRACT_TABLE_STRUCTURE"
${CLICKHOUSE_CLIENT} -q "SELECT * FROM test_hdfs_4.\`http://localhost:11111/test/a.tsv\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "BAD_ARGUMENTS" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/file.myext\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "CANNOT_EXTRACT_TABLE_STRUCTURE" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/test_02725_3.tsv\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "CANNOT_EXTRACT_TABLE_STRUCTURE" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/file.myext\`"
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/test_02725_3.tsv\`"
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/file.myext\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "The data format cannot be detected" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/test_02725_3.tsv\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "The table structure cannot be extracted" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "BAD_ARGUMENTS" > /dev/null && echo "OK" || echo 'FAIL' ||: