try fix synchronization check

This commit is contained in:
Alexander Tokmakov 2020-08-06 22:44:42 +03:00
parent 789a6022c5
commit b9fdc49e1a
5 changed files with 18 additions and 7 deletions

View File

@ -1,7 +1,10 @@
#include <Databases/MySQL/MaterializeMetadata.h>
#if USE_MYSQL
#include <Core/Block.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Databases/MySQL/MaterializeMetadata.h>
#include <Formats/MySQLBlockInputStream.h>
#include <IO/ReadBufferFromFile.h>
#include <IO/WriteBufferFromFile.h>
@ -206,3 +209,5 @@ MaterializeMetadata::MaterializeMetadata(
}
}
#endif

View File

@ -1,5 +1,11 @@
#pragma once
#if !defined(ARCADIA_BUILD)
# include "config_core.h"
#endif
#if USE_MYSQL
#include <Core/Types.h>
#include <Core/MySQLReplication.h>
#include <mysqlxx/Connection.h>
@ -42,3 +48,4 @@ struct MaterializeMetadata
}
#endif

View File

@ -3,6 +3,7 @@
#endif
#include <Interpreters/InterpreterExternalDDLQuery.h>
#include <Interpreters/Context.h>
#include <Parsers/IAST.h>
#include <Parsers/ASTDropQuery.h>
@ -11,7 +12,6 @@
#include <Parsers/ASTExternalDDLQuery.h>
#ifdef USE_MYSQL
# include <Interpreters/Context.h>
# include <Interpreters/MySQL/InterpretersMySQLDDLQuery.h>
# include <Parsers/MySQL/ASTAlterQuery.h>
# include <Parsers/MySQL/ASTCreateQuery.h>

View File

@ -165,7 +165,7 @@ static inline std::tuple<NamesAndTypesList, NamesAndTypesList, NamesAndTypesList
if (options->changes.count("primary_key"))
primary_keys->arguments->children.emplace_back(std::make_shared<ASTIdentifier>(declare_column->name));
if (options->changes.contains("auto_increment"))
if (options->changes.count("auto_increment"))
increment_columns.emplace(declare_column->name);
}
}
@ -272,10 +272,10 @@ static ASTPtr getOrderByPolicy(
for (const auto & [name, type] : names_and_types)
{
if (order_by_columns_set.contains(name))
if (order_by_columns_set.count(name))
continue;
if (increment_columns.contains(name))
if (increment_columns.count(name))
{
increment_keys.emplace_back(name);
order_by_columns_set.emplace(name);

View File

@ -16,12 +16,11 @@
using namespace DB;
static inline ASTPtr tryRewrittenCreateQuery(const String & query, const Context & context_)
static inline ASTPtr tryRewrittenCreateQuery(const String & query, const Context & context)
{
ParserExternalDDLQuery external_ddl_parser;
ASTPtr ast = parseQuery(external_ddl_parser, query, 0, 0);
Context context = context_;
return MySQLInterpreter::InterpreterCreateImpl::getRewrittenQuery(
*ast->as<ASTExternalDDLQuery>()->external_ddl->as<MySQLParser::ASTCreateQuery>(),
context, "test_database", "test_database");