diff --git a/README.md b/README.md index 61ad7dc592..01f80fbc8b 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ See [Build from Source](docs/getstarted/build_from_source.md). `infinity-sdk` requires Python 3.10+. ```bash -pip3 install infinity-sdk==0.2.0.dev1 +pip3 install infinity-sdk==0.2.0.dev2 ``` ### Import necessary modules diff --git a/benchmark/remote_infinity/remote_query_benchmark.cpp b/benchmark/remote_infinity/remote_query_benchmark.cpp index c68f61acbb..e39bae02a1 100644 --- a/benchmark/remote_infinity/remote_query_benchmark.cpp +++ b/benchmark/remote_infinity/remote_query_benchmark.cpp @@ -50,7 +50,9 @@ struct InfinityClient { client = std::make_unique(protocol); transport->open(); CommonResponse response; - client->Connect(response); + ConnectRequest request; + request.__set_client_version(1); // 0.2.0-dev2 + client->Connect(response, request); session_id = response.session_id; } ~InfinityClient() { diff --git a/client/cpp/infinity_client.cpp b/client/cpp/infinity_client.cpp index 4e7531b17a..7948935bfd 100644 --- a/client/cpp/infinity_client.cpp +++ b/client/cpp/infinity_client.cpp @@ -24,7 +24,9 @@ Client Client::Connect(const std::string &ip_address, uint16_t port) { std::unique_ptr client = std::make_unique(protocol); transport->open(); CommonResponse response; - client->Connect(response); + ConnectRequest request; + request.__set_client_version(1); // 0.2.0-dev2 + client->Connect(response, request); return {socket, transport, protocol, std::move(client), response.session_id}; } diff --git a/python/README.md b/python/README.md index 9ec6e27289..f95d86f0cb 100644 --- a/python/README.md +++ b/python/README.md @@ -1,12 +1,19 @@ # python-infinity -# build +# update python client + +- Update "version" field of [project] chapter and client_version field of ConnectRequest message. +- build new python SDK +- upload to pypi.org +- install new python SDK + +# build python SDK ```shell rm -f dist/* && python setup.py sdist bdist_wheel ``` -# install +# install python SDK ```shell pip uninstall -y infinity-sdk && pip install dist/*.whl ``` diff --git a/python/infinity/__init__.py b/python/infinity/__init__.py index 470e3c8b94..2ff769ad69 100644 --- a/python/infinity/__init__.py +++ b/python/infinity/__init__.py @@ -16,7 +16,7 @@ __version__ = importlib.metadata.version("infinity_sdk") -from infinity.common import URI, NetworkAddress, LOCAL_HOST +from infinity.common import URI, NetworkAddress, LOCAL_HOST, InfinityException from infinity.infinity import InfinityConnection from infinity.remote_thrift.infinity import RemoteThriftInfinityConnection @@ -26,4 +26,4 @@ def connect( if isinstance(uri, NetworkAddress) and (uri.port == 9090 or uri.port == 23817 or uri.port == 9070): return RemoteThriftInfinityConnection(uri) else: - raise Exception(f"unknown uri: {uri}") + raise InfinityException(7016, f"Unknown uri: {uri}") diff --git a/python/infinity/common.py b/python/infinity/common.py index 3c843ac707..0eae5c509f 100644 --- a/python/infinity/common.py +++ b/python/infinity/common.py @@ -38,3 +38,9 @@ class ConflictType(object): Ignore = 0 Error = 1 Replace = 2 + + +class InfinityException(Exception): + def __init__(self, error_code=0, error_message=None): + self.error_code = error_code + self.error_message = error_message diff --git a/python/infinity/errors.py b/python/infinity/errors.py index 5efc57d7db..4d037c4899 100644 --- a/python/infinity/errors.py +++ b/python/infinity/errors.py @@ -25,13 +25,16 @@ class ErrorCode(IntEnum): INVALID_BYTE_SIZE = 1005, INVALID_IP_ADDR = 1006, INVALID_LOG_LEVEL = 1007, + INVALID_CONFIG = 1008 WRONG_PASSWD = 2001, INSUFFICIENT_PRIVILEGE = 2002, + UNSUPPORTED_VERSION_INDEX = 2003, + CLIENT_VERSION_MISMATCH = 2004, INVALID_USERNAME = 3001, INVALID_PASSWD = 3002, - INVALID_DB_NAME = 3003, + INVALID_IDENTIFIER_NAME = 3003, INVALID_TABLE_NAME = 3004, INVALID_COLUMN_NAME = 3005, INVALID_INDEX_NAME = 3006, @@ -109,6 +112,7 @@ class ErrorCode(IntEnum): NOT_SUPPORTED_ANALYZER = 3078, INVALID_ANALYZER_NAME = 3079, INVALID_ANALYZER_FILE = 3080, + INVALID_EXPLAIN_TYPE = 3081, TXN_ROLLBACK = 4001, TXN_CONFLICT = 4002, @@ -136,6 +140,11 @@ class ErrorCode(IntEnum): DIR_NOT_FOUND = 7009, DATA_IO_ERROR = 7010, UNEXPECTED_ERROR = 7011, + PARSER_ERROR = 7012, + MMAP_FILE_ERROR = 7013, + MUNMAP_FILE_ERROR = 7014, + INVALID_FILE_FLAG = 7015, + INVALID_SERVER_ADDRESS = 7016, INVALID_ENTRY = 8001, NOT_FOUND_ENTRY = 8002, diff --git a/python/infinity/index.py b/python/infinity/index.py index 7e98624266..d27a6c60b7 100644 --- a/python/infinity/index.py +++ b/python/infinity/index.py @@ -15,6 +15,7 @@ from enum import Enum import infinity.remote_thrift.infinity_thrift_rpc.ttypes as ttypes +from infinity.common import InfinityException class IndexType(Enum): @@ -33,7 +34,7 @@ def to_ttype(self): elif self == IndexType.FullText: return ttypes.IndexType.FullText else: - raise Exception("Unknown index type") + raise InfinityException(3060, "Unknown index type") class InitParameter: diff --git a/python/infinity/remote_thrift/client.py b/python/infinity/remote_thrift/client.py index 5f5d98f704..83bd1ccf16 100644 --- a/python/infinity/remote_thrift/client.py +++ b/python/infinity/remote_thrift/client.py @@ -40,7 +40,10 @@ def reconnect(self): # self.protocol = TCompactProtocol.TCompactProtocol(self.transport) self.client = InfinityService.Client(self.protocol) self.transport.open() - res = self.client.Connect() + + # version: 0.2.0.dev2, client_version: 1 + # version: 0.2.0.dev3, client_version: 2 + res = self.client.Connect(ConnectRequest(client_version=1)) self.session_id = res.session_id def create_database(self, db_name: str, conflict_type: CreateConflict = CreateConflict.Error): diff --git a/python/infinity/remote_thrift/db.py b/python/infinity/remote_thrift/db.py index f617517db6..8075e9967e 100644 --- a/python/infinity/remote_thrift/db.py +++ b/python/infinity/remote_thrift/db.py @@ -21,6 +21,7 @@ from infinity.remote_thrift.table import RemoteTable from infinity.remote_thrift.utils import check_valid_name, name_validity_check, select_res_to_polars from infinity.common import ConflictType +from infinity.common import InfinityException def get_ordinary_info(column_info, column_defs, column_name, index): @@ -53,7 +54,7 @@ def get_ordinary_info(column_info, column_defs, column_name, index): elif datatype == "bool": proto_column_type.logic_type = ttypes.LogicType.Boolean else: - raise Exception(f"unknown datatype: {datatype}") + raise InfinityException(3051, f"Unknown datatype: {datatype}") # process constraints proto_column_def.data_type = proto_column_type @@ -69,7 +70,7 @@ def get_ordinary_info(column_info, column_defs, column_name, index): elif constraint == "unique": proto_column_def.constraints.append(ttypes.Constraint.Unique) else: - raise Exception(f"unknown constraint: {constraint}") + raise InfinityException(3055, f"Unknown constraint: {constraint}") # process constant expression default = None @@ -100,7 +101,7 @@ def get_ordinary_info(column_info, column_defs, column_name, index): constant_expression = ttypes.ConstantExpr(literal_type=ttypes.LiteralType.DoubleArray, f64_array_value=default) else: - raise Exception("Invalid constant expression") + raise InfinityException(3069, "Invalid constant expression") proto_column_def.constant_expr = constant_expression column_defs.append(proto_column_def) @@ -132,7 +133,7 @@ def get_embedding_info(column_info, column_defs, column_name, index): elif element_type == "int64": embedding_type.element_type = ttypes.ElementType.ElementInt64 else: - raise Exception(f"unknown element type: {element_type}") + raise InfinityException(3057, f"Unknown element type: {element_type}") embedding_type.dimension = int(length) assert isinstance(embedding_type, ttypes.EmbeddingType) assert embedding_type.element_type is not None @@ -171,7 +172,7 @@ def get_embedding_info(column_info, column_defs, column_name, index): constant_expression = ttypes.ConstantExpr(literal_type=ttypes.LiteralType.DoubleArray, f64_array_value=default) else: - raise Exception("Invalid constant expression") + raise InfinityException(3069, "Invalid constant expression") proto_column_def.constant_expr = constant_expression column_defs.append(proto_column_def) @@ -218,7 +219,7 @@ def create_table(self, table_name: str, columns_definition, elif conflict_type == ConflictType.Replace: create_table_conflict = ttypes.CreateConflict.Replace else: - raise Exception(f"ERROR:3066, Invalid conflict type") + raise InfinityException(3066, f"Invalid conflict type") res = self._conn.create_table(db_name=self._db_name, table_name=table_name, column_defs=column_defs, @@ -227,7 +228,7 @@ def create_table(self, table_name: str, columns_definition, if res.error_code == ErrorCode.OK: return RemoteTable(self._conn, self._db_name, table_name) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("table_name", "Table") def drop_table(self, table_name, conflict_type: ConflictType = ConflictType.Error): @@ -238,14 +239,14 @@ def drop_table(self, table_name, conflict_type: ConflictType = ConflictType.Erro return self._conn.drop_table(db_name=self._db_name, table_name=table_name, conflict_type=ttypes.DropConflict.Ignore) else: - raise Exception(f"ERROR:3066, invalid conflict type") + raise InfinityException(3066, "nvalid conflict type") def list_tables(self): res = self._conn.list_tables(self._db_name) if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("table_name", "Table") def show_table(self, table_name): @@ -254,7 +255,7 @@ def show_table(self, table_name): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("table_name", "Table") def show_columns(self, table_name): @@ -263,7 +264,7 @@ def show_columns(self, table_name): if res.error_code == ErrorCode.OK: return select_res_to_polars(res) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("table_name", "Table") def get_table(self, table_name): @@ -272,11 +273,11 @@ def get_table(self, table_name): if res.error_code == ErrorCode.OK: return RemoteTable(self._conn, self._db_name, table_name) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def show_tables(self): res = self._conn.show_tables(self._db_name) if res.error_code == ErrorCode.OK: return select_res_to_polars(res) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) diff --git a/python/infinity/remote_thrift/infinity.py b/python/infinity/remote_thrift/infinity.py index cb4d810b76..b3e9ea7641 100644 --- a/python/infinity/remote_thrift/infinity.py +++ b/python/infinity/remote_thrift/infinity.py @@ -20,7 +20,7 @@ from infinity.remote_thrift.client import ThriftInfinityClient from infinity.remote_thrift.db import RemoteDatabase from infinity.remote_thrift.utils import name_validity_check, select_res_to_polars -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException class RemoteThriftInfinityConnection(InfinityConnection, ABC): @@ -44,20 +44,20 @@ def create_database(self, db_name: str, conflict_type: ConflictType = ConflictTy elif conflict_type == ConflictType.Replace: create_database_conflict = ttypes.CreateConflict.Replace else: - raise Exception(f"ERROR:3066, Invalid conflict type") + raise InfinityException(3066, "Invalid conflict type") res = self._client.create_database(db_name=db_name, conflict_type=create_database_conflict) if res.error_code == ErrorCode.OK: return RemoteDatabase(self._client, db_name) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def list_databases(self): res = self._client.list_databases() if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("db_name", "DB") def show_database(self, db_name: str): @@ -65,7 +65,7 @@ def show_database(self, db_name: str): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("db_name", "DB") def drop_database(self, db_name: str, conflict_type: ConflictType = ConflictType.Error): @@ -75,13 +75,13 @@ def drop_database(self, db_name: str, conflict_type: ConflictType = ConflictType elif conflict_type == ConflictType.Ignore: drop_database_conflict = ttypes.DropConflict.Ignore else: - raise Exception(f"ERROR:3066, invalid conflict type") + raise InfinityException(3066, "Invalid conflict type") res = self._client.drop_database(db_name=db_name, conflict_type = drop_database_conflict) if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("db_name", "DB") def get_database(self, db_name: str): @@ -89,7 +89,7 @@ def get_database(self, db_name: str): if res.error_code == ErrorCode.OK: return RemoteDatabase(self._client, db_name) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def disconnect(self): res = self._client.disconnect() @@ -97,7 +97,7 @@ def disconnect(self): self._is_connected = False return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @property def client(self): diff --git a/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService-remote b/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService-remote index e61d618823..5dd41ad6b0 100755 --- a/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService-remote +++ b/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService-remote @@ -24,7 +24,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') print('') print('Functions:') - print(' CommonResponse Connect()') + print(' CommonResponse Connect(ConnectRequest request)') print(' CommonResponse Disconnect(CommonRequest request)') print(' CommonResponse CreateDatabase(CreateDatabaseRequest request)') print(' CommonResponse DropDatabase(DropDatabaseRequest request)') @@ -133,10 +133,10 @@ client = InfinityService.Client(protocol) transport.open() if cmd == 'Connect': - if len(args) != 0: - print('Connect requires 0 args') + if len(args) != 1: + print('Connect requires 1 args') sys.exit(1) - pp.pprint(client.Connect()) + pp.pprint(client.Connect(eval(args[0]),)) elif cmd == 'Disconnect': if len(args) != 1: diff --git a/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService.py b/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService.py index 57ff4aa963..508f29e4d6 100644 --- a/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService.py +++ b/python/infinity/remote_thrift/infinity_thrift_rpc/InfinityService.py @@ -19,7 +19,12 @@ class Iface(object): - def Connect(self): + def Connect(self, request): + """ + Parameters: + - request + + """ pass def Disconnect(self, request): @@ -254,13 +259,19 @@ def __init__(self, iprot, oprot=None): self._oprot = oprot self._seqid = 0 - def Connect(self): - self.send_Connect() + def Connect(self, request): + """ + Parameters: + - request + + """ + self.send_Connect(request) return self.recv_Connect() - def send_Connect(self): + def send_Connect(self, request): self._oprot.writeMessageBegin('Connect', TMessageType.CALL, self._seqid) args = Connect_args() + args.request = request args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -1238,7 +1249,7 @@ def process_Connect(self, seqid, iprot, oprot): iprot.readMessageEnd() result = Connect_result() try: - result.success = self._handler.Connect() + result.success = self._handler.Connect(args.request) msg_type = TMessageType.REPLY except TTransport.TTransportException: raise @@ -1903,7 +1914,15 @@ def process_ShowIndex(self, seqid, iprot, oprot): class Connect_args(object): + """ + Attributes: + - request + """ + + + def __init__(self, request=None,): + self.request = request def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -1914,6 +1933,12 @@ def read(self, iprot): (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break + if fid == 1: + if ftype == TType.STRUCT: + self.request = ConnectRequest() + self.request.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1924,6 +1949,10 @@ def write(self, oprot): oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('Connect_args') + if self.request is not None: + oprot.writeFieldBegin('request', TType.STRUCT, 1) + self.request.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1942,6 +1971,8 @@ def __ne__(self, other): return not (self == other) all_structs.append(Connect_args) Connect_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'request', [ConnectRequest, None], None, ), # 1 ) diff --git a/python/infinity/remote_thrift/infinity_thrift_rpc/ttypes.py b/python/infinity/remote_thrift/infinity_thrift_rpc/ttypes.py index 0718b07a4d..cf7c24ad93 100644 --- a/python/infinity/remote_thrift/infinity_thrift_rpc/ttypes.py +++ b/python/infinity/remote_thrift/infinity_thrift_rpc/ttypes.py @@ -2527,6 +2527,63 @@ def __ne__(self, other): return not (self == other) +class ConnectRequest(object): + """ + Attributes: + - client_version + + """ + + + def __init__(self, client_version=None,): + self.client_version = client_version + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I64: + self.client_version = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('ConnectRequest') + if self.client_version is not None: + oprot.writeFieldBegin('client_version', TType.I64, 1) + oprot.writeI64(self.client_version) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class CommonRequest(object): """ Attributes: @@ -6969,6 +7026,11 @@ def __ne__(self, other): (3, TType.BOOL, 'has_header', None, None, ), # 3 (4, TType.I32, 'copy_file_type', None, None, ), # 4 ) +all_structs.append(ConnectRequest) +ConnectRequest.thrift_spec = ( + None, # 0 + (1, TType.I64, 'client_version', None, None, ), # 1 +) all_structs.append(CommonRequest) CommonRequest.thrift_spec = ( None, # 0 diff --git a/python/infinity/remote_thrift/query_builder.py b/python/infinity/remote_thrift/query_builder.py index a0ae8ce0ad..a3477db244 100644 --- a/python/infinity/remote_thrift/query_builder.py +++ b/python/infinity/remote_thrift/query_builder.py @@ -24,7 +24,7 @@ from pyarrow import Table from sqlglot import condition, maybe_parse -from infinity.common import VEC +from infinity.common import VEC, InfinityException from infinity.remote_thrift.infinity_thrift_rpc.ttypes import * from infinity.remote_thrift.types import logic_type_to_dtype from infinity.remote_thrift.utils import traverse_conditions, parse_expr @@ -75,7 +75,7 @@ def knn(self, vector_column_name: str, embedding_data: VEC, embedding_data_type: column_expr = ColumnExpr(column_name=[vector_column_name], star=False) if not isinstance(topn, int): - raise Exception(f"Invalid topn, type should be embedded, but get {type(topn)}") + raise InfinityException(3073, f"Invalid topn, type should be embedded, but get {type(topn)}") # type casting if isinstance(embedding_data, list): @@ -85,7 +85,7 @@ def knn(self, vector_column_name: str, embedding_data: VEC, embedding_data_type: elif isinstance(embedding_data, np.ndarray): embedding_data = embedding_data.tolist() else: - raise Exception(f"Invalid embedding data, type should be embedded, but get {type(embedding_data)}") + raise InfinityException(3051, f"Invalid embedding data, type should be embedded, but get {type(embedding_data)}") if (embedding_data_type == 'tinyint' or embedding_data_type == 'smallint' or @@ -97,7 +97,7 @@ def knn(self, vector_column_name: str, embedding_data: VEC, embedding_data_type: elem_type = ElementType.ElementFloat32 if embedding_data_type == 'bit': elem_type = ElementType.ElementBit - raise Exception(f"Invalid embedding {embedding_data[0]} type") + raise InfinityException(3057, f"Invalid embedding {embedding_data[0]} type") elif embedding_data_type == 'tinyint': elem_type = ElementType.ElementInt8 data.i8_array_value = embedding_data @@ -117,7 +117,7 @@ def knn(self, vector_column_name: str, embedding_data: VEC, embedding_data_type: elem_type = ElementType.ElementFloat64 data.f64_array_value = embedding_data else: - raise Exception(f"Invalid embedding {embedding_data[0]} type") + raise InfinityException(3057, f"Invalid embedding {embedding_data[0]} type") dist_type = KnnDistanceType.L2 if distance_type == 'l2': @@ -129,7 +129,7 @@ def knn(self, vector_column_name: str, embedding_data: VEC, embedding_data_type: elif distance_type == 'hamming': dist_type = KnnDistanceType.Hamming else: - raise Exception(f"Invalid distance type {distance_type}") + raise InfinityException(3056, f"Invalid distance type {distance_type}") knn_opt_params = [] if knn_params != None: diff --git a/python/infinity/remote_thrift/table.py b/python/infinity/remote_thrift/table.py index 41e79fd981..687040a43c 100644 --- a/python/infinity/remote_thrift/table.py +++ b/python/infinity/remote_thrift/table.py @@ -21,7 +21,7 @@ from sqlglot import condition import infinity.remote_thrift.infinity_thrift_rpc.ttypes as ttypes -from infinity.common import INSERT_DATA, VEC +from infinity.common import INSERT_DATA, VEC, InfinityException from infinity.errors import ErrorCode from infinity.index import IndexInfo from infinity.remote_thrift.query_builder import Query, InfinityThriftQueryBuilder, ExplainQuery @@ -78,7 +78,7 @@ def create_index(self, index_name: str, index_infos: list[IndexInfo], elif conflict_type == ConflictType.Replace: create_index_conflict = ttypes.CreateConflict.Replace else: - raise Exception(f"ERROR:3066, Invalid conflict type") + raise InfinityException(3066, f"Invalid conflict type") res = self._conn.create_index(db_name=self._db_name, table_name=self._table_name, @@ -89,7 +89,7 @@ def create_index(self, index_name: str, index_infos: list[IndexInfo], if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("index_name", "Index") def drop_index(self, index_name: str, conflict_type: ConflictType = ConflictType.Error): @@ -99,14 +99,14 @@ def drop_index(self, index_name: str, conflict_type: ConflictType = ConflictType elif conflict_type == ConflictType.Ignore: drop_index_conflict = ttypes.DropConflict.Ignore else: - raise Exception(f"ERROR:3066, invalid conflict type") + raise InfinityException(3066, f"Invalid conflict type") res = self._conn.drop_index(db_name=self._db_name, table_name=self._table_name, index_name=index_name, conflict_type=drop_index_conflict) if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) @name_validity_check("index_name", "Index") def show_index(self, index_name: str): @@ -115,35 +115,35 @@ def show_index(self, index_name: str): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def list_indexes(self): res = self._conn.list_indexes(db_name=self._db_name, table_name=self._table_name) if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def show_segments(self): res = self._conn.show_segments(db_name=self._db_name, table_name=self._table_name) if res.error_code == ErrorCode.OK: return select_res_to_polars(res) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def show_segment(self, segment_id: int): res = self._conn.show_segment(db_name=self._db_name, table_name=self._table_name, segment_id=segment_id) if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def show_blocks(self, segment_id: int): res = self._conn.show_blocks(db_name=self._db_name, table_name=self._table_name, segment_id=segment_id) if res.error_code == ErrorCode.OK: return select_res_to_polars(res) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def show_block(self, segment_id: int, block_id: int): res = self._conn.show_block(db_name=self._db_name, table_name=self._table_name, segment_id=segment_id, @@ -151,7 +151,7 @@ def show_block(self, segment_id: int, block_id: int): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def show_block_column(self, segment_id: int, block_id: int, column_id: int): res = self._conn.show_block_column(db_name=self._db_name, table_name=self._table_name, segment_id=segment_id, @@ -159,7 +159,7 @@ def show_block_column(self, segment_id: int, block_id: int, column_id: int): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def insert(self, data: Union[INSERT_DATA, list[INSERT_DATA]]): # [{"c1": 1, "c2": 1.1}, {"c1": 2, "c2": 2.2}] @@ -195,7 +195,7 @@ def insert(self, data: Union[INSERT_DATA, list[INSERT_DATA]]): constant_expression = ttypes.ConstantExpr(literal_type=ttypes.LiteralType.DoubleArray, f64_array_value=value) else: - raise Exception("Invalid constant expression") + raise InfinityException(3069, "Invalid constant expression") expr_type = ttypes.ParsedExprType( constant_expr=constant_expression) @@ -211,7 +211,7 @@ def insert(self, data: Union[INSERT_DATA, list[INSERT_DATA]]): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def import_data(self, file_path: str, import_options: {} = None): options = ttypes.ImportOption() @@ -232,19 +232,19 @@ def import_data(self, file_path: str, import_options: {} = None): elif file_type == 'fvecs': options.copy_file_type = ttypes.CopyFileType.FVECS else: - raise Exception("Unrecognized import file type") + raise InfinityException(3037, "Unrecognized import file type") elif key == 'delimiter': delimiter = v.lower() if len(delimiter) != 1: - raise Exception("Unrecognized import file delimiter") + raise InfinityException(3037, "Unrecognized import file delimiter") options.delimiter = delimiter[0] elif key == 'header': if isinstance(v, bool): options.has_header = v else: - raise Exception("Boolean value is expected in header field") + raise InfinityException(3037, "Boolean value is expected in header field") else: - raise Exception("Unknown import parameter") + raise InfinityException(3037, "Unknown import parameter") res = self._conn.import_data(db_name=self._db_name, table_name=self._table_name, @@ -253,7 +253,7 @@ def import_data(self, file_path: str, import_options: {} = None): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def delete(self, cond: Optional[str] = None): match cond: @@ -266,7 +266,7 @@ def delete(self, cond: Optional[str] = None): if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def update(self, cond: Optional[str], data: Optional[list[dict[str, Union[str, int, float, list[Union[int, float]]]]]]): @@ -301,7 +301,7 @@ def update(self, cond: Optional[str], constant_expression = ttypes.ConstantExpr(literal_type=ttypes.LiteralType.DoubleArray, f64_array_value=value) else: - raise Exception("Invalid constant expression") + raise InfinityException(3069, "Invalid constant expression") expr_type = ttypes.ParsedExprType( constant_expr=constant_expression) @@ -316,7 +316,7 @@ def update(self, cond: Optional[str], if res.error_code == ErrorCode.OK: return res else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def knn(self, vector_column_name: str, embedding_data: VEC, embedding_data_type: str, distance_type: str, topn: int, knn_params: {} = None): @@ -381,7 +381,7 @@ def _execute_query(self, query: Query) -> tuple[dict[str, list[Any]], dict[str, if res.error_code == ErrorCode.OK: return build_result(res) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) def _explain_query(self, query: ExplainQuery) -> Any: res = self._conn.explain(db_name=self._db_name, @@ -396,4 +396,4 @@ def _explain_query(self, query: ExplainQuery) -> Any: if res.error_code == ErrorCode.OK: return select_res_to_polars(res) else: - raise Exception(f"ERROR:{res.error_code}, {res.error_msg}") + raise InfinityException(res.error_code, res.error_msg) diff --git a/python/infinity/remote_thrift/utils.py b/python/infinity/remote_thrift/utils.py index 9aff19e0e1..fbb83a488c 100644 --- a/python/infinity/remote_thrift/utils.py +++ b/python/infinity/remote_thrift/utils.py @@ -22,6 +22,8 @@ import infinity.remote_thrift.infinity_thrift_rpc.ttypes as ttypes from infinity.remote_thrift.types import build_result, logic_type_to_dtype from infinity.utils import binary_exp_to_paser_exp +from infinity.common import InfinityException +from infinity.errors import ErrorCode def traverse_conditions(cons, fn=None) -> ttypes.ParsedExpr: @@ -77,7 +79,7 @@ def traverse_conditions(cons, fn=None) -> ttypes.ParsedExpr: constant_expr.literal_type = ttypes.LiteralType.String constant_expr.str_value = cons.output_name else: - raise Exception(f"unknown literal type: {cons}") + raise InfinityException(3069, f"Unknown literal type: {cons}") paser_expr_type = ttypes.ParsedExprType() paser_expr_type.constant_expr = constant_expr @@ -99,7 +101,7 @@ def traverse_conditions(cons, fn=None) -> ttypes.ParsedExpr: constant_expr.literal_type = ttypes.LiteralType.Double constant_expr.f64_value = -float(cons.hashable_args[0].output_name) else: - raise Exception(f"unknown literal type: {cons}") + raise InfinityException(3069, f"unknown literal type: {cons}") paser_expr_type = ttypes.ParsedExprType() paser_expr_type.constant_expr = constant_expr @@ -107,7 +109,7 @@ def traverse_conditions(cons, fn=None) -> ttypes.ParsedExpr: return parsed_expr else: - raise Exception(f"unknown condition type: {cons}") + raise InfinityException(3069, f"unknown condition type: {cons}") def parse_expr(expr) -> ttypes.ParsedExpr: @@ -135,7 +137,7 @@ def parse_expr(expr) -> ttypes.ParsedExpr: parsed_expr = ttypes.ParsedExpr(type=expr_type) return parsed_expr else: - raise Exception(f"unknown expression type: {expr}") + raise InfinityException(3069, f"unknown expression type: {expr}") # invalid_name_array = [ @@ -158,22 +160,24 @@ def parse_expr(expr) -> ttypes.ParsedExpr: def check_valid_name(name, name_type: str = "Table"): if not isinstance(name, str): - raise ValueError(f"{name_type} name must be a string, got {type(name)}") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, + f"{name_type} name must be a string, got {type(name)}") if not re.match(r"^[a-zA-Z][a-zA-Z0-9_]*$", name): - raise ValueError( - f"{name_type} name '{name}' is not valid. It should start with a letter and can contain only letters, numbers and underscores") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, + f"{name_type} name '{name}' is not valid. It should start with a letter and can contain only letters, numbers and underscores") if len(name) > identifier_limit: - raise ValueError(f"{name_type} name '{name}' is not of appropriate length") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, + f"{name_type} name '{name}' is not of appropriate length") if name is None: - raise ValueError(f"invalid name: {name}") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, f"invalid name: {name}") if name.isspace(): - raise ValueError(f"{name_type} name cannot be composed of whitespace characters only") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, f"{name_type} name cannot be composed of whitespace characters only") if name == '': - raise ValueError(f"invalid name: {name}") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, f"invalid name: {name}") if name == ' ': - raise ValueError(f"invalid name: {name}") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, f"invalid name: {name}") if name.isdigit(): - raise ValueError(f"invalid name: {name}") + raise InfinityException(ErrorCode.INVALID_IDENTIFIER_NAME, f"invalid name: {name}") def name_validity_check(arg_name: str, name_type: str = "Table"): diff --git a/python/infinity/table.py b/python/infinity/table.py index 043ad00951..b6bad35dac 100644 --- a/python/infinity/table.py +++ b/python/infinity/table.py @@ -18,6 +18,7 @@ import infinity.remote_thrift.infinity_thrift_rpc.ttypes as ttypes from infinity.index import IndexInfo +from infinity.common import InfinityException class ExplainType(Enum): @@ -45,7 +46,7 @@ def to_ttype(self): elif self is ExplainType.Fragment: return ttypes.ExplainType.Fragment else: - raise Exception("Unknown explain type") + raise InfinityException(3081, "Unknown explain type") class Table(ABC): diff --git a/python/infinity/utils.py b/python/infinity/utils.py index 5896ceaa45..e1dc3ef642 100644 --- a/python/infinity/utils.py +++ b/python/infinity/utils.py @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from infinity.common import InfinityException +from infinity.errors import ErrorCode + + def binary_exp_to_paser_exp(binary_expr_key) -> str: if binary_expr_key == "eq": return "=" @@ -38,4 +42,4 @@ def binary_exp_to_paser_exp(binary_expr_key) -> str: elif binary_expr_key == "div": return "/" else: - raise Exception(f"unknown binary expression: {binary_expr_key}") + raise InfinityException(ErrorCode.INVALID_EXPRESSION, f"unknown binary expression: {binary_expr_key}") diff --git a/python/test/test_convert.py b/python/test/test_convert.py index c652deb44f..3373467a20 100755 --- a/python/test/test_convert.py +++ b/python/test/test_convert.py @@ -4,7 +4,7 @@ from common import common_values import infinity from infinity.remote_thrift.query_builder import InfinityThriftQueryBuilder -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from test_sdkbase import TestSdk @@ -72,12 +72,16 @@ def test_without_output_select_list(self): "c1": {"type": "int"}, "c2": {"type": "float"}}, ConflictType.Error) table_obj.insert([{"c1": 1, "c2": 2.0}]) - with pytest.raises(Exception, match="ERROR:3050*"): + + with pytest.raises(InfinityException) as e: insert_res_df = table_obj.output([]).to_df() insert_res_arrow = table_obj.output([]).to_arrow() insert_res_pl = table_obj.output([]).to_pl() print(insert_res_df, insert_res_arrow, insert_res_pl) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.EMPTY_SELECT_FIELDS + db_obj.drop_table("test_without_output_select_list", ConflictType.Error) # disconnect res = infinity_obj.disconnect() @@ -189,10 +193,12 @@ def test_output_with_invalid_filter_function(self, filter_list): {"c1": 1000, "c2": 2.0}, {"c1": 10000, "c2": 2.0}]) # TODO add more filter function - with pytest.raises(Exception): + with pytest.raises(Exception) as e: insert_res_df = InfinityThriftQueryBuilder(table_obj).output(["*"]).filter(filter_list).to_pl() print(str(insert_res_df)) + print(e.type) + db_obj.drop_table("test_output_with_invalid_filter_function", ConflictType.Error) # disconnect res = infinity_obj.disconnect() diff --git a/python/test/test_database.py b/python/test/test_database.py index 1bb08b5149..4b92ae347b 100755 --- a/python/test/test_database.py +++ b/python/test/test_database.py @@ -16,9 +16,8 @@ import infinity import pytest from common import common_values -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from infinity.errors import ErrorCode -from infinity.common import ConflictType from test_sdkbase import TestSdk @@ -54,18 +53,30 @@ def test_database(self): db = infinity_obj.create_database("my_database") assert db - with pytest.raises(Exception): + with pytest.raises(InfinityException) as e: infinity_obj.create_database("my_database!@#") - with pytest.raises(Exception): + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + + with pytest.raises(InfinityException) as e: infinity_obj.create_database("my-database-dash") - with pytest.raises(Exception): + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + + with pytest.raises(InfinityException) as e: infinity_obj.create_database("123_database") - with pytest.raises(Exception): + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + + with pytest.raises(InfinityException) as e: infinity_obj.create_database("") + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + res = infinity_obj.list_databases() assert res is not None @@ -107,8 +118,11 @@ def test_create_database_invalid_name(self): # 2. create db with invalid name for db_name in common_values.invalid_name_array: - with pytest.raises(Exception): + with pytest.raises(InfinityException) as e: infinity_obj.create_database(db_name) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + # 3. disconnect res = infinity_obj.disconnect() @@ -264,8 +278,10 @@ def test_drop_database_with_invalid_name(self): # 2. drop db with invalid name for db_name in common_values.invalid_name_array: - with pytest.raises(Exception): + with pytest.raises(InfinityException) as e: infinity_obj.drop_database(db_name) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME # 3. disconnect res = infinity_obj.disconnect() @@ -284,14 +300,13 @@ def test_get_db(self): """ infinity_obj = infinity.connect(common_values.TEST_REMOTE_HOST) + # option: if not exists # other options are invalid - try: - # print('db name: ', db_name) - db = infinity_obj.get_database("db1") - assert False - except Exception as e: - print(e) + with pytest.raises(InfinityException) as e: + infinity_obj.get_database("db1") + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.DB_NOT_EXIST # 1. create db db = infinity_obj.create_database("my_database", ConflictType.Error) @@ -310,8 +325,11 @@ def test_get_db(self): # 2. drop db with invalid name for db_name in common_values.invalid_name_array: - with pytest.raises(Exception): + with pytest.raises(InfinityException) as e: infinity_obj.drop_database(db_name) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + # disconnect res = infinity_obj.disconnect() @@ -378,10 +396,11 @@ def test_drop_non_existent_db(self): # connect infinity_obj = infinity.connect(common_values.TEST_REMOTE_HOST) - try: - res = infinity_obj.drop_database("my_database") - except Exception as e: - print(e) + for db_name in common_values.invalid_name_array: + with pytest.raises(InfinityException) as e: + res = infinity_obj.drop_database("my_database") + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.DB_NOT_EXIST # disconnect res = infinity_obj.disconnect() @@ -395,7 +414,9 @@ def test_get_drop_db_with_two_threads(self): infinity_obj.create_database("test_get_drop_db_with_two_thread") thread1 = threading.Thread(target=infinity_obj.drop_database("test_get_drop_db_with_two_thread"), args=(1,)) - with pytest.raises(Exception, match="ERROR:3021, Not existed entry*"): + + with pytest.raises(InfinityException) as e: + # with pytest.raises(Exception, match="ERROR:3021, Not existed entry*"): thread2 = threading.Thread(target=infinity_obj.get_database("test_get_drop_db_with_two_thread"), args=(2,)) thread1.start() @@ -404,12 +425,23 @@ def test_get_drop_db_with_two_threads(self): thread1.join() thread2.join() - with pytest.raises(Exception, match="ERROR:3021, Not existed entry*"): + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.DB_NOT_EXIST + + # with pytest.raises(Exception, match="ERROR:3021, Not existed entry*"): + with pytest.raises(InfinityException) as e: infinity_obj.get_database("test_get_drop_db_with_two_thread") - with pytest.raises(Exception, match="ERROR:3021, Not existed entry*"): + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.DB_NOT_EXIST + + # with pytest.raises(Exception, match="ERROR:3021, Not existed entry*"): + with pytest.raises(InfinityException) as e: infinity_obj.drop_database("test_get_drop_db_with_two_thread") + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.DB_NOT_EXIST + # disconnect res = infinity_obj.disconnect() assert res.error_code == ErrorCode.OK @@ -420,7 +452,7 @@ def test_create_same_db_in_different_threads(self): # connect infinity_obj = infinity.connect(common_values.TEST_REMOTE_HOST) - with pytest.raises(Exception, match="ERROR:3016*"): + with pytest.raises(InfinityException) as e: thread1 = threading.Thread(target=infinity_obj.create_database("test_create_same_db_in_different_threads"), args=(1,)) thread2 = threading.Thread(target=infinity_obj.create_database("test_create_same_db_in_different_threads"), @@ -431,6 +463,9 @@ def test_create_same_db_in_different_threads(self): thread1.join() thread2.join() + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.DUPLICATE_DATABASE_NAME + # drop infinity_obj.drop_database("test_create_same_db_in_different_threads") @@ -484,9 +519,12 @@ def test_create_with_invalid_option(self, conflict_type): infinity_obj = infinity.connect(common_values.TEST_REMOTE_HOST) infinity_obj.drop_database("test_create_option", ConflictType.Ignore) - with pytest.raises(Exception, match="ERROR:3066, Invalid conflict type"): + with pytest.raises(InfinityException) as e: infinity_obj.create_database("test_create_option", conflict_type) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE + # infinity_obj.drop_database("test_create_option") # disconnect @@ -527,9 +565,12 @@ def test_drop_option(self, conflict_type): infinity_obj = infinity.connect(common_values.TEST_REMOTE_HOST) infinity_obj.drop_database("test_drop_option", ConflictType.Ignore) infinity_obj.create_database("test_drop_option") - with pytest.raises(Exception, match="ERROR:3066, invalid conflict type"): + with pytest.raises(InfinityException) as e: infinity_obj.drop_database("test_drop_option", conflict_type) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE + infinity_obj.drop_database("test_drop_option", ConflictType.Error) # disconnect res = infinity_obj.disconnect() @@ -560,9 +601,15 @@ def test_show_invalid_table(self, get_infinity_db, table_name): db_obj.create_table("test_show_table", {"c1": {"type": "int"}, "c2": {"type": "vector,3,int"}}, ConflictType.Error) - with pytest.raises(Exception): + with pytest.raises(InfinityException) as e: db_obj.show_table(table_name) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + + # with pytest.raises(Exception): + # db_obj.show_table(table_name) + db_obj.drop_table("test_show_table", ConflictType.Error) @pytest.mark.parametrize("table_name", [pytest.param("not_exist_name")]) @@ -572,9 +619,12 @@ def test_show_not_exist_table(self, get_infinity_db, table_name): db_obj.create_table("test_show_table", {"c1": {"type": "int"}, "c2": {"type": "vector,3,int"}}, ConflictType.Error) - with pytest.raises(Exception, match=f"ERROR:3022, Table {table_name} doesn't exist"): + with pytest.raises(InfinityException) as e: db_obj.show_table(table_name) + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST + db_obj.drop_table("test_show_table", ConflictType.Error) @pytest.mark.parametrize("column_name", ["test_show_table_columns"]) @@ -604,6 +654,10 @@ def test_show_table_columns_with_invalid_name(self, get_infinity_db, column_name db_obj.create_table("test_show_table_columns", {"c1": {"type": "int"}, "c2": {"type": "vector,3,int"}}) - with pytest.raises(Exception): + with pytest.raises(InfinityException) as e: db_obj.show_columns(column_name) + + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST or e.value.args[0] == ErrorCode.INVALID_IDENTIFIER_NAME + db_obj.drop_table("test_show_table_columns", ConflictType.Error) diff --git a/python/test/test_delete.py b/python/test/test_delete.py index afbe651746..c5356433e2 100755 --- a/python/test/test_delete.py +++ b/python/test/test_delete.py @@ -20,7 +20,7 @@ from common import common_values import infinity from infinity.errors import ErrorCode -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from utils import trace_expected_exceptions from test_sdkbase import TestSdk @@ -123,9 +123,12 @@ def test_delete_non_existent_table(self, get_infinity_db): table_obj = db_obj.drop_table("test_delete_non_existent_table", ConflictType.Ignore) assert table_obj - with pytest.raises(Exception, match="ERROR:3022*"): + with pytest.raises(InfinityException) as e: db_obj.get_table("test_delete_non_existent_table").delete() + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST + # delete table, all rows are met the condition @trace_expected_exceptions @pytest.mark.parametrize('column_types', common_values.types_array) @@ -284,13 +287,17 @@ def test_delete_dropped_table(self, get_infinity_db): # connect db_obj = get_infinity_db - with pytest.raises(Exception, match="ERROR:3022*"): + with pytest.raises(InfinityException) as e: db_obj.drop_table("test_delete_dropped_table") table_obj = db_obj.get_table("test_delete_dropped_table") table_obj.delete("c1 = 0") assert table_obj db_obj.drop_table("test_delete_dropped_table") + assert e.type == infinity.common.InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST + + # various expression will be given in where clause, and check result correctness @trace_expected_exceptions @pytest.mark.parametrize('column_types', ["int", "int8", "int16", "int32", "int64", "integer", diff --git a/python/test/test_index.py b/python/test/test_index.py index 2c5f112ee3..64719cc8dd 100755 --- a/python/test/test_index.py +++ b/python/test/test_index.py @@ -19,7 +19,7 @@ import pytest from common import common_values from utils import copy_data -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from infinity.errors import ErrorCode from test_sdkbase import TestSdk @@ -116,9 +116,12 @@ def test_drop_non_existent_index(self, get_infinity_db): assert table_obj is not None # drop none existent index - with pytest.raises(Exception, match="ERROR:3023*"): + with pytest.raises(InfinityException) as e: table_obj.drop_index("none_index") + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INDEX_NOT_EXIST + res = db_obj.drop_table( "test_drop_non_existent_index", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -142,12 +145,16 @@ def test_create_created_index(self, get_infinity_db): assert res.error_code == ErrorCode.OK # create created index - with pytest.raises(Exception, match="ERROR:3018*"): + with pytest.raises(InfinityException) as e: res = table_obj.create_index("my_index", [index.IndexInfo("c1", index.IndexType.IVFFlat, [index.InitParameter("centroids_count", "128"), index.InitParameter("metric", "l2")])], ConflictType.Error) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.DUPLICATE_INDEX_NAME + assert res.error_code == ErrorCode.OK res = db_obj.drop_table( "test_create_created_index", ConflictType.Error) @@ -249,13 +256,16 @@ def test_create_index_on_dropped_table(self, get_infinity_db): "test_create_drop_index_invalid_options") # create created index - with pytest.raises(Exception, match="ERROR:3022*"): + with pytest.raises(InfinityException) as e: table_obj.create_index("my_index", [index.IndexInfo("c1", index.IndexType.IVFFlat, [index.InitParameter("centroids_count", "128"), index.InitParameter("metric", "l2")])], ConflictType.Error) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST + # create index then show index def test_create_index_show_index(self, get_infinity_db): # connect @@ -313,9 +323,9 @@ def test_drop_index_show_index(self, get_infinity_db): # create index on different type of column and show index @pytest.mark.parametrize("types", ["vector, 3, float"]) @pytest.mark.parametrize("index_type", [ - (index.IndexType.Hnsw, False, "ERROR:3061*"), + (index.IndexType.Hnsw, False, ErrorCode.INVALID_INDEX_PARAM), (index.IndexType.IVFFlat, True), - (index.IndexType.FullText, False, "ERROR:3009*") + (index.IndexType.FullText, False, ErrorCode.INVALID_INDEX_DEFINITION) ]) def test_create_index_on_different_type_of_column(self, get_infinity_db, types, index_type): # connect @@ -328,12 +338,15 @@ def test_create_index_on_different_type_of_column(self, get_infinity_db, types, "c1": {"type": types}}, ConflictType.Error) # create created index if not index_type[1]: - with pytest.raises(Exception, match=index_type[2]): + with pytest.raises(InfinityException) as e: table_obj.create_index("my_index", [index.IndexInfo("c1", index_type[0], [index.InitParameter("centroids_count", "128"), index.InitParameter("metric", "l2")])], ConflictType.Error) + + assert e.type == InfinityException + assert e.value.args[0] == index_type[2] else: res = table_obj.create_index("my_index", [index.IndexInfo("c1", @@ -372,7 +385,7 @@ def test_insert_data_create_index(self, get_infinity_db, index_type): @pytest.mark.parametrize("index_type", [ (index.IndexType.IVFFlat, True), - (index.IndexType.FullText, False, "ERROR:3009*") + (index.IndexType.FullText, False, ErrorCode.INVALID_INDEX_DEFINITION) ]) @pytest.mark.parametrize("file_format", ["csv"]) def test_import_data_create_index(self, get_infinity_db, index_type, file_format): @@ -396,13 +409,16 @@ def test_import_data_create_index(self, get_infinity_db, index_type, file_format index.InitParameter("metric", "l2")])], ConflictType.Error) assert res.error_code == ErrorCode.OK else: - with pytest.raises(Exception, match=index_type[2]): + with pytest.raises(InfinityException) as e: table_obj.create_index("my_index", [index.IndexInfo("c2", index_type[0], [index.InitParameter("centroids_count", "128"), index.InitParameter("metric", "l2")])], ConflictType.Error) + assert e.type == InfinityException + assert e.value.args[0] == index_type[2] + res = db_obj.drop_table( "test_import_data_create_index", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -447,14 +463,17 @@ def test_create_index_import_data(self, get_infinity_db, index_type, file_format "c1": {"type": "int"}, "c2": {"type": "vector,3,float"}}, ConflictType.Error) - with pytest.raises(Exception, - match="ERROR:3009, Attempt to create full-text index on column: c2, data type: Embedding*"): + with pytest.raises(InfinityException) as e: res = table_obj.create_index("my_index", [index.IndexInfo("c2", index_type, [index.InitParameter("centroids_count", "128"), index.InitParameter("metric", "l2")])], ConflictType.Error) - assert res.error_code == ErrorCode.OK + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_INDEX_DEFINITION + + assert res.error_code == ErrorCode.OK table_obj.import_data(os.getcwd() + TEST_DATA_DIR + file_format + "/pysdk_test." + file_format) @@ -515,12 +534,16 @@ def test_fulltext_match_with_invalid_analyzer(self, get_infinity_db, check_data) "doctitle": {"type": "varchar"}, "docdate": {"type": "varchar"}, "body": {"type": "varchar"}}) assert res.error_code == ErrorCode.OK - with pytest.raises(Exception, match="ERROR:3077*"): + with pytest.raises(InfinityException) as e: table_obj.create_index("my_index", [index.IndexInfo("body", index.IndexType.FullText, [index.InitParameter("ANALYZER", "segmentation")]), ], ConflictType.Error) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.ANALYZER_NOT_FOUND + res = db_obj.drop_table("test_fulltext_match_with_invalid_analyzer", ConflictType.Ignore) assert res.error_code == ErrorCode.OK @@ -641,22 +664,24 @@ def test_create_index_with_invalid_options(self, get_infinity_db, conflict_type) {"c1": {"type": "vector,1024,float"}}, ConflictType.Error) assert table_obj is not None - with pytest.raises(Exception, match="ERROR:3066, Invalid conflict type"): - res = table_obj.create_index("my_index", - [index.IndexInfo("c1", - index.IndexType.Hnsw, - [ - index.InitParameter( - "M", "16"), - index.InitParameter( - "ef_construction", "50"), - index.InitParameter( - "ef", "50"), - index.InitParameter( - "metric", "l2") - ])], conflict_type) + with pytest.raises(InfinityException) as e: + table_obj.create_index("my_index", + [index.IndexInfo("c1", + index.IndexType.Hnsw, + [ + index.InitParameter( + "M", "16"), + index.InitParameter( + "ef_construction", "50"), + index.InitParameter( + "ef", "50"), + index.InitParameter( + "metric", "l2") + ])], conflict_type) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE - assert res.error_code == ErrorCode.OK res = db_obj.drop_table( "test_create_index_with_invalid_options", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -726,21 +751,23 @@ def test_create_duplicated_index_with_valid_error_options(self, get_infinity_db, assert res.error_code == ErrorCode.OK for i in range(10): - with pytest.raises(Exception, match="ERROR:3018, Duplicated table index entry*"): - res = table_obj.create_index("my_index", - [index.IndexInfo("c1", - index.IndexType.Hnsw, - [ - index.InitParameter( - "M", "16"), - index.InitParameter( - "ef_construction", "50"), - index.InitParameter( - "ef", "50"), - index.InitParameter( - "metric", "l2") - ])], conflict_type) - assert res.error_code == ErrorCode.OK + with pytest.raises(InfinityException) as e: + table_obj.create_index("my_index", + [index.IndexInfo("c1", + index.IndexType.Hnsw, + [ + index.InitParameter( + "M", "16"), + index.InitParameter( + "ef_construction", "50"), + index.InitParameter( + "ef", "50"), + index.InitParameter( + "metric", "l2") + ])], conflict_type) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.DUPLICATE_INDEX_NAME res = table_obj.drop_index("my_index", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -765,40 +792,42 @@ def test_create_duplicated_index_with_invalid_options(self, get_infinity_db, con assert table_obj is not None table_obj.drop_index("my_index", ConflictType.Ignore) - with pytest.raises(Exception, match="ERROR:3066, Invalid conflict type*"): - res = table_obj.create_index("my_index", - [index.IndexInfo("c1", - index.IndexType.Hnsw, - [ - index.InitParameter( - "M", "16"), - index.InitParameter( - "ef_construction", "50"), - index.InitParameter( - "ef", "50"), - index.InitParameter( - "metric", "l2") - ])], conflict_type) - - assert res.error_code == ErrorCode.OK + with pytest.raises(InfinityException) as e: + table_obj.create_index("my_index", + [index.IndexInfo("c1", + index.IndexType.Hnsw, + [ + index.InitParameter( + "M", "16"), + index.InitParameter( + "ef_construction", "50"), + index.InitParameter( + "ef", "50"), + index.InitParameter( + "metric", "l2") + ])], conflict_type) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE for i in range(10): - with pytest.raises(Exception, match="ERROR:3066, Invalid conflict type*"): - res = table_obj.create_index("my_index", - [index.IndexInfo("c1", - index.IndexType.Hnsw, - [ - index.InitParameter( - "M", "16"), - index.InitParameter( - "ef_construction", "50"), - index.InitParameter( - "ef", "50"), - index.InitParameter( - "metric", "l2") - ])], conflict_type) - - assert res.error_code == ErrorCode.OK + with pytest.raises(InfinityException) as e: + table_obj.create_index("my_index", + [index.IndexInfo("c1", + index.IndexType.Hnsw, + [ + index.InitParameter( + "M", "16"), + index.InitParameter( + "ef_construction", "50"), + index.InitParameter( + "ef", "50"), + index.InitParameter( + "metric", "l2") + ])], conflict_type) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE res = db_obj.drop_table( "test_create_duplicated_index_with_invalid_options", ConflictType.Error) @@ -1009,9 +1038,11 @@ def test_drop_index_with_invalid_options(self, get_infinity_db, conflict_type): assert res.error_code == ErrorCode.OK - with pytest.raises(Exception, match="ERROR:3066, invalid conflict type"): - res = table_obj.drop_index("my_index", conflict_type) - assert res.error_code == ErrorCode.OK + with pytest.raises(InfinityException) as e: + table_obj.drop_index("my_index", conflict_type) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE res = db_obj.drop_table( "test_drop_index_with_invalid_options", ConflictType.Error) @@ -1063,21 +1094,23 @@ def test_unsupported_vector_index(self, get_infinity_db, index_distance_type): {"c1": {"type": "vector,1024,float"}}, ConflictType.Error) assert table_obj is not None - with pytest.raises(Exception, match="ERROR:3061, Invalid index parameter type: Metric type*"): - res = table_obj.create_index("my_index", - [index.IndexInfo("c1", - index.IndexType.Hnsw, - [ - index.InitParameter( - "M", "16"), - index.InitParameter( - "ef_construction", "50"), - index.InitParameter( - "ef", "50"), - index.InitParameter( - "metric", index_distance_type) - ])], ConflictType.Error) - assert res.error_code == ErrorCode.OK + with pytest.raises(InfinityException) as e: + table_obj.create_index("my_index", + [index.IndexInfo("c1", + index.IndexType.Hnsw, + [ + index.InitParameter( + "M", "16"), + index.InitParameter( + "ef_construction", "50"), + index.InitParameter( + "ef", "50"), + index.InitParameter( + "metric", index_distance_type) + ])], ConflictType.Error) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_INDEX_PARAM res = table_obj.drop_index("my_index", ConflictType.Ignore) diff --git a/python/test/test_insert.py b/python/test/test_insert.py index 3fa473a92f..3ffa2aa9a5 100755 --- a/python/test/test_insert.py +++ b/python/test/test_insert.py @@ -22,7 +22,7 @@ from common import common_values import infinity import infinity.index as index -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from infinity.errors import ErrorCode from utils import start_infinity_service_in_subporcess from test_sdkbase import TestSdk @@ -342,9 +342,12 @@ def test_insert_data_into_non_existent_table(self): # insert values = [{"c1": 1, "c2": 1}] # check whether throw exception TABLE_NOT_EXIST - with pytest.raises(Exception, match="ERROR:3022*"): + with pytest.raises(InfinityException) as e: table_obj.insert(values) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST + # disconnect res = infinity_obj.disconnect() assert res.error_code == ErrorCode.OK @@ -360,9 +363,13 @@ def test_insert_empty_into_table(self, types): {"c1": {"type": "int"}, "c2": {"type": types}}, ConflictType.Error) # insert - with pytest.raises(Exception, match=".*input value count mismatch*"): + with pytest.raises(InfinityException) as e: values = [{}] table_obj.insert(values) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.SYNTAX_ERROR + insert_res = table_obj.output(["*"]).to_df() print(insert_res) @@ -575,8 +582,11 @@ def test_insert_with_invalid_data_type(self, batch, types): for i in range(5): values = [{"c1": 1, "c2": types[0]} for _ in range(batch)] if not types[1]: - with pytest.raises(Exception, match=".*ERROR:3032*"): + with pytest.raises(InfinityException) as e: table_obj.insert(values) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.NOT_SUPPORTED else: table_obj.insert(values) insert_res = table_obj.output(["*"]).to_df() @@ -700,11 +710,14 @@ def test_insert_zero_column(self): table_obj = db_obj.create_table("test_insert_zero_column", { "c1": {"type": "int"}}, ConflictType.Error) - with pytest.raises(Exception, match="ERROR:3065*"): + with pytest.raises(InfinityException) as e: table_obj.insert([]) insert_res = table_obj.output(["*"]).to_df() print(insert_res) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INSERT_WITHOUT_VALUES + res = db_obj.drop_table("test_insert_zero_column", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -729,11 +742,14 @@ def test_insert_no_match_column(self, column_name): table_obj = db_obj.create_table("test_insert_no_match_column", { "c1": {"type": "int"}}, ConflictType.Error) - with pytest.raises(Exception, match="ERROR:3024*"): + with pytest.raises(InfinityException) as e: table_obj.insert([{column_name: 1}]) insert_res = table_obj.output(["*"]).to_df() print(insert_res) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.COLUMN_NOT_EXIST + res = db_obj.drop_table( "test_insert_no_match_column", ConflictType.Error) assert res.error_code == ErrorCode.OK diff --git a/python/test/test_knn.py b/python/test/test_knn.py index 7adff4108f..dc95c03b9f 100755 --- a/python/test/test_knn.py +++ b/python/test/test_knn.py @@ -19,7 +19,7 @@ import infinity import infinity.index as index from infinity.errors import ErrorCode -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from utils import copy_data, generate_commas_enwiki from test_sdkbase import TestSdk @@ -187,10 +187,11 @@ def test_knn_on_non_vector_column(self, get_infinity_db, check_data, column_name copy_data("tmp_20240116.csv") test_csv_dir = "/var/infinity/test_data/tmp_20240116.csv" table_obj.import_data(test_csv_dir, None) - with pytest.raises(Exception, match="ERROR:3013, Expect the column search is an embedding column*"): - res = table_obj.output(["variant_id", "_row_id"]).knn( - column_name, [1.0] * 4, "float", "ip", 2).to_pl() - print(res) + with pytest.raises(InfinityException) as e: + table_obj.output(["variant_id", "_row_id"]).knn(column_name, [1.0] * 4, "float", "ip", 2).to_pl() + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.SYNTAX_ERROR res = db_obj.drop_table( "test_knn_on_non_vector_column", ConflictType.Error) @@ -402,10 +403,14 @@ def test_various_distance_type(self, get_infinity_db, check_data, embedding_data 2).to_pl() print(res) else: - with pytest.raises(Exception, match="ERROR:3032*"): - res = table_obj.output(["variant_id"]).knn("gender_vector", embedding_data, embedding_data_type[0], - distance_type[0], - 2).to_pl() + with pytest.raises(InfinityException) as e: + table_obj.output(["variant_id"]).knn("gender_vector", embedding_data, embedding_data_type[0], + distance_type[0], + 2).to_pl() + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.NOT_SUPPORTED + res = db_obj.drop_table( "test_various_distance_type", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -415,13 +420,13 @@ def test_various_distance_type(self, get_infinity_db, check_data, embedding_data @pytest.mark.parametrize("topn", [ (2, True), (10, True), - (0, False, "ERROR:3014*"), - (-1, False, "ERROR:3014*"), - (1.1, False, "Invalid topn"), - ("test", False, "Invalid topn"), - ({}, False, "Invalid topn"), - ((), False, "Invalid topn"), - ([1] * 4, False, "Invalid topn"), + (0, False, ErrorCode.INVALID_PARAMETER_VALUE), + (-1, False, ErrorCode.INVALID_PARAMETER_VALUE), + (1.1, False, ErrorCode.INVALID_TOPK_TYPE), + ("test", False, ErrorCode.INVALID_TOPK_TYPE), + ({}, False, ErrorCode.INVALID_TOPK_TYPE), + ((), False, ErrorCode.INVALID_TOPK_TYPE), + ([1] * 4, False, ErrorCode.INVALID_TOPK_TYPE), ]) def test_various_topn(self, get_infinity_db, check_data, topn): db_obj = get_infinity_db @@ -448,9 +453,13 @@ def test_various_topn(self, get_infinity_db, check_data, topn): "gender_vector", [1] * 4, "float", "l2", topn[0]).to_pl() print(res) else: - with pytest.raises(Exception, match=topn[2]): - res = table_obj.output(["variant_id"]).knn( + with pytest.raises(InfinityException) as e: + table_obj.output(["variant_id"]).knn( "gender_vector", [1] * 4, "float", "l2", topn[0]).to_pl() + + assert e.type == InfinityException + assert e.value.args[0] == topn[2] + res = db_obj.drop_table("test_various_topn", ConflictType.Error) assert res.error_code == ErrorCode.OK diff --git a/python/test/test_py_import.py b/python/test/test_py_import.py index 0274e7cf14..a3baf9e1dd 100755 --- a/python/test/test_py_import.py +++ b/python/test/test_py_import.py @@ -19,7 +19,7 @@ from common import common_values import infinity from infinity.errors import ErrorCode -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from test_sdkbase import TestSdk from utils import generate_big_int_csv, copy_data, generate_big_rows_csv, generate_big_columns_csv, generate_fvecs, \ @@ -195,7 +195,7 @@ def test_import_format_unrecognized_data(self, get_infinity_db, file_format): "int", "int8", "int16", "int32", "int64", "integer", "float", "float32", "double", "float64", "varchar", - ("bool", 7012) + ("bool", ErrorCode.PARSER_ERROR) ]) @pytest.mark.parametrize("check_data", [{"file_name": "pysdk_test_blankspace.csv", "data_dir": common_values.TEST_TMP_DIR}, @@ -224,11 +224,14 @@ def test_csv_with_different_delimiter(self, get_infinity_db, check_data, delimit else: table_obj = db_obj.create_table("test_csv_with_different_delimiter", { "c1": {"type": types[0]}, "c2": {"type": types[0]}}, ConflictType.Error) - with pytest.raises(Exception, match=f"ERROR:{types[1]}*"): + with pytest.raises(InfinityException) as e: table_obj.import_data(common_values.TEST_TMP_DIR + "/pysdk_test_" + delimiter[0] + ".csv", import_options={ "delimiter": delimiter[1] }) + + assert e.type == InfinityException + assert e.value.args[0] == types[1] db_obj.drop_table("test_csv_with_different_delimiter", ConflictType.Error) # import csv with delimiter more than one character @@ -277,10 +280,13 @@ def test_import_fvecs_table_with_more_columns(self, get_infinity_db, check_data) db_obj.drop_table("test_import_fvecs_table_with_more_columns", ConflictType.Ignore) table_obj = db_obj.create_table("test_import_fvecs_table_with_more_columns", {"c1": {"type": "int"}, "c2": {"type": "vector,128,float"}}) - with pytest.raises(Exception, match="ERROR:3037*"): + + with pytest.raises(InfinityException) as e: test_csv_dir = common_values.TEST_TMP_DIR + "pysdk_test.fvecs" - res = table_obj.import_data(test_csv_dir, import_options={"file_type": "fvecs"}) - assert res.error_code == ErrorCode.OK + table_obj.import_data(test_csv_dir, import_options={"file_type": "fvecs"}) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.IMPORT_FILE_FORMAT_ERROR res = table_obj.output(["*"]).to_df() print(res) @@ -324,9 +330,12 @@ def test_import_embedding_with_dimension_unmatch(self, get_infinity_db, check_da {"c1": {"type": "int"}, "c2": {"type": types}}) test_csv_dir = common_values.TEST_TMP_DIR + "embedding_int_dim3.csv" - with pytest.raises(Exception, match="ERROR:3037, Import file format error:*"): - res = table_obj.import_data(test_csv_dir, import_options={"file_type": "csv"}) - assert res.error_code == ErrorCode.OK + + with pytest.raises(InfinityException) as e: + table_obj.import_data(test_csv_dir, import_options={"file_type": "csv"}) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.IMPORT_FILE_FORMAT_ERROR res = table_obj.output(["*"]).to_df() print(res) @@ -406,9 +415,11 @@ def test_table_with_not_matched_columns(self, get_infinity_db, columns, check_da table_obj = db_obj.create_table("test_table_with_not_matched_columns", columns) test_csv_dir = common_values.TEST_TMP_DIR + "pysdk_test_commas.csv" - with pytest.raises(Exception, match="ERROR:3037*"): - res = table_obj.import_data(test_csv_dir) - assert res.error_code == ErrorCode.OK + with pytest.raises(InfinityException) as e: + table_obj.import_data(test_csv_dir) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.COLUMN_COUNT_MISMATCH or e.value.args[0] == ErrorCode.IMPORT_FILE_FORMAT_ERROR res = table_obj.output(["*"]).to_df() print(res) diff --git a/python/test/test_table.py b/python/test/test_table.py index 6b63fe4d8e..92b0140026 100755 --- a/python/test/test_table.py +++ b/python/test/test_table.py @@ -17,7 +17,7 @@ import polars as pl from common import common_values -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException import infinity from infinity.errors import ErrorCode from utils import trace_expected_exceptions @@ -449,10 +449,13 @@ def test_table_with_different_invalid_options(self, get_infinity_db, invalid_opt db_obj = get_infinity_db db_obj.drop_table("test_table_with_different_invalid_options", ConflictType.Ignore) - with pytest.raises(Exception, match="ERROR:3066, Invalid conflict type"): + with pytest.raises(InfinityException) as e: db_obj.create_table("test_table_with_different_invalid_options", {"c1": {"type": "int"}}, invalid_option_array) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE + # create/drop/show/get 1000 tables with 10000 columns with various column types. @pytest.mark.slow @pytest.mark.skipif(condition=os.getenv("RUNSLOWTEST")!="1", reason="Cost too much times,and may cause the serve to terminate") @@ -785,9 +788,12 @@ def test_create_same_name_table(self): # create db_obj.create_table("test_create_same_name", {"c1": {"type": "int"}}, ConflictType.Error) - with pytest.raises(Exception, match="ERROR:3017*"): + with pytest.raises(InfinityException) as e: db_obj.create_table("test_create_same_name", {"c1": {"type": "int"}}, ConflictType.Error) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.DUPLICATE_TABLE_NAME + res = db_obj.drop_table("test_create_same_name", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -866,9 +872,12 @@ def test_table_create_valid_option(self, get_infinity_db, conflict_type): def test_table_create_invalid_option(self, get_infinity_db, conflict_type): db_obj = get_infinity_db db_obj.drop_table("test_various_table_create_option", ConflictType.Ignore) - with pytest.raises(Exception, match=f"ERROR:3066, Invalid conflict type"): + with pytest.raises(InfinityException) as e: db_obj.create_table("test_various_table_create_option", {"c1": {"type": "int"}}, conflict_type) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE + @pytest.mark.parametrize("conflict_type", [ConflictType.Error, ConflictType.Ignore, @@ -892,9 +901,12 @@ def test_table_drop_valid_option(self, get_infinity_db, conflict_type): def test_table_drop_invalid_option(self, get_infinity_db, conflict_type): db_obj = get_infinity_db db_obj.create_table("test_various_table_drop_option", {"c1": {"type": "int"}}, ConflictType.Ignore) - with pytest.raises(Exception, match=f"ERROR:3066, invalid conflict type"): + with pytest.raises(InfinityException) as e: db_obj.drop_table("test_various_table_drop_option", conflict_type) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.INVALID_CONFLICT_TYPE + res = db_obj.drop_table("test_various_table_drop_option", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -913,11 +925,14 @@ def test_create_duplicated_table_with_error_option(self, get_infinity_db): db_obj = get_infinity_db db_obj.drop_table("test_create_duplicated_table_with_error_option", ConflictType.Ignore) - with pytest.raises(Exception, match="ERROR:3017*"): + with pytest.raises(InfinityException) as e: for i in range(100): db_obj.create_table("test_create_duplicated_table_with_error_option", {"c1": {"type": "int"}}, ConflictType.Error) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.DUPLICATE_TABLE_NAME + res = db_obj.drop_table("test_create_duplicated_table_with_error_option", ConflictType.Error) assert res.error_code == ErrorCode.OK @@ -925,10 +940,13 @@ def test_create_duplicated_table_with_replace_option(self, get_infinity_db): db_obj = get_infinity_db db_obj.drop_table("test_create_duplicated_table_with_replace_option", ConflictType.Ignore) - with pytest.raises(Exception, match="ERROR:3017*"): + with pytest.raises(InfinityException) as e: for i in range(100): db_obj.create_table("test_create_duplicated_table_with_replace_option", {"c" + str(i): {"type": "int"}}, ConflictType.Replace) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.DUPLICATE_TABLE_NAME + res = db_obj.drop_table("test_create_duplicated_table_with_replace_option", ConflictType.Error) assert res.error_code == ErrorCode.OK diff --git a/python/test/test_update.py b/python/test/test_update.py index 0c56056934..7b52c48048 100755 --- a/python/test/test_update.py +++ b/python/test/test_update.py @@ -21,7 +21,7 @@ from common import common_values import infinity from infinity.errors import ErrorCode -from infinity.common import ConflictType +from infinity.common import ConflictType, InfinityException from utils import trace_expected_exceptions from test_sdkbase import TestSdk @@ -412,11 +412,14 @@ def test_update_dropped_table(self): assert res.error_code == ErrorCode.OK # update - with pytest.raises(Exception, match="ERROR:3022*"): + with pytest.raises(InfinityException) as e: table_obj.update("c1 = 1", [{"c2": 21}]) update_res = table_obj.output(["*"]).to_df() print(update_res) + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.TABLE_NOT_EXIST + # disconnect res = infinity_obj.disconnect() assert res.error_code == ErrorCode.OK @@ -483,8 +486,12 @@ def test_update_invalid_value(self, types, types_example): ConflictType.Error) # update - with pytest.raises(Exception, match="ERROR:3049, Not support to convert Embedding to*"): + with pytest.raises(InfinityException) as e: table_obj.update("c1 = 1", [{"c2": types_example}]) + + assert e.type == InfinityException + assert e.value.args[0] == ErrorCode.NOT_SUPPORTED_TYPE_CONVERSION + update_res = table_obj.output(["*"]).to_df() print(update_res) diff --git a/src/common/status.cpp b/src/common/status.cpp index 32552c6602..6d1c703596 100644 --- a/src/common/status.cpp +++ b/src/common/status.cpp @@ -110,6 +110,17 @@ Status Status::InsufficientPrivilege(const String &user_name, const String &deta return Status(ErrorCode::kInsufficientPrivilege, MakeUnique(fmt::format("{} do not have permission to {}", user_name, detailed_error))); } +Status Status::UnsupportedVersionIndex(i64 given_index) { + return Status(ErrorCode::kUnsupportedVersionIndex, + MakeUnique(fmt::format("Index: {} isn't supported, you are using a deprecated version of Python SDK. Please install the corresponding version Python SDK.", + given_index))); +} + +Status Status::ClientVersionMismatch(const char* expected_version, const char* given_version) { + return Status(ErrorCode::kClientVersionMismatch, MakeUnique(fmt::format("Expected version index: {}, connecting version: {}", + expected_version, given_version))); +} + // 3. Syntax error or access rule violation Status Status::InvalidUserName(const String &user_name) { return Status(ErrorCode::kInvalidUsername, MakeUnique(fmt::format("{} is a invalid user name", user_name))); @@ -117,8 +128,8 @@ Status Status::InvalidUserName(const String &user_name) { Status Status::InvalidPasswd() { return Status(ErrorCode::kInvalidPasswd, MakeUnique(fmt::format("Invalid password"))); } -Status Status::InvalidDBName(const String &db_name) { - return Status(ErrorCode::kInvalidDbName, MakeUnique(fmt::format("{} is a invalid database name", db_name))); +Status Status::InvalidIdentifierName(const String &db_name) { + return Status(ErrorCode::kInvalidIdentifierName, MakeUnique(fmt::format("{} is a invalid identifier name", db_name))); } Status Status::InvalidTableName(const String &table_name) { @@ -380,7 +391,7 @@ Status Status::InvalidAnalyzerName(const String& name) { } Status Status::InvalidAnalyzerFile(const String& detailed_info) { - return Status(ErrorCode::kInvalidAnalyzerName, MakeUnique(fmt::format("Invalid analyzer file: {}", detailed_info))); + return Status(ErrorCode::kInvalidAnalyzerName, MakeUnique(fmt::format("Invalid analyzer file path: {}", detailed_info))); } // 4. TXN fail diff --git a/src/common/status.cppm b/src/common/status.cppm index 050d4f5b44..62afceb8d9 100644 --- a/src/common/status.cppm +++ b/src/common/status.cppm @@ -39,11 +39,13 @@ export enum class ErrorCode : long { // 2. Auth error kWrongPasswd = 2001, kInsufficientPrivilege = 2002, + kUnsupportedVersionIndex = 2003, + kClientVersionMismatch = 2004, // 3. syntax error or access rule violation kInvalidUsername = 3001, kInvalidPasswd = 3002, - kInvalidDbName = 3003, + kInvalidIdentifierName = 3003, kInvalidTableName = 3004, kInvalidColumnName = 3005, kInvalidIndexName = 3006, @@ -121,6 +123,7 @@ export enum class ErrorCode : long { kNotSupportedAnalyzer = 3078, kInvalidAnalyzerName = 3079, kInvalidAnalyzerFile = 3080, + kInvalidExplainType = 3081, // 4. Txn fail kTxnRollback = 4001, @@ -154,6 +157,7 @@ export enum class ErrorCode : long { kMmapFileError = 7013, kMunmapFileError = 7014, kInvalidFileFlag = 7015, + kInvalidServerAddress = 7016, // 8. meta error kInvalidEntry = 8001, @@ -171,10 +175,6 @@ public: // 1. Config error static Status InvalidTimeInfo(const String &time_info); static Status EmptyConfigParameter(); - - // 2. Auth error - static Status WrongPasswd(const String &user_name); - static Status InsufficientPrivilege(const String &user_name, const String &detailed_error); static Status MismatchVersion(const String ¤t_version, const String &expected_version); static Status InvalidTimezone(const String &timezone); static Status InvalidByteSize(const String &byte_size); @@ -182,10 +182,16 @@ public: static Status InvalidLogLevel(const String &log_level); static Status InvalidConfig(const String &detailed_info); + // 2. Auth error + static Status WrongPasswd(const String &user_name); + static Status InsufficientPrivilege(const String &user_name, const String &detailed_error); + static Status UnsupportedVersionIndex(i64 given_index); + static Status ClientVersionMismatch(const char* expected_version, const char* given_version); + // 3. Syntax error or access rule violation static Status InvalidUserName(const String &user_name); static Status InvalidPasswd(); - static Status InvalidDBName(const String &db_name); + static Status InvalidIdentifierName(const String &db_name); static Status InvalidTableName(const String &table_name); static Status InvalidColumnName(const String &column_name); static Status InvalidIndexName(const String &index_name); diff --git a/src/executor/operator/physical_import.cpp b/src/executor/operator/physical_import.cpp index 7b62c83af3..9d4d638ffe 100644 --- a/src/executor/operator/physical_import.cpp +++ b/src/executor/operator/physical_import.cpp @@ -474,11 +474,10 @@ void PhysicalImport::CSVRowHandler(void *context) { // if column count is larger than columns defined from schema, extra columns are abandoned if (column_count > table_entry->ColumnCount()) { UniquePtr err_msg = MakeUnique( - fmt::format("CSV file row count isn't match with table schema, row id: {}, column_count = {}, table_entry->ColumnCount = {}.", + fmt::format("CSV file column count isn't match with table schema, row id: {}, column_count = {}, table_entry->ColumnCount = {}.", parser_context->row_count_, column_count, table_entry->ColumnCount())); - LOG_ERROR(*err_msg); for (SizeT i = 0; i < column_count; ++i) { ZsvCell cell = parser_context->parser_.GetCell(i); LOG_ERROR(fmt::format("Column {}: {}", i, std::string_view((char *)cell.str, cell.len))); diff --git a/src/network/infinity_thrift/InfinityService.cpp b/src/network/infinity_thrift/InfinityService.cpp index 36256627b2..cc729166a7 100644 --- a/src/network/infinity_thrift/InfinityService.cpp +++ b/src/network/infinity_thrift/InfinityService.cpp @@ -32,7 +32,20 @@ uint32_t InfinityService_Connect_args::read(::apache::thrift::protocol::TProtoco if (ftype == ::apache::thrift::protocol::T_STOP) { break; } - xfer += iprot->skip(ftype); + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->request.read(iprot); + this->__isset.request = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } xfer += iprot->readFieldEnd(); } @@ -46,6 +59,10 @@ uint32_t InfinityService_Connect_args::write(::apache::thrift::protocol::TProtoc ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("InfinityService_Connect_args"); + xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->request.write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -61,6 +78,10 @@ uint32_t InfinityService_Connect_pargs::write(::apache::thrift::protocol::TProto ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("InfinityService_Connect_pargs"); + xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->request)).write(oprot); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -5410,18 +5431,19 @@ uint32_t InfinityService_ShowIndex_presult::read(::apache::thrift::protocol::TPr return xfer; } -void InfinityServiceClient::Connect(CommonResponse& _return) +void InfinityServiceClient::Connect(CommonResponse& _return, const ConnectRequest& request) { - send_Connect(); + send_Connect(request); recv_Connect(_return); } -void InfinityServiceClient::send_Connect() +void InfinityServiceClient::send_Connect(const ConnectRequest& request) { int32_t cseqid = 0; oprot_->writeMessageBegin("Connect", ::apache::thrift::protocol::T_CALL, cseqid); InfinityService_Connect_pargs args; + args.request = &request; args.write(oprot_); oprot_->writeMessageEnd(); @@ -7133,7 +7155,7 @@ void InfinityServiceProcessor::process_Connect(int32_t seqid, ::apache::thrift:: InfinityService_Connect_result result; try { - iface_->Connect(result.success); + iface_->Connect(result.success, args.request); result.__isset.success = true; } catch (const std::exception& e) { if (this->eventHandler_.get() != nullptr) { @@ -8683,19 +8705,20 @@ ::std::shared_ptr< ::apache::thrift::TProcessor > InfinityServiceProcessorFactor return processor; } -void InfinityServiceConcurrentClient::Connect(CommonResponse& _return) +void InfinityServiceConcurrentClient::Connect(CommonResponse& _return, const ConnectRequest& request) { - int32_t seqid = send_Connect(); + int32_t seqid = send_Connect(request); recv_Connect(_return, seqid); } -int32_t InfinityServiceConcurrentClient::send_Connect() +int32_t InfinityServiceConcurrentClient::send_Connect(const ConnectRequest& request) { int32_t cseqid = this->sync_->generateSeqId(); ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("Connect", ::apache::thrift::protocol::T_CALL, cseqid); InfinityService_Connect_pargs args; + args.request = &request; args.write(oprot_); oprot_->writeMessageEnd(); diff --git a/src/network/infinity_thrift/InfinityService.h b/src/network/infinity_thrift/InfinityService.h index f6ead663e2..7144e843c2 100644 --- a/src/network/infinity_thrift/InfinityService.h +++ b/src/network/infinity_thrift/InfinityService.h @@ -22,7 +22,7 @@ namespace infinity_thrift_rpc { class InfinityServiceIf { public: virtual ~InfinityServiceIf() {} - virtual void Connect(CommonResponse& _return) = 0; + virtual void Connect(CommonResponse& _return, const ConnectRequest& request) = 0; virtual void Disconnect(CommonResponse& _return, const CommonRequest& request) = 0; virtual void CreateDatabase(CommonResponse& _return, const CreateDatabaseRequest& request) = 0; virtual void DropDatabase(CommonResponse& _return, const DropDatabaseRequest& request) = 0; @@ -80,7 +80,7 @@ class InfinityServiceIfSingletonFactory : virtual public InfinityServiceIfFactor class InfinityServiceNull : virtual public InfinityServiceIf { public: virtual ~InfinityServiceNull() {} - void Connect(CommonResponse& /* _return */) override { + void Connect(CommonResponse& /* _return */, const ConnectRequest& /* request */) override { return; } void Disconnect(CommonResponse& /* _return */, const CommonRequest& /* request */) override { @@ -169,6 +169,10 @@ class InfinityServiceNull : virtual public InfinityServiceIf { } }; +typedef struct _InfinityService_Connect_args__isset { + _InfinityService_Connect_args__isset() : request(false) {} + bool request :1; +} _InfinityService_Connect_args__isset; class InfinityService_Connect_args { public: @@ -179,9 +183,16 @@ class InfinityService_Connect_args { } virtual ~InfinityService_Connect_args() noexcept; + ConnectRequest request; + + _InfinityService_Connect_args__isset __isset; + + void __set_request(const ConnectRequest& val); - bool operator == (const InfinityService_Connect_args & /* rhs */) const + bool operator == (const InfinityService_Connect_args & rhs) const { + if (!(request == rhs.request)) + return false; return true; } bool operator != (const InfinityService_Connect_args &rhs) const { @@ -201,6 +212,7 @@ class InfinityService_Connect_pargs { virtual ~InfinityService_Connect_pargs() noexcept; + const ConnectRequest* request; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -3198,8 +3210,8 @@ class InfinityServiceClient : virtual public InfinityServiceIf { std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } - void Connect(CommonResponse& _return) override; - void send_Connect(); + void Connect(CommonResponse& _return, const ConnectRequest& request) override; + void send_Connect(const ConnectRequest& request); void recv_Connect(CommonResponse& _return); void Disconnect(CommonResponse& _return, const CommonRequest& request) override; void send_Disconnect(const CommonRequest& request); @@ -3389,13 +3401,13 @@ class InfinityServiceMultiface : virtual public InfinityServiceIf { ifaces_.push_back(iface); } public: - void Connect(CommonResponse& _return) override { + void Connect(CommonResponse& _return, const ConnectRequest& request) override { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { - ifaces_[i]->Connect(_return); + ifaces_[i]->Connect(_return, request); } - ifaces_[i]->Connect(_return); + ifaces_[i]->Connect(_return, request); return; } @@ -3711,8 +3723,8 @@ class InfinityServiceConcurrentClient : virtual public InfinityServiceIf { std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } - void Connect(CommonResponse& _return) override; - int32_t send_Connect(); + void Connect(CommonResponse& _return, const ConnectRequest& request) override; + int32_t send_Connect(const ConnectRequest& request); void recv_Connect(CommonResponse& _return, const int32_t seqid); void Disconnect(CommonResponse& _return, const CommonRequest& request) override; int32_t send_Disconnect(const CommonRequest& request); diff --git a/src/network/infinity_thrift/infinity_types.cpp b/src/network/infinity_thrift/infinity_types.cpp index 396a12a335..f2c544762a 100644 --- a/src/network/infinity_thrift/infinity_types.cpp +++ b/src/network/infinity_thrift/infinity_types.cpp @@ -4345,6 +4345,98 @@ void ImportOption::printTo(std::ostream& out) const { } +ConnectRequest::~ConnectRequest() noexcept { +} + + +void ConnectRequest::__set_client_version(const int64_t val) { + this->client_version = val; +} +std::ostream& operator<<(std::ostream& out, const ConnectRequest& obj) +{ + obj.printTo(out); + return out; +} + + +uint32_t ConnectRequest::read(::apache::thrift::protocol::TProtocol* iprot) { + + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->client_version); + this->__isset.client_version = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ConnectRequest::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ConnectRequest"); + + xfer += oprot->writeFieldBegin("client_version", ::apache::thrift::protocol::T_I64, 1); + xfer += oprot->writeI64(this->client_version); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(ConnectRequest &a, ConnectRequest &b) { + using ::std::swap; + swap(a.client_version, b.client_version); + swap(a.__isset, b.__isset); +} + +ConnectRequest::ConnectRequest(const ConnectRequest& other170) noexcept { + client_version = other170.client_version; + __isset = other170.__isset; +} +ConnectRequest& ConnectRequest::operator=(const ConnectRequest& other171) noexcept { + client_version = other171.client_version; + __isset = other171.__isset; + return *this; +} +void ConnectRequest::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "ConnectRequest("; + out << "client_version=" << to_string(client_version); + out << ")"; +} + + CommonRequest::~CommonRequest() noexcept { } @@ -4420,13 +4512,13 @@ void swap(CommonRequest &a, CommonRequest &b) { swap(a.__isset, b.__isset); } -CommonRequest::CommonRequest(const CommonRequest& other170) noexcept { - session_id = other170.session_id; - __isset = other170.__isset; +CommonRequest::CommonRequest(const CommonRequest& other172) noexcept { + session_id = other172.session_id; + __isset = other172.__isset; } -CommonRequest& CommonRequest::operator=(const CommonRequest& other171) noexcept { - session_id = other171.session_id; - __isset = other171.__isset; +CommonRequest& CommonRequest::operator=(const CommonRequest& other173) noexcept { + session_id = other173.session_id; + __isset = other173.__isset; return *this; } void CommonRequest::printTo(std::ostream& out) const { @@ -4546,17 +4638,17 @@ void swap(CommonResponse &a, CommonResponse &b) { swap(a.__isset, b.__isset); } -CommonResponse::CommonResponse(const CommonResponse& other172) { - error_code = other172.error_code; - error_msg = other172.error_msg; - session_id = other172.session_id; - __isset = other172.__isset; +CommonResponse::CommonResponse(const CommonResponse& other174) { + error_code = other174.error_code; + error_msg = other174.error_msg; + session_id = other174.session_id; + __isset = other174.__isset; } -CommonResponse& CommonResponse::operator=(const CommonResponse& other173) { - error_code = other173.error_code; - error_msg = other173.error_msg; - session_id = other173.session_id; - __isset = other173.__isset; +CommonResponse& CommonResponse::operator=(const CommonResponse& other175) { + error_code = other175.error_code; + error_msg = other175.error_msg; + session_id = other175.session_id; + __isset = other175.__isset; return *this; } void CommonResponse::printTo(std::ostream& out) const { @@ -4644,13 +4736,13 @@ void swap(ListDatabaseRequest &a, ListDatabaseRequest &b) { swap(a.__isset, b.__isset); } -ListDatabaseRequest::ListDatabaseRequest(const ListDatabaseRequest& other174) noexcept { - session_id = other174.session_id; - __isset = other174.__isset; +ListDatabaseRequest::ListDatabaseRequest(const ListDatabaseRequest& other176) noexcept { + session_id = other176.session_id; + __isset = other176.__isset; } -ListDatabaseRequest& ListDatabaseRequest::operator=(const ListDatabaseRequest& other175) noexcept { - session_id = other175.session_id; - __isset = other175.__isset; +ListDatabaseRequest& ListDatabaseRequest::operator=(const ListDatabaseRequest& other177) noexcept { + session_id = other177.session_id; + __isset = other177.__isset; return *this; } void ListDatabaseRequest::printTo(std::ostream& out) const { @@ -4724,14 +4816,14 @@ uint32_t ListDatabaseResponse::read(::apache::thrift::protocol::TProtocol* iprot if (ftype == ::apache::thrift::protocol::T_LIST) { { this->db_names.clear(); - uint32_t _size176; - ::apache::thrift::protocol::TType _etype179; - xfer += iprot->readListBegin(_etype179, _size176); - this->db_names.resize(_size176); - uint32_t _i180; - for (_i180 = 0; _i180 < _size176; ++_i180) + uint32_t _size178; + ::apache::thrift::protocol::TType _etype181; + xfer += iprot->readListBegin(_etype181, _size178); + this->db_names.resize(_size178); + uint32_t _i182; + for (_i182 = 0; _i182 < _size178; ++_i182) { - xfer += iprot->readString(this->db_names[_i180]); + xfer += iprot->readString(this->db_names[_i182]); } xfer += iprot->readListEnd(); } @@ -4768,10 +4860,10 @@ uint32_t ListDatabaseResponse::write(::apache::thrift::protocol::TProtocol* opro xfer += oprot->writeFieldBegin("db_names", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->db_names.size())); - std::vector ::const_iterator _iter181; - for (_iter181 = this->db_names.begin(); _iter181 != this->db_names.end(); ++_iter181) + std::vector ::const_iterator _iter183; + for (_iter183 = this->db_names.begin(); _iter183 != this->db_names.end(); ++_iter183) { - xfer += oprot->writeString((*_iter181)); + xfer += oprot->writeString((*_iter183)); } xfer += oprot->writeListEnd(); } @@ -4790,17 +4882,17 @@ void swap(ListDatabaseResponse &a, ListDatabaseResponse &b) { swap(a.__isset, b.__isset); } -ListDatabaseResponse::ListDatabaseResponse(const ListDatabaseResponse& other182) { - error_code = other182.error_code; - error_msg = other182.error_msg; - db_names = other182.db_names; - __isset = other182.__isset; +ListDatabaseResponse::ListDatabaseResponse(const ListDatabaseResponse& other184) { + error_code = other184.error_code; + error_msg = other184.error_msg; + db_names = other184.db_names; + __isset = other184.__isset; } -ListDatabaseResponse& ListDatabaseResponse::operator=(const ListDatabaseResponse& other183) { - error_code = other183.error_code; - error_msg = other183.error_msg; - db_names = other183.db_names; - __isset = other183.__isset; +ListDatabaseResponse& ListDatabaseResponse::operator=(const ListDatabaseResponse& other185) { + error_code = other185.error_code; + error_msg = other185.error_msg; + db_names = other185.db_names; + __isset = other185.__isset; return *this; } void ListDatabaseResponse::printTo(std::ostream& out) const { @@ -4905,15 +4997,15 @@ void swap(ListTableRequest &a, ListTableRequest &b) { swap(a.__isset, b.__isset); } -ListTableRequest::ListTableRequest(const ListTableRequest& other184) { - db_name = other184.db_name; - session_id = other184.session_id; - __isset = other184.__isset; +ListTableRequest::ListTableRequest(const ListTableRequest& other186) { + db_name = other186.db_name; + session_id = other186.session_id; + __isset = other186.__isset; } -ListTableRequest& ListTableRequest::operator=(const ListTableRequest& other185) { - db_name = other185.db_name; - session_id = other185.session_id; - __isset = other185.__isset; +ListTableRequest& ListTableRequest::operator=(const ListTableRequest& other187) { + db_name = other187.db_name; + session_id = other187.session_id; + __isset = other187.__isset; return *this; } void ListTableRequest::printTo(std::ostream& out) const { @@ -4988,14 +5080,14 @@ uint32_t ListTableResponse::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->table_names.clear(); - uint32_t _size186; - ::apache::thrift::protocol::TType _etype189; - xfer += iprot->readListBegin(_etype189, _size186); - this->table_names.resize(_size186); - uint32_t _i190; - for (_i190 = 0; _i190 < _size186; ++_i190) + uint32_t _size188; + ::apache::thrift::protocol::TType _etype191; + xfer += iprot->readListBegin(_etype191, _size188); + this->table_names.resize(_size188); + uint32_t _i192; + for (_i192 = 0; _i192 < _size188; ++_i192) { - xfer += iprot->readString(this->table_names[_i190]); + xfer += iprot->readString(this->table_names[_i192]); } xfer += iprot->readListEnd(); } @@ -5032,10 +5124,10 @@ uint32_t ListTableResponse::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeFieldBegin("table_names", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->table_names.size())); - std::vector ::const_iterator _iter191; - for (_iter191 = this->table_names.begin(); _iter191 != this->table_names.end(); ++_iter191) + std::vector ::const_iterator _iter193; + for (_iter193 = this->table_names.begin(); _iter193 != this->table_names.end(); ++_iter193) { - xfer += oprot->writeString((*_iter191)); + xfer += oprot->writeString((*_iter193)); } xfer += oprot->writeListEnd(); } @@ -5054,17 +5146,17 @@ void swap(ListTableResponse &a, ListTableResponse &b) { swap(a.__isset, b.__isset); } -ListTableResponse::ListTableResponse(const ListTableResponse& other192) { - error_code = other192.error_code; - error_msg = other192.error_msg; - table_names = other192.table_names; - __isset = other192.__isset; +ListTableResponse::ListTableResponse(const ListTableResponse& other194) { + error_code = other194.error_code; + error_msg = other194.error_msg; + table_names = other194.table_names; + __isset = other194.__isset; } -ListTableResponse& ListTableResponse::operator=(const ListTableResponse& other193) { - error_code = other193.error_code; - error_msg = other193.error_msg; - table_names = other193.table_names; - __isset = other193.__isset; +ListTableResponse& ListTableResponse::operator=(const ListTableResponse& other195) { + error_code = other195.error_code; + error_msg = other195.error_msg; + table_names = other195.table_names; + __isset = other195.__isset; return *this; } void ListTableResponse::printTo(std::ostream& out) const { @@ -5186,17 +5278,17 @@ void swap(ListIndexRequest &a, ListIndexRequest &b) { swap(a.__isset, b.__isset); } -ListIndexRequest::ListIndexRequest(const ListIndexRequest& other194) { - db_name = other194.db_name; - table_name = other194.table_name; - session_id = other194.session_id; - __isset = other194.__isset; +ListIndexRequest::ListIndexRequest(const ListIndexRequest& other196) { + db_name = other196.db_name; + table_name = other196.table_name; + session_id = other196.session_id; + __isset = other196.__isset; } -ListIndexRequest& ListIndexRequest::operator=(const ListIndexRequest& other195) { - db_name = other195.db_name; - table_name = other195.table_name; - session_id = other195.session_id; - __isset = other195.__isset; +ListIndexRequest& ListIndexRequest::operator=(const ListIndexRequest& other197) { + db_name = other197.db_name; + table_name = other197.table_name; + session_id = other197.session_id; + __isset = other197.__isset; return *this; } void ListIndexRequest::printTo(std::ostream& out) const { @@ -5272,14 +5364,14 @@ uint32_t ListIndexResponse::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->index_names.clear(); - uint32_t _size196; - ::apache::thrift::protocol::TType _etype199; - xfer += iprot->readListBegin(_etype199, _size196); - this->index_names.resize(_size196); - uint32_t _i200; - for (_i200 = 0; _i200 < _size196; ++_i200) + uint32_t _size198; + ::apache::thrift::protocol::TType _etype201; + xfer += iprot->readListBegin(_etype201, _size198); + this->index_names.resize(_size198); + uint32_t _i202; + for (_i202 = 0; _i202 < _size198; ++_i202) { - xfer += iprot->readString(this->index_names[_i200]); + xfer += iprot->readString(this->index_names[_i202]); } xfer += iprot->readListEnd(); } @@ -5316,10 +5408,10 @@ uint32_t ListIndexResponse::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeFieldBegin("index_names", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->index_names.size())); - std::vector ::const_iterator _iter201; - for (_iter201 = this->index_names.begin(); _iter201 != this->index_names.end(); ++_iter201) + std::vector ::const_iterator _iter203; + for (_iter203 = this->index_names.begin(); _iter203 != this->index_names.end(); ++_iter203) { - xfer += oprot->writeString((*_iter201)); + xfer += oprot->writeString((*_iter203)); } xfer += oprot->writeListEnd(); } @@ -5338,17 +5430,17 @@ void swap(ListIndexResponse &a, ListIndexResponse &b) { swap(a.__isset, b.__isset); } -ListIndexResponse::ListIndexResponse(const ListIndexResponse& other202) { - error_code = other202.error_code; - error_msg = other202.error_msg; - index_names = other202.index_names; - __isset = other202.__isset; +ListIndexResponse::ListIndexResponse(const ListIndexResponse& other204) { + error_code = other204.error_code; + error_msg = other204.error_msg; + index_names = other204.index_names; + __isset = other204.__isset; } -ListIndexResponse& ListIndexResponse::operator=(const ListIndexResponse& other203) { - error_code = other203.error_code; - error_msg = other203.error_msg; - index_names = other203.index_names; - __isset = other203.__isset; +ListIndexResponse& ListIndexResponse::operator=(const ListIndexResponse& other205) { + error_code = other205.error_code; + error_msg = other205.error_msg; + index_names = other205.index_names; + __isset = other205.__isset; return *this; } void ListIndexResponse::printTo(std::ostream& out) const { @@ -5453,15 +5545,15 @@ void swap(ShowDatabaseRequest &a, ShowDatabaseRequest &b) { swap(a.__isset, b.__isset); } -ShowDatabaseRequest::ShowDatabaseRequest(const ShowDatabaseRequest& other204) { - db_name = other204.db_name; - session_id = other204.session_id; - __isset = other204.__isset; +ShowDatabaseRequest::ShowDatabaseRequest(const ShowDatabaseRequest& other206) { + db_name = other206.db_name; + session_id = other206.session_id; + __isset = other206.__isset; } -ShowDatabaseRequest& ShowDatabaseRequest::operator=(const ShowDatabaseRequest& other205) { - db_name = other205.db_name; - session_id = other205.session_id; - __isset = other205.__isset; +ShowDatabaseRequest& ShowDatabaseRequest::operator=(const ShowDatabaseRequest& other207) { + db_name = other207.db_name; + session_id = other207.session_id; + __isset = other207.__isset; return *this; } void ShowDatabaseRequest::printTo(std::ostream& out) const { @@ -5616,21 +5708,21 @@ void swap(ShowDatabaseResponse &a, ShowDatabaseResponse &b) { swap(a.__isset, b.__isset); } -ShowDatabaseResponse::ShowDatabaseResponse(const ShowDatabaseResponse& other206) { - error_code = other206.error_code; - error_msg = other206.error_msg; - database_name = other206.database_name; - store_dir = other206.store_dir; - table_count = other206.table_count; - __isset = other206.__isset; +ShowDatabaseResponse::ShowDatabaseResponse(const ShowDatabaseResponse& other208) { + error_code = other208.error_code; + error_msg = other208.error_msg; + database_name = other208.database_name; + store_dir = other208.store_dir; + table_count = other208.table_count; + __isset = other208.__isset; } -ShowDatabaseResponse& ShowDatabaseResponse::operator=(const ShowDatabaseResponse& other207) { - error_code = other207.error_code; - error_msg = other207.error_msg; - database_name = other207.database_name; - store_dir = other207.store_dir; - table_count = other207.table_count; - __isset = other207.__isset; +ShowDatabaseResponse& ShowDatabaseResponse::operator=(const ShowDatabaseResponse& other209) { + error_code = other209.error_code; + error_msg = other209.error_msg; + database_name = other209.database_name; + store_dir = other209.store_dir; + table_count = other209.table_count; + __isset = other209.__isset; return *this; } void ShowDatabaseResponse::printTo(std::ostream& out) const { @@ -5754,17 +5846,17 @@ void swap(ShowTableRequest &a, ShowTableRequest &b) { swap(a.__isset, b.__isset); } -ShowTableRequest::ShowTableRequest(const ShowTableRequest& other208) { - db_name = other208.db_name; - table_name = other208.table_name; - session_id = other208.session_id; - __isset = other208.__isset; +ShowTableRequest::ShowTableRequest(const ShowTableRequest& other210) { + db_name = other210.db_name; + table_name = other210.table_name; + session_id = other210.session_id; + __isset = other210.__isset; } -ShowTableRequest& ShowTableRequest::operator=(const ShowTableRequest& other209) { - db_name = other209.db_name; - table_name = other209.table_name; - session_id = other209.session_id; - __isset = other209.__isset; +ShowTableRequest& ShowTableRequest::operator=(const ShowTableRequest& other211) { + db_name = other211.db_name; + table_name = other211.table_name; + session_id = other211.session_id; + __isset = other211.__isset; return *this; } void ShowTableRequest::printTo(std::ostream& out) const { @@ -5971,27 +6063,27 @@ void swap(ShowTableResponse &a, ShowTableResponse &b) { swap(a.__isset, b.__isset); } -ShowTableResponse::ShowTableResponse(const ShowTableResponse& other210) { - error_code = other210.error_code; - error_msg = other210.error_msg; - database_name = other210.database_name; - table_name = other210.table_name; - store_dir = other210.store_dir; - column_count = other210.column_count; - segment_count = other210.segment_count; - row_count = other210.row_count; - __isset = other210.__isset; +ShowTableResponse::ShowTableResponse(const ShowTableResponse& other212) { + error_code = other212.error_code; + error_msg = other212.error_msg; + database_name = other212.database_name; + table_name = other212.table_name; + store_dir = other212.store_dir; + column_count = other212.column_count; + segment_count = other212.segment_count; + row_count = other212.row_count; + __isset = other212.__isset; } -ShowTableResponse& ShowTableResponse::operator=(const ShowTableResponse& other211) { - error_code = other211.error_code; - error_msg = other211.error_msg; - database_name = other211.database_name; - table_name = other211.table_name; - store_dir = other211.store_dir; - column_count = other211.column_count; - segment_count = other211.segment_count; - row_count = other211.row_count; - __isset = other211.__isset; +ShowTableResponse& ShowTableResponse::operator=(const ShowTableResponse& other213) { + error_code = other213.error_code; + error_msg = other213.error_msg; + database_name = other213.database_name; + table_name = other213.table_name; + store_dir = other213.store_dir; + column_count = other213.column_count; + segment_count = other213.segment_count; + row_count = other213.row_count; + __isset = other213.__isset; return *this; } void ShowTableResponse::printTo(std::ostream& out) const { @@ -6118,17 +6210,17 @@ void swap(ShowColumnsRequest &a, ShowColumnsRequest &b) { swap(a.__isset, b.__isset); } -ShowColumnsRequest::ShowColumnsRequest(const ShowColumnsRequest& other212) { - db_name = other212.db_name; - table_name = other212.table_name; - session_id = other212.session_id; - __isset = other212.__isset; +ShowColumnsRequest::ShowColumnsRequest(const ShowColumnsRequest& other214) { + db_name = other214.db_name; + table_name = other214.table_name; + session_id = other214.session_id; + __isset = other214.__isset; } -ShowColumnsRequest& ShowColumnsRequest::operator=(const ShowColumnsRequest& other213) { - db_name = other213.db_name; - table_name = other213.table_name; - session_id = other213.session_id; - __isset = other213.__isset; +ShowColumnsRequest& ShowColumnsRequest::operator=(const ShowColumnsRequest& other215) { + db_name = other215.db_name; + table_name = other215.table_name; + session_id = other215.session_id; + __isset = other215.__isset; return *this; } void ShowColumnsRequest::printTo(std::ostream& out) const { @@ -6250,17 +6342,17 @@ void swap(GetTableRequest &a, GetTableRequest &b) { swap(a.__isset, b.__isset); } -GetTableRequest::GetTableRequest(const GetTableRequest& other214) { - db_name = other214.db_name; - table_name = other214.table_name; - session_id = other214.session_id; - __isset = other214.__isset; +GetTableRequest::GetTableRequest(const GetTableRequest& other216) { + db_name = other216.db_name; + table_name = other216.table_name; + session_id = other216.session_id; + __isset = other216.__isset; } -GetTableRequest& GetTableRequest::operator=(const GetTableRequest& other215) { - db_name = other215.db_name; - table_name = other215.table_name; - session_id = other215.session_id; - __isset = other215.__isset; +GetTableRequest& GetTableRequest::operator=(const GetTableRequest& other217) { + db_name = other217.db_name; + table_name = other217.table_name; + session_id = other217.session_id; + __isset = other217.__isset; return *this; } void GetTableRequest::printTo(std::ostream& out) const { @@ -6326,9 +6418,9 @@ uint32_t IndexInfo::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast216; - xfer += iprot->readI32(ecast216); - this->index_type = static_cast(ecast216); + int32_t ecast218; + xfer += iprot->readI32(ecast218); + this->index_type = static_cast(ecast218); this->__isset.index_type = true; } else { xfer += iprot->skip(ftype); @@ -6338,14 +6430,14 @@ uint32_t IndexInfo::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->index_param_list.clear(); - uint32_t _size217; - ::apache::thrift::protocol::TType _etype220; - xfer += iprot->readListBegin(_etype220, _size217); - this->index_param_list.resize(_size217); - uint32_t _i221; - for (_i221 = 0; _i221 < _size217; ++_i221) + uint32_t _size219; + ::apache::thrift::protocol::TType _etype222; + xfer += iprot->readListBegin(_etype222, _size219); + this->index_param_list.resize(_size219); + uint32_t _i223; + for (_i223 = 0; _i223 < _size219; ++_i223) { - xfer += this->index_param_list[_i221].read(iprot); + xfer += this->index_param_list[_i223].read(iprot); } xfer += iprot->readListEnd(); } @@ -6382,10 +6474,10 @@ uint32_t IndexInfo::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldBegin("index_param_list", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->index_param_list.size())); - std::vector ::const_iterator _iter222; - for (_iter222 = this->index_param_list.begin(); _iter222 != this->index_param_list.end(); ++_iter222) + std::vector ::const_iterator _iter224; + for (_iter224 = this->index_param_list.begin(); _iter224 != this->index_param_list.end(); ++_iter224) { - xfer += (*_iter222).write(oprot); + xfer += (*_iter224).write(oprot); } xfer += oprot->writeListEnd(); } @@ -6404,17 +6496,17 @@ void swap(IndexInfo &a, IndexInfo &b) { swap(a.__isset, b.__isset); } -IndexInfo::IndexInfo(const IndexInfo& other223) { - column_name = other223.column_name; - index_type = other223.index_type; - index_param_list = other223.index_param_list; - __isset = other223.__isset; +IndexInfo::IndexInfo(const IndexInfo& other225) { + column_name = other225.column_name; + index_type = other225.index_type; + index_param_list = other225.index_param_list; + __isset = other225.__isset; } -IndexInfo& IndexInfo::operator=(const IndexInfo& other224) { - column_name = other224.column_name; - index_type = other224.index_type; - index_param_list = other224.index_param_list; - __isset = other224.__isset; +IndexInfo& IndexInfo::operator=(const IndexInfo& other226) { + column_name = other226.column_name; + index_type = other226.index_type; + index_param_list = other226.index_param_list; + __isset = other226.__isset; return *this; } void IndexInfo::printTo(std::ostream& out) const { @@ -6510,14 +6602,14 @@ uint32_t CreateIndexRequest::read(::apache::thrift::protocol::TProtocol* iprot) if (ftype == ::apache::thrift::protocol::T_LIST) { { this->index_info_list.clear(); - uint32_t _size225; - ::apache::thrift::protocol::TType _etype228; - xfer += iprot->readListBegin(_etype228, _size225); - this->index_info_list.resize(_size225); - uint32_t _i229; - for (_i229 = 0; _i229 < _size225; ++_i229) + uint32_t _size227; + ::apache::thrift::protocol::TType _etype230; + xfer += iprot->readListBegin(_etype230, _size227); + this->index_info_list.resize(_size227); + uint32_t _i231; + for (_i231 = 0; _i231 < _size227; ++_i231) { - xfer += this->index_info_list[_i229].read(iprot); + xfer += this->index_info_list[_i231].read(iprot); } xfer += iprot->readListEnd(); } @@ -6574,10 +6666,10 @@ uint32_t CreateIndexRequest::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeFieldBegin("index_info_list", ::apache::thrift::protocol::T_LIST, 5); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->index_info_list.size())); - std::vector ::const_iterator _iter230; - for (_iter230 = this->index_info_list.begin(); _iter230 != this->index_info_list.end(); ++_iter230) + std::vector ::const_iterator _iter232; + for (_iter232 = this->index_info_list.begin(); _iter232 != this->index_info_list.end(); ++_iter232) { - xfer += (*_iter230).write(oprot); + xfer += (*_iter232).write(oprot); } xfer += oprot->writeListEnd(); } @@ -6607,23 +6699,23 @@ void swap(CreateIndexRequest &a, CreateIndexRequest &b) { swap(a.__isset, b.__isset); } -CreateIndexRequest::CreateIndexRequest(const CreateIndexRequest& other231) { - db_name = other231.db_name; - table_name = other231.table_name; - index_name = other231.index_name; - index_info_list = other231.index_info_list; - session_id = other231.session_id; - create_option = other231.create_option; - __isset = other231.__isset; -} -CreateIndexRequest& CreateIndexRequest::operator=(const CreateIndexRequest& other232) { - db_name = other232.db_name; - table_name = other232.table_name; - index_name = other232.index_name; - index_info_list = other232.index_info_list; - session_id = other232.session_id; - create_option = other232.create_option; - __isset = other232.__isset; +CreateIndexRequest::CreateIndexRequest(const CreateIndexRequest& other233) { + db_name = other233.db_name; + table_name = other233.table_name; + index_name = other233.index_name; + index_info_list = other233.index_info_list; + session_id = other233.session_id; + create_option = other233.create_option; + __isset = other233.__isset; +} +CreateIndexRequest& CreateIndexRequest::operator=(const CreateIndexRequest& other234) { + db_name = other234.db_name; + table_name = other234.table_name; + index_name = other234.index_name; + index_info_list = other234.index_info_list; + session_id = other234.session_id; + create_option = other234.create_option; + __isset = other234.__isset; return *this; } void CreateIndexRequest::printTo(std::ostream& out) const { @@ -6782,21 +6874,21 @@ void swap(DropIndexRequest &a, DropIndexRequest &b) { swap(a.__isset, b.__isset); } -DropIndexRequest::DropIndexRequest(const DropIndexRequest& other233) { - db_name = other233.db_name; - table_name = other233.table_name; - index_name = other233.index_name; - session_id = other233.session_id; - drop_option = other233.drop_option; - __isset = other233.__isset; +DropIndexRequest::DropIndexRequest(const DropIndexRequest& other235) { + db_name = other235.db_name; + table_name = other235.table_name; + index_name = other235.index_name; + session_id = other235.session_id; + drop_option = other235.drop_option; + __isset = other235.__isset; } -DropIndexRequest& DropIndexRequest::operator=(const DropIndexRequest& other234) { - db_name = other234.db_name; - table_name = other234.table_name; - index_name = other234.index_name; - session_id = other234.session_id; - drop_option = other234.drop_option; - __isset = other234.__isset; +DropIndexRequest& DropIndexRequest::operator=(const DropIndexRequest& other236) { + db_name = other236.db_name; + table_name = other236.table_name; + index_name = other236.index_name; + session_id = other236.session_id; + drop_option = other236.drop_option; + __isset = other236.__isset; return *this; } void DropIndexRequest::printTo(std::ostream& out) const { @@ -6937,19 +7029,19 @@ void swap(ShowIndexRequest &a, ShowIndexRequest &b) { swap(a.__isset, b.__isset); } -ShowIndexRequest::ShowIndexRequest(const ShowIndexRequest& other235) { - db_name = other235.db_name; - table_name = other235.table_name; - index_name = other235.index_name; - session_id = other235.session_id; - __isset = other235.__isset; +ShowIndexRequest::ShowIndexRequest(const ShowIndexRequest& other237) { + db_name = other237.db_name; + table_name = other237.table_name; + index_name = other237.index_name; + session_id = other237.session_id; + __isset = other237.__isset; } -ShowIndexRequest& ShowIndexRequest::operator=(const ShowIndexRequest& other236) { - db_name = other236.db_name; - table_name = other236.table_name; - index_name = other236.index_name; - session_id = other236.session_id; - __isset = other236.__isset; +ShowIndexRequest& ShowIndexRequest::operator=(const ShowIndexRequest& other238) { + db_name = other238.db_name; + table_name = other238.table_name; + index_name = other238.index_name; + session_id = other238.session_id; + __isset = other238.__isset; return *this; } void ShowIndexRequest::printTo(std::ostream& out) const { @@ -7225,35 +7317,35 @@ void swap(ShowIndexResponse &a, ShowIndexResponse &b) { swap(a.__isset, b.__isset); } -ShowIndexResponse::ShowIndexResponse(const ShowIndexResponse& other237) { - error_code = other237.error_code; - error_msg = other237.error_msg; - db_name = other237.db_name; - table_name = other237.table_name; - index_name = other237.index_name; - index_type = other237.index_type; - index_column_names = other237.index_column_names; - index_column_ids = other237.index_column_ids; - other_parameters = other237.other_parameters; - store_dir = other237.store_dir; - store_size = other237.store_size; - segment_index_count = other237.segment_index_count; - __isset = other237.__isset; +ShowIndexResponse::ShowIndexResponse(const ShowIndexResponse& other239) { + error_code = other239.error_code; + error_msg = other239.error_msg; + db_name = other239.db_name; + table_name = other239.table_name; + index_name = other239.index_name; + index_type = other239.index_type; + index_column_names = other239.index_column_names; + index_column_ids = other239.index_column_ids; + other_parameters = other239.other_parameters; + store_dir = other239.store_dir; + store_size = other239.store_size; + segment_index_count = other239.segment_index_count; + __isset = other239.__isset; } -ShowIndexResponse& ShowIndexResponse::operator=(const ShowIndexResponse& other238) { - error_code = other238.error_code; - error_msg = other238.error_msg; - db_name = other238.db_name; - table_name = other238.table_name; - index_name = other238.index_name; - index_type = other238.index_type; - index_column_names = other238.index_column_names; - index_column_ids = other238.index_column_ids; - other_parameters = other238.other_parameters; - store_dir = other238.store_dir; - store_size = other238.store_size; - segment_index_count = other238.segment_index_count; - __isset = other238.__isset; +ShowIndexResponse& ShowIndexResponse::operator=(const ShowIndexResponse& other240) { + error_code = other240.error_code; + error_msg = other240.error_msg; + db_name = other240.db_name; + table_name = other240.table_name; + index_name = other240.index_name; + index_type = other240.index_type; + index_column_names = other240.index_column_names; + index_column_ids = other240.index_column_ids; + other_parameters = other240.other_parameters; + store_dir = other240.store_dir; + store_size = other240.store_size; + segment_index_count = other240.segment_index_count; + __isset = other240.__isset; return *this; } void ShowIndexResponse::printTo(std::ostream& out) const { @@ -7367,15 +7459,15 @@ void swap(GetDatabaseRequest &a, GetDatabaseRequest &b) { swap(a.__isset, b.__isset); } -GetDatabaseRequest::GetDatabaseRequest(const GetDatabaseRequest& other239) { - db_name = other239.db_name; - session_id = other239.session_id; - __isset = other239.__isset; +GetDatabaseRequest::GetDatabaseRequest(const GetDatabaseRequest& other241) { + db_name = other241.db_name; + session_id = other241.session_id; + __isset = other241.__isset; } -GetDatabaseRequest& GetDatabaseRequest::operator=(const GetDatabaseRequest& other240) { - db_name = other240.db_name; - session_id = other240.session_id; - __isset = other240.__isset; +GetDatabaseRequest& GetDatabaseRequest::operator=(const GetDatabaseRequest& other242) { + db_name = other242.db_name; + session_id = other242.session_id; + __isset = other242.__isset; return *this; } void GetDatabaseRequest::printTo(std::ostream& out) const { @@ -7496,17 +7588,17 @@ void swap(CreateDatabaseRequest &a, CreateDatabaseRequest &b) { swap(a.__isset, b.__isset); } -CreateDatabaseRequest::CreateDatabaseRequest(const CreateDatabaseRequest& other241) { - db_name = other241.db_name; - session_id = other241.session_id; - create_option = other241.create_option; - __isset = other241.__isset; +CreateDatabaseRequest::CreateDatabaseRequest(const CreateDatabaseRequest& other243) { + db_name = other243.db_name; + session_id = other243.session_id; + create_option = other243.create_option; + __isset = other243.__isset; } -CreateDatabaseRequest& CreateDatabaseRequest::operator=(const CreateDatabaseRequest& other242) { - db_name = other242.db_name; - session_id = other242.session_id; - create_option = other242.create_option; - __isset = other242.__isset; +CreateDatabaseRequest& CreateDatabaseRequest::operator=(const CreateDatabaseRequest& other244) { + db_name = other244.db_name; + session_id = other244.session_id; + create_option = other244.create_option; + __isset = other244.__isset; return *this; } void CreateDatabaseRequest::printTo(std::ostream& out) const { @@ -7628,17 +7720,17 @@ void swap(DropDatabaseRequest &a, DropDatabaseRequest &b) { swap(a.__isset, b.__isset); } -DropDatabaseRequest::DropDatabaseRequest(const DropDatabaseRequest& other243) { - db_name = other243.db_name; - session_id = other243.session_id; - drop_option = other243.drop_option; - __isset = other243.__isset; +DropDatabaseRequest::DropDatabaseRequest(const DropDatabaseRequest& other245) { + db_name = other245.db_name; + session_id = other245.session_id; + drop_option = other245.drop_option; + __isset = other245.__isset; } -DropDatabaseRequest& DropDatabaseRequest::operator=(const DropDatabaseRequest& other244) { - db_name = other244.db_name; - session_id = other244.session_id; - drop_option = other244.drop_option; - __isset = other244.__isset; +DropDatabaseRequest& DropDatabaseRequest::operator=(const DropDatabaseRequest& other246) { + db_name = other246.db_name; + session_id = other246.session_id; + drop_option = other246.drop_option; + __isset = other246.__isset; return *this; } void DropDatabaseRequest::printTo(std::ostream& out) const { @@ -7722,14 +7814,14 @@ uint32_t CreateTableRequest::read(::apache::thrift::protocol::TProtocol* iprot) if (ftype == ::apache::thrift::protocol::T_LIST) { { this->column_defs.clear(); - uint32_t _size245; - ::apache::thrift::protocol::TType _etype248; - xfer += iprot->readListBegin(_etype248, _size245); - this->column_defs.resize(_size245); - uint32_t _i249; - for (_i249 = 0; _i249 < _size245; ++_i249) + uint32_t _size247; + ::apache::thrift::protocol::TType _etype250; + xfer += iprot->readListBegin(_etype250, _size247); + this->column_defs.resize(_size247); + uint32_t _i251; + for (_i251 = 0; _i251 < _size247; ++_i251) { - xfer += this->column_defs[_i249].read(iprot); + xfer += this->column_defs[_i251].read(iprot); } xfer += iprot->readListEnd(); } @@ -7782,10 +7874,10 @@ uint32_t CreateTableRequest::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeFieldBegin("column_defs", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->column_defs.size())); - std::vector ::const_iterator _iter250; - for (_iter250 = this->column_defs.begin(); _iter250 != this->column_defs.end(); ++_iter250) + std::vector ::const_iterator _iter252; + for (_iter252 = this->column_defs.begin(); _iter252 != this->column_defs.end(); ++_iter252) { - xfer += (*_iter250).write(oprot); + xfer += (*_iter252).write(oprot); } xfer += oprot->writeListEnd(); } @@ -7814,21 +7906,21 @@ void swap(CreateTableRequest &a, CreateTableRequest &b) { swap(a.__isset, b.__isset); } -CreateTableRequest::CreateTableRequest(const CreateTableRequest& other251) { - db_name = other251.db_name; - table_name = other251.table_name; - column_defs = other251.column_defs; - session_id = other251.session_id; - create_option = other251.create_option; - __isset = other251.__isset; -} -CreateTableRequest& CreateTableRequest::operator=(const CreateTableRequest& other252) { - db_name = other252.db_name; - table_name = other252.table_name; - column_defs = other252.column_defs; - session_id = other252.session_id; - create_option = other252.create_option; - __isset = other252.__isset; +CreateTableRequest::CreateTableRequest(const CreateTableRequest& other253) { + db_name = other253.db_name; + table_name = other253.table_name; + column_defs = other253.column_defs; + session_id = other253.session_id; + create_option = other253.create_option; + __isset = other253.__isset; +} +CreateTableRequest& CreateTableRequest::operator=(const CreateTableRequest& other254) { + db_name = other254.db_name; + table_name = other254.table_name; + column_defs = other254.column_defs; + session_id = other254.session_id; + create_option = other254.create_option; + __isset = other254.__isset; return *this; } void CreateTableRequest::printTo(std::ostream& out) const { @@ -7969,19 +8061,19 @@ void swap(DropTableRequest &a, DropTableRequest &b) { swap(a.__isset, b.__isset); } -DropTableRequest::DropTableRequest(const DropTableRequest& other253) { - db_name = other253.db_name; - table_name = other253.table_name; - session_id = other253.session_id; - drop_option = other253.drop_option; - __isset = other253.__isset; +DropTableRequest::DropTableRequest(const DropTableRequest& other255) { + db_name = other255.db_name; + table_name = other255.table_name; + session_id = other255.session_id; + drop_option = other255.drop_option; + __isset = other255.__isset; } -DropTableRequest& DropTableRequest::operator=(const DropTableRequest& other254) { - db_name = other254.db_name; - table_name = other254.table_name; - session_id = other254.session_id; - drop_option = other254.drop_option; - __isset = other254.__isset; +DropTableRequest& DropTableRequest::operator=(const DropTableRequest& other256) { + db_name = other256.db_name; + table_name = other256.table_name; + session_id = other256.session_id; + drop_option = other256.drop_option; + __isset = other256.__isset; return *this; } void DropTableRequest::printTo(std::ostream& out) const { @@ -8066,14 +8158,14 @@ uint32_t InsertRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->column_names.clear(); - uint32_t _size255; - ::apache::thrift::protocol::TType _etype258; - xfer += iprot->readListBegin(_etype258, _size255); - this->column_names.resize(_size255); - uint32_t _i259; - for (_i259 = 0; _i259 < _size255; ++_i259) + uint32_t _size257; + ::apache::thrift::protocol::TType _etype260; + xfer += iprot->readListBegin(_etype260, _size257); + this->column_names.resize(_size257); + uint32_t _i261; + for (_i261 = 0; _i261 < _size257; ++_i261) { - xfer += iprot->readString(this->column_names[_i259]); + xfer += iprot->readString(this->column_names[_i261]); } xfer += iprot->readListEnd(); } @@ -8086,14 +8178,14 @@ uint32_t InsertRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->fields.clear(); - uint32_t _size260; - ::apache::thrift::protocol::TType _etype263; - xfer += iprot->readListBegin(_etype263, _size260); - this->fields.resize(_size260); - uint32_t _i264; - for (_i264 = 0; _i264 < _size260; ++_i264) + uint32_t _size262; + ::apache::thrift::protocol::TType _etype265; + xfer += iprot->readListBegin(_etype265, _size262); + this->fields.resize(_size262); + uint32_t _i266; + for (_i266 = 0; _i266 < _size262; ++_i266) { - xfer += this->fields[_i264].read(iprot); + xfer += this->fields[_i266].read(iprot); } xfer += iprot->readListEnd(); } @@ -8138,10 +8230,10 @@ uint32_t InsertRequest::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("column_names", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->column_names.size())); - std::vector ::const_iterator _iter265; - for (_iter265 = this->column_names.begin(); _iter265 != this->column_names.end(); ++_iter265) + std::vector ::const_iterator _iter267; + for (_iter267 = this->column_names.begin(); _iter267 != this->column_names.end(); ++_iter267) { - xfer += oprot->writeString((*_iter265)); + xfer += oprot->writeString((*_iter267)); } xfer += oprot->writeListEnd(); } @@ -8150,10 +8242,10 @@ uint32_t InsertRequest::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("fields", ::apache::thrift::protocol::T_LIST, 4); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->fields.size())); - std::vector ::const_iterator _iter266; - for (_iter266 = this->fields.begin(); _iter266 != this->fields.end(); ++_iter266) + std::vector ::const_iterator _iter268; + for (_iter268 = this->fields.begin(); _iter268 != this->fields.end(); ++_iter268) { - xfer += (*_iter266).write(oprot); + xfer += (*_iter268).write(oprot); } xfer += oprot->writeListEnd(); } @@ -8178,21 +8270,21 @@ void swap(InsertRequest &a, InsertRequest &b) { swap(a.__isset, b.__isset); } -InsertRequest::InsertRequest(const InsertRequest& other267) { - db_name = other267.db_name; - table_name = other267.table_name; - column_names = other267.column_names; - fields = other267.fields; - session_id = other267.session_id; - __isset = other267.__isset; -} -InsertRequest& InsertRequest::operator=(const InsertRequest& other268) { - db_name = other268.db_name; - table_name = other268.table_name; - column_names = other268.column_names; - fields = other268.fields; - session_id = other268.session_id; - __isset = other268.__isset; +InsertRequest::InsertRequest(const InsertRequest& other269) { + db_name = other269.db_name; + table_name = other269.table_name; + column_names = other269.column_names; + fields = other269.fields; + session_id = other269.session_id; + __isset = other269.__isset; +} +InsertRequest& InsertRequest::operator=(const InsertRequest& other270) { + db_name = other270.db_name; + table_name = other270.table_name; + column_names = other270.column_names; + fields = other270.fields; + session_id = other270.session_id; + __isset = other270.__isset; return *this; } void InsertRequest::printTo(std::ostream& out) const { @@ -8367,23 +8459,23 @@ void swap(ImportRequest &a, ImportRequest &b) { swap(a.__isset, b.__isset); } -ImportRequest::ImportRequest(const ImportRequest& other269) { - db_name = other269.db_name; - table_name = other269.table_name; - file_name = other269.file_name; - file_content = other269.file_content; - import_option = other269.import_option; - session_id = other269.session_id; - __isset = other269.__isset; -} -ImportRequest& ImportRequest::operator=(const ImportRequest& other270) { - db_name = other270.db_name; - table_name = other270.table_name; - file_name = other270.file_name; - file_content = other270.file_content; - import_option = other270.import_option; - session_id = other270.session_id; - __isset = other270.__isset; +ImportRequest::ImportRequest(const ImportRequest& other271) { + db_name = other271.db_name; + table_name = other271.table_name; + file_name = other271.file_name; + file_content = other271.file_content; + import_option = other271.import_option; + session_id = other271.session_id; + __isset = other271.__isset; +} +ImportRequest& ImportRequest::operator=(const ImportRequest& other272) { + db_name = other272.db_name; + table_name = other272.table_name; + file_name = other272.file_name; + file_content = other272.file_content; + import_option = other272.import_option; + session_id = other272.session_id; + __isset = other272.__isset; return *this; } void ImportRequest::printTo(std::ostream& out) const { @@ -8513,14 +8605,14 @@ uint32_t ExplainRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->select_list.clear(); - uint32_t _size271; - ::apache::thrift::protocol::TType _etype274; - xfer += iprot->readListBegin(_etype274, _size271); - this->select_list.resize(_size271); - uint32_t _i275; - for (_i275 = 0; _i275 < _size271; ++_i275) + uint32_t _size273; + ::apache::thrift::protocol::TType _etype276; + xfer += iprot->readListBegin(_etype276, _size273); + this->select_list.resize(_size273); + uint32_t _i277; + for (_i277 = 0; _i277 < _size273; ++_i277) { - xfer += this->select_list[_i275].read(iprot); + xfer += this->select_list[_i277].read(iprot); } xfer += iprot->readListEnd(); } @@ -8549,14 +8641,14 @@ uint32_t ExplainRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->group_by_list.clear(); - uint32_t _size276; - ::apache::thrift::protocol::TType _etype279; - xfer += iprot->readListBegin(_etype279, _size276); - this->group_by_list.resize(_size276); - uint32_t _i280; - for (_i280 = 0; _i280 < _size276; ++_i280) + uint32_t _size278; + ::apache::thrift::protocol::TType _etype281; + xfer += iprot->readListBegin(_etype281, _size278); + this->group_by_list.resize(_size278); + uint32_t _i282; + for (_i282 = 0; _i282 < _size278; ++_i282) { - xfer += this->group_by_list[_i280].read(iprot); + xfer += this->group_by_list[_i282].read(iprot); } xfer += iprot->readListEnd(); } @@ -8593,14 +8685,14 @@ uint32_t ExplainRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->order_by_list.clear(); - uint32_t _size281; - ::apache::thrift::protocol::TType _etype284; - xfer += iprot->readListBegin(_etype284, _size281); - this->order_by_list.resize(_size281); - uint32_t _i285; - for (_i285 = 0; _i285 < _size281; ++_i285) + uint32_t _size283; + ::apache::thrift::protocol::TType _etype286; + xfer += iprot->readListBegin(_etype286, _size283); + this->order_by_list.resize(_size283); + uint32_t _i287; + for (_i287 = 0; _i287 < _size283; ++_i287) { - xfer += this->order_by_list[_i285].read(iprot); + xfer += this->order_by_list[_i287].read(iprot); } xfer += iprot->readListEnd(); } @@ -8611,9 +8703,9 @@ uint32_t ExplainRequest::read(::apache::thrift::protocol::TProtocol* iprot) { break; case 12: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast286; - xfer += iprot->readI32(ecast286); - this->explain_type = static_cast(ecast286); + int32_t ecast288; + xfer += iprot->readI32(ecast288); + this->explain_type = static_cast(ecast288); this->__isset.explain_type = true; } else { xfer += iprot->skip(ftype); @@ -8651,10 +8743,10 @@ uint32_t ExplainRequest::write(::apache::thrift::protocol::TProtocol* oprot) con xfer += oprot->writeFieldBegin("select_list", ::apache::thrift::protocol::T_LIST, 4); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->select_list.size())); - std::vector ::const_iterator _iter287; - for (_iter287 = this->select_list.begin(); _iter287 != this->select_list.end(); ++_iter287) + std::vector ::const_iterator _iter289; + for (_iter289 = this->select_list.begin(); _iter289 != this->select_list.end(); ++_iter289) { - xfer += (*_iter287).write(oprot); + xfer += (*_iter289).write(oprot); } xfer += oprot->writeListEnd(); } @@ -8674,10 +8766,10 @@ uint32_t ExplainRequest::write(::apache::thrift::protocol::TProtocol* oprot) con xfer += oprot->writeFieldBegin("group_by_list", ::apache::thrift::protocol::T_LIST, 7); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->group_by_list.size())); - std::vector ::const_iterator _iter288; - for (_iter288 = this->group_by_list.begin(); _iter288 != this->group_by_list.end(); ++_iter288) + std::vector ::const_iterator _iter290; + for (_iter290 = this->group_by_list.begin(); _iter290 != this->group_by_list.end(); ++_iter290) { - xfer += (*_iter288).write(oprot); + xfer += (*_iter290).write(oprot); } xfer += oprot->writeListEnd(); } @@ -8702,10 +8794,10 @@ uint32_t ExplainRequest::write(::apache::thrift::protocol::TProtocol* oprot) con xfer += oprot->writeFieldBegin("order_by_list", ::apache::thrift::protocol::T_LIST, 11); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->order_by_list.size())); - std::vector ::const_iterator _iter289; - for (_iter289 = this->order_by_list.begin(); _iter289 != this->order_by_list.end(); ++_iter289) + std::vector ::const_iterator _iter291; + for (_iter291 = this->order_by_list.begin(); _iter291 != this->order_by_list.end(); ++_iter291) { - xfer += (*_iter289).write(oprot); + xfer += (*_iter291).write(oprot); } xfer += oprot->writeListEnd(); } @@ -8737,35 +8829,35 @@ void swap(ExplainRequest &a, ExplainRequest &b) { swap(a.__isset, b.__isset); } -ExplainRequest::ExplainRequest(const ExplainRequest& other290) { - session_id = other290.session_id; - db_name = other290.db_name; - table_name = other290.table_name; - select_list = other290.select_list; - search_expr = other290.search_expr; - where_expr = other290.where_expr; - group_by_list = other290.group_by_list; - having_expr = other290.having_expr; - limit_expr = other290.limit_expr; - offset_expr = other290.offset_expr; - order_by_list = other290.order_by_list; - explain_type = other290.explain_type; - __isset = other290.__isset; -} -ExplainRequest& ExplainRequest::operator=(const ExplainRequest& other291) { - session_id = other291.session_id; - db_name = other291.db_name; - table_name = other291.table_name; - select_list = other291.select_list; - search_expr = other291.search_expr; - where_expr = other291.where_expr; - group_by_list = other291.group_by_list; - having_expr = other291.having_expr; - limit_expr = other291.limit_expr; - offset_expr = other291.offset_expr; - order_by_list = other291.order_by_list; - explain_type = other291.explain_type; - __isset = other291.__isset; +ExplainRequest::ExplainRequest(const ExplainRequest& other292) { + session_id = other292.session_id; + db_name = other292.db_name; + table_name = other292.table_name; + select_list = other292.select_list; + search_expr = other292.search_expr; + where_expr = other292.where_expr; + group_by_list = other292.group_by_list; + having_expr = other292.having_expr; + limit_expr = other292.limit_expr; + offset_expr = other292.offset_expr; + order_by_list = other292.order_by_list; + explain_type = other292.explain_type; + __isset = other292.__isset; +} +ExplainRequest& ExplainRequest::operator=(const ExplainRequest& other293) { + session_id = other293.session_id; + db_name = other293.db_name; + table_name = other293.table_name; + select_list = other293.select_list; + search_expr = other293.search_expr; + where_expr = other293.where_expr; + group_by_list = other293.group_by_list; + having_expr = other293.having_expr; + limit_expr = other293.limit_expr; + offset_expr = other293.offset_expr; + order_by_list = other293.order_by_list; + explain_type = other293.explain_type; + __isset = other293.__isset; return *this; } void ExplainRequest::printTo(std::ostream& out) const { @@ -8854,14 +8946,14 @@ uint32_t ExplainResponse::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->column_defs.clear(); - uint32_t _size292; - ::apache::thrift::protocol::TType _etype295; - xfer += iprot->readListBegin(_etype295, _size292); - this->column_defs.resize(_size292); - uint32_t _i296; - for (_i296 = 0; _i296 < _size292; ++_i296) + uint32_t _size294; + ::apache::thrift::protocol::TType _etype297; + xfer += iprot->readListBegin(_etype297, _size294); + this->column_defs.resize(_size294); + uint32_t _i298; + for (_i298 = 0; _i298 < _size294; ++_i298) { - xfer += this->column_defs[_i296].read(iprot); + xfer += this->column_defs[_i298].read(iprot); } xfer += iprot->readListEnd(); } @@ -8874,14 +8966,14 @@ uint32_t ExplainResponse::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->column_fields.clear(); - uint32_t _size297; - ::apache::thrift::protocol::TType _etype300; - xfer += iprot->readListBegin(_etype300, _size297); - this->column_fields.resize(_size297); - uint32_t _i301; - for (_i301 = 0; _i301 < _size297; ++_i301) + uint32_t _size299; + ::apache::thrift::protocol::TType _etype302; + xfer += iprot->readListBegin(_etype302, _size299); + this->column_fields.resize(_size299); + uint32_t _i303; + for (_i303 = 0; _i303 < _size299; ++_i303) { - xfer += this->column_fields[_i301].read(iprot); + xfer += this->column_fields[_i303].read(iprot); } xfer += iprot->readListEnd(); } @@ -8918,10 +9010,10 @@ uint32_t ExplainResponse::write(::apache::thrift::protocol::TProtocol* oprot) co xfer += oprot->writeFieldBegin("column_defs", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->column_defs.size())); - std::vector ::const_iterator _iter302; - for (_iter302 = this->column_defs.begin(); _iter302 != this->column_defs.end(); ++_iter302) + std::vector ::const_iterator _iter304; + for (_iter304 = this->column_defs.begin(); _iter304 != this->column_defs.end(); ++_iter304) { - xfer += (*_iter302).write(oprot); + xfer += (*_iter304).write(oprot); } xfer += oprot->writeListEnd(); } @@ -8930,10 +9022,10 @@ uint32_t ExplainResponse::write(::apache::thrift::protocol::TProtocol* oprot) co xfer += oprot->writeFieldBegin("column_fields", ::apache::thrift::protocol::T_LIST, 4); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->column_fields.size())); - std::vector ::const_iterator _iter303; - for (_iter303 = this->column_fields.begin(); _iter303 != this->column_fields.end(); ++_iter303) + std::vector ::const_iterator _iter305; + for (_iter305 = this->column_fields.begin(); _iter305 != this->column_fields.end(); ++_iter305) { - xfer += (*_iter303).write(oprot); + xfer += (*_iter305).write(oprot); } xfer += oprot->writeListEnd(); } @@ -8953,19 +9045,19 @@ void swap(ExplainResponse &a, ExplainResponse &b) { swap(a.__isset, b.__isset); } -ExplainResponse::ExplainResponse(const ExplainResponse& other304) { - error_code = other304.error_code; - error_msg = other304.error_msg; - column_defs = other304.column_defs; - column_fields = other304.column_fields; - __isset = other304.__isset; +ExplainResponse::ExplainResponse(const ExplainResponse& other306) { + error_code = other306.error_code; + error_msg = other306.error_msg; + column_defs = other306.column_defs; + column_fields = other306.column_fields; + __isset = other306.__isset; } -ExplainResponse& ExplainResponse::operator=(const ExplainResponse& other305) { - error_code = other305.error_code; - error_msg = other305.error_msg; - column_defs = other305.column_defs; - column_fields = other305.column_fields; - __isset = other305.__isset; +ExplainResponse& ExplainResponse::operator=(const ExplainResponse& other307) { + error_code = other307.error_code; + error_msg = other307.error_msg; + column_defs = other307.column_defs; + column_fields = other307.column_fields; + __isset = other307.__isset; return *this; } void ExplainResponse::printTo(std::ostream& out) const { @@ -9089,14 +9181,14 @@ uint32_t SelectRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->select_list.clear(); - uint32_t _size306; - ::apache::thrift::protocol::TType _etype309; - xfer += iprot->readListBegin(_etype309, _size306); - this->select_list.resize(_size306); - uint32_t _i310; - for (_i310 = 0; _i310 < _size306; ++_i310) + uint32_t _size308; + ::apache::thrift::protocol::TType _etype311; + xfer += iprot->readListBegin(_etype311, _size308); + this->select_list.resize(_size308); + uint32_t _i312; + for (_i312 = 0; _i312 < _size308; ++_i312) { - xfer += this->select_list[_i310].read(iprot); + xfer += this->select_list[_i312].read(iprot); } xfer += iprot->readListEnd(); } @@ -9125,14 +9217,14 @@ uint32_t SelectRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->group_by_list.clear(); - uint32_t _size311; - ::apache::thrift::protocol::TType _etype314; - xfer += iprot->readListBegin(_etype314, _size311); - this->group_by_list.resize(_size311); - uint32_t _i315; - for (_i315 = 0; _i315 < _size311; ++_i315) + uint32_t _size313; + ::apache::thrift::protocol::TType _etype316; + xfer += iprot->readListBegin(_etype316, _size313); + this->group_by_list.resize(_size313); + uint32_t _i317; + for (_i317 = 0; _i317 < _size313; ++_i317) { - xfer += this->group_by_list[_i315].read(iprot); + xfer += this->group_by_list[_i317].read(iprot); } xfer += iprot->readListEnd(); } @@ -9169,14 +9261,14 @@ uint32_t SelectRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->order_by_list.clear(); - uint32_t _size316; - ::apache::thrift::protocol::TType _etype319; - xfer += iprot->readListBegin(_etype319, _size316); - this->order_by_list.resize(_size316); - uint32_t _i320; - for (_i320 = 0; _i320 < _size316; ++_i320) + uint32_t _size318; + ::apache::thrift::protocol::TType _etype321; + xfer += iprot->readListBegin(_etype321, _size318); + this->order_by_list.resize(_size318); + uint32_t _i322; + for (_i322 = 0; _i322 < _size318; ++_i322) { - xfer += this->order_by_list[_i320].read(iprot); + xfer += this->order_by_list[_i322].read(iprot); } xfer += iprot->readListEnd(); } @@ -9217,10 +9309,10 @@ uint32_t SelectRequest::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("select_list", ::apache::thrift::protocol::T_LIST, 4); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->select_list.size())); - std::vector ::const_iterator _iter321; - for (_iter321 = this->select_list.begin(); _iter321 != this->select_list.end(); ++_iter321) + std::vector ::const_iterator _iter323; + for (_iter323 = this->select_list.begin(); _iter323 != this->select_list.end(); ++_iter323) { - xfer += (*_iter321).write(oprot); + xfer += (*_iter323).write(oprot); } xfer += oprot->writeListEnd(); } @@ -9240,10 +9332,10 @@ uint32_t SelectRequest::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("group_by_list", ::apache::thrift::protocol::T_LIST, 7); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->group_by_list.size())); - std::vector ::const_iterator _iter322; - for (_iter322 = this->group_by_list.begin(); _iter322 != this->group_by_list.end(); ++_iter322) + std::vector ::const_iterator _iter324; + for (_iter324 = this->group_by_list.begin(); _iter324 != this->group_by_list.end(); ++_iter324) { - xfer += (*_iter322).write(oprot); + xfer += (*_iter324).write(oprot); } xfer += oprot->writeListEnd(); } @@ -9268,10 +9360,10 @@ uint32_t SelectRequest::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("order_by_list", ::apache::thrift::protocol::T_LIST, 11); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->order_by_list.size())); - std::vector ::const_iterator _iter323; - for (_iter323 = this->order_by_list.begin(); _iter323 != this->order_by_list.end(); ++_iter323) + std::vector ::const_iterator _iter325; + for (_iter325 = this->order_by_list.begin(); _iter325 != this->order_by_list.end(); ++_iter325) { - xfer += (*_iter323).write(oprot); + xfer += (*_iter325).write(oprot); } xfer += oprot->writeListEnd(); } @@ -9298,33 +9390,33 @@ void swap(SelectRequest &a, SelectRequest &b) { swap(a.__isset, b.__isset); } -SelectRequest::SelectRequest(const SelectRequest& other324) { - session_id = other324.session_id; - db_name = other324.db_name; - table_name = other324.table_name; - select_list = other324.select_list; - search_expr = other324.search_expr; - where_expr = other324.where_expr; - group_by_list = other324.group_by_list; - having_expr = other324.having_expr; - limit_expr = other324.limit_expr; - offset_expr = other324.offset_expr; - order_by_list = other324.order_by_list; - __isset = other324.__isset; -} -SelectRequest& SelectRequest::operator=(const SelectRequest& other325) { - session_id = other325.session_id; - db_name = other325.db_name; - table_name = other325.table_name; - select_list = other325.select_list; - search_expr = other325.search_expr; - where_expr = other325.where_expr; - group_by_list = other325.group_by_list; - having_expr = other325.having_expr; - limit_expr = other325.limit_expr; - offset_expr = other325.offset_expr; - order_by_list = other325.order_by_list; - __isset = other325.__isset; +SelectRequest::SelectRequest(const SelectRequest& other326) { + session_id = other326.session_id; + db_name = other326.db_name; + table_name = other326.table_name; + select_list = other326.select_list; + search_expr = other326.search_expr; + where_expr = other326.where_expr; + group_by_list = other326.group_by_list; + having_expr = other326.having_expr; + limit_expr = other326.limit_expr; + offset_expr = other326.offset_expr; + order_by_list = other326.order_by_list; + __isset = other326.__isset; +} +SelectRequest& SelectRequest::operator=(const SelectRequest& other327) { + session_id = other327.session_id; + db_name = other327.db_name; + table_name = other327.table_name; + select_list = other327.select_list; + search_expr = other327.search_expr; + where_expr = other327.where_expr; + group_by_list = other327.group_by_list; + having_expr = other327.having_expr; + limit_expr = other327.limit_expr; + offset_expr = other327.offset_expr; + order_by_list = other327.order_by_list; + __isset = other327.__isset; return *this; } void SelectRequest::printTo(std::ostream& out) const { @@ -9412,14 +9504,14 @@ uint32_t SelectResponse::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->column_defs.clear(); - uint32_t _size326; - ::apache::thrift::protocol::TType _etype329; - xfer += iprot->readListBegin(_etype329, _size326); - this->column_defs.resize(_size326); - uint32_t _i330; - for (_i330 = 0; _i330 < _size326; ++_i330) + uint32_t _size328; + ::apache::thrift::protocol::TType _etype331; + xfer += iprot->readListBegin(_etype331, _size328); + this->column_defs.resize(_size328); + uint32_t _i332; + for (_i332 = 0; _i332 < _size328; ++_i332) { - xfer += this->column_defs[_i330].read(iprot); + xfer += this->column_defs[_i332].read(iprot); } xfer += iprot->readListEnd(); } @@ -9432,14 +9524,14 @@ uint32_t SelectResponse::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->column_fields.clear(); - uint32_t _size331; - ::apache::thrift::protocol::TType _etype334; - xfer += iprot->readListBegin(_etype334, _size331); - this->column_fields.resize(_size331); - uint32_t _i335; - for (_i335 = 0; _i335 < _size331; ++_i335) + uint32_t _size333; + ::apache::thrift::protocol::TType _etype336; + xfer += iprot->readListBegin(_etype336, _size333); + this->column_fields.resize(_size333); + uint32_t _i337; + for (_i337 = 0; _i337 < _size333; ++_i337) { - xfer += this->column_fields[_i335].read(iprot); + xfer += this->column_fields[_i337].read(iprot); } xfer += iprot->readListEnd(); } @@ -9476,10 +9568,10 @@ uint32_t SelectResponse::write(::apache::thrift::protocol::TProtocol* oprot) con xfer += oprot->writeFieldBegin("column_defs", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->column_defs.size())); - std::vector ::const_iterator _iter336; - for (_iter336 = this->column_defs.begin(); _iter336 != this->column_defs.end(); ++_iter336) + std::vector ::const_iterator _iter338; + for (_iter338 = this->column_defs.begin(); _iter338 != this->column_defs.end(); ++_iter338) { - xfer += (*_iter336).write(oprot); + xfer += (*_iter338).write(oprot); } xfer += oprot->writeListEnd(); } @@ -9488,10 +9580,10 @@ uint32_t SelectResponse::write(::apache::thrift::protocol::TProtocol* oprot) con xfer += oprot->writeFieldBegin("column_fields", ::apache::thrift::protocol::T_LIST, 4); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->column_fields.size())); - std::vector ::const_iterator _iter337; - for (_iter337 = this->column_fields.begin(); _iter337 != this->column_fields.end(); ++_iter337) + std::vector ::const_iterator _iter339; + for (_iter339 = this->column_fields.begin(); _iter339 != this->column_fields.end(); ++_iter339) { - xfer += (*_iter337).write(oprot); + xfer += (*_iter339).write(oprot); } xfer += oprot->writeListEnd(); } @@ -9511,19 +9603,19 @@ void swap(SelectResponse &a, SelectResponse &b) { swap(a.__isset, b.__isset); } -SelectResponse::SelectResponse(const SelectResponse& other338) { - error_code = other338.error_code; - error_msg = other338.error_msg; - column_defs = other338.column_defs; - column_fields = other338.column_fields; - __isset = other338.__isset; +SelectResponse::SelectResponse(const SelectResponse& other340) { + error_code = other340.error_code; + error_msg = other340.error_msg; + column_defs = other340.column_defs; + column_fields = other340.column_fields; + __isset = other340.__isset; } -SelectResponse& SelectResponse::operator=(const SelectResponse& other339) { - error_code = other339.error_code; - error_msg = other339.error_msg; - column_defs = other339.column_defs; - column_fields = other339.column_fields; - __isset = other339.__isset; +SelectResponse& SelectResponse::operator=(const SelectResponse& other341) { + error_code = other341.error_code; + error_msg = other341.error_msg; + column_defs = other341.column_defs; + column_fields = other341.column_fields; + __isset = other341.__isset; return *this; } void SelectResponse::printTo(std::ostream& out) const { @@ -9663,19 +9755,19 @@ void swap(DeleteRequest &a, DeleteRequest &b) { swap(a.__isset, b.__isset); } -DeleteRequest::DeleteRequest(const DeleteRequest& other340) { - db_name = other340.db_name; - table_name = other340.table_name; - where_expr = other340.where_expr; - session_id = other340.session_id; - __isset = other340.__isset; +DeleteRequest::DeleteRequest(const DeleteRequest& other342) { + db_name = other342.db_name; + table_name = other342.table_name; + where_expr = other342.where_expr; + session_id = other342.session_id; + __isset = other342.__isset; } -DeleteRequest& DeleteRequest::operator=(const DeleteRequest& other341) { - db_name = other341.db_name; - table_name = other341.table_name; - where_expr = other341.where_expr; - session_id = other341.session_id; - __isset = other341.__isset; +DeleteRequest& DeleteRequest::operator=(const DeleteRequest& other343) { + db_name = other343.db_name; + table_name = other343.table_name; + where_expr = other343.where_expr; + session_id = other343.session_id; + __isset = other343.__isset; return *this; } void DeleteRequest::printTo(std::ostream& out) const { @@ -9768,14 +9860,14 @@ uint32_t UpdateRequest::read(::apache::thrift::protocol::TProtocol* iprot) { if (ftype == ::apache::thrift::protocol::T_LIST) { { this->update_expr_array.clear(); - uint32_t _size342; - ::apache::thrift::protocol::TType _etype345; - xfer += iprot->readListBegin(_etype345, _size342); - this->update_expr_array.resize(_size342); - uint32_t _i346; - for (_i346 = 0; _i346 < _size342; ++_i346) + uint32_t _size344; + ::apache::thrift::protocol::TType _etype347; + xfer += iprot->readListBegin(_etype347, _size344); + this->update_expr_array.resize(_size344); + uint32_t _i348; + for (_i348 = 0; _i348 < _size344; ++_i348) { - xfer += this->update_expr_array[_i346].read(iprot); + xfer += this->update_expr_array[_i348].read(iprot); } xfer += iprot->readListEnd(); } @@ -9824,10 +9916,10 @@ uint32_t UpdateRequest::write(::apache::thrift::protocol::TProtocol* oprot) cons xfer += oprot->writeFieldBegin("update_expr_array", ::apache::thrift::protocol::T_LIST, 4); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->update_expr_array.size())); - std::vector ::const_iterator _iter347; - for (_iter347 = this->update_expr_array.begin(); _iter347 != this->update_expr_array.end(); ++_iter347) + std::vector ::const_iterator _iter349; + for (_iter349 = this->update_expr_array.begin(); _iter349 != this->update_expr_array.end(); ++_iter349) { - xfer += (*_iter347).write(oprot); + xfer += (*_iter349).write(oprot); } xfer += oprot->writeListEnd(); } @@ -9852,21 +9944,21 @@ void swap(UpdateRequest &a, UpdateRequest &b) { swap(a.__isset, b.__isset); } -UpdateRequest::UpdateRequest(const UpdateRequest& other348) { - db_name = other348.db_name; - table_name = other348.table_name; - where_expr = other348.where_expr; - update_expr_array = other348.update_expr_array; - session_id = other348.session_id; - __isset = other348.__isset; -} -UpdateRequest& UpdateRequest::operator=(const UpdateRequest& other349) { - db_name = other349.db_name; - table_name = other349.table_name; - where_expr = other349.where_expr; - update_expr_array = other349.update_expr_array; - session_id = other349.session_id; - __isset = other349.__isset; +UpdateRequest::UpdateRequest(const UpdateRequest& other350) { + db_name = other350.db_name; + table_name = other350.table_name; + where_expr = other350.where_expr; + update_expr_array = other350.update_expr_array; + session_id = other350.session_id; + __isset = other350.__isset; +} +UpdateRequest& UpdateRequest::operator=(const UpdateRequest& other351) { + db_name = other351.db_name; + table_name = other351.table_name; + where_expr = other351.where_expr; + update_expr_array = other351.update_expr_array; + session_id = other351.session_id; + __isset = other351.__isset; return *this; } void UpdateRequest::printTo(std::ostream& out) const { @@ -9973,15 +10065,15 @@ void swap(ShowTablesRequest &a, ShowTablesRequest &b) { swap(a.__isset, b.__isset); } -ShowTablesRequest::ShowTablesRequest(const ShowTablesRequest& other350) { - session_id = other350.session_id; - db_name = other350.db_name; - __isset = other350.__isset; +ShowTablesRequest::ShowTablesRequest(const ShowTablesRequest& other352) { + session_id = other352.session_id; + db_name = other352.db_name; + __isset = other352.__isset; } -ShowTablesRequest& ShowTablesRequest::operator=(const ShowTablesRequest& other351) { - session_id = other351.session_id; - db_name = other351.db_name; - __isset = other351.__isset; +ShowTablesRequest& ShowTablesRequest::operator=(const ShowTablesRequest& other353) { + session_id = other353.session_id; + db_name = other353.db_name; + __isset = other353.__isset; return *this; } void ShowTablesRequest::printTo(std::ostream& out) const { @@ -10102,17 +10194,17 @@ void swap(ShowSegmentsRequest &a, ShowSegmentsRequest &b) { swap(a.__isset, b.__isset); } -ShowSegmentsRequest::ShowSegmentsRequest(const ShowSegmentsRequest& other352) { - session_id = other352.session_id; - db_name = other352.db_name; - table_name = other352.table_name; - __isset = other352.__isset; +ShowSegmentsRequest::ShowSegmentsRequest(const ShowSegmentsRequest& other354) { + session_id = other354.session_id; + db_name = other354.db_name; + table_name = other354.table_name; + __isset = other354.__isset; } -ShowSegmentsRequest& ShowSegmentsRequest::operator=(const ShowSegmentsRequest& other353) { - session_id = other353.session_id; - db_name = other353.db_name; - table_name = other353.table_name; - __isset = other353.__isset; +ShowSegmentsRequest& ShowSegmentsRequest::operator=(const ShowSegmentsRequest& other355) { + session_id = other355.session_id; + db_name = other355.db_name; + table_name = other355.table_name; + __isset = other355.__isset; return *this; } void ShowSegmentsRequest::printTo(std::ostream& out) const { @@ -10251,19 +10343,19 @@ void swap(ShowSegmentRequest &a, ShowSegmentRequest &b) { swap(a.__isset, b.__isset); } -ShowSegmentRequest::ShowSegmentRequest(const ShowSegmentRequest& other354) { - session_id = other354.session_id; - db_name = other354.db_name; - table_name = other354.table_name; - segment_id = other354.segment_id; - __isset = other354.__isset; +ShowSegmentRequest::ShowSegmentRequest(const ShowSegmentRequest& other356) { + session_id = other356.session_id; + db_name = other356.db_name; + table_name = other356.table_name; + segment_id = other356.segment_id; + __isset = other356.__isset; } -ShowSegmentRequest& ShowSegmentRequest::operator=(const ShowSegmentRequest& other355) { - session_id = other355.session_id; - db_name = other355.db_name; - table_name = other355.table_name; - segment_id = other355.segment_id; - __isset = other355.__isset; +ShowSegmentRequest& ShowSegmentRequest::operator=(const ShowSegmentRequest& other357) { + session_id = other357.session_id; + db_name = other357.db_name; + table_name = other357.table_name; + segment_id = other357.segment_id; + __isset = other357.__isset; return *this; } void ShowSegmentRequest::printTo(std::ostream& out) const { @@ -10522,33 +10614,33 @@ void swap(ShowSegmentResponse &a, ShowSegmentResponse &b) { swap(a.__isset, b.__isset); } -ShowSegmentResponse::ShowSegmentResponse(const ShowSegmentResponse& other356) { - error_code = other356.error_code; - error_msg = other356.error_msg; - segment_id = other356.segment_id; - status = other356.status; - path = other356.path; - size = other356.size; - block_count = other356.block_count; - row_capacity = other356.row_capacity; - row_count = other356.row_count; - room = other356.room; - column_count = other356.column_count; - __isset = other356.__isset; +ShowSegmentResponse::ShowSegmentResponse(const ShowSegmentResponse& other358) { + error_code = other358.error_code; + error_msg = other358.error_msg; + segment_id = other358.segment_id; + status = other358.status; + path = other358.path; + size = other358.size; + block_count = other358.block_count; + row_capacity = other358.row_capacity; + row_count = other358.row_count; + room = other358.room; + column_count = other358.column_count; + __isset = other358.__isset; } -ShowSegmentResponse& ShowSegmentResponse::operator=(const ShowSegmentResponse& other357) { - error_code = other357.error_code; - error_msg = other357.error_msg; - segment_id = other357.segment_id; - status = other357.status; - path = other357.path; - size = other357.size; - block_count = other357.block_count; - row_capacity = other357.row_capacity; - row_count = other357.row_count; - room = other357.room; - column_count = other357.column_count; - __isset = other357.__isset; +ShowSegmentResponse& ShowSegmentResponse::operator=(const ShowSegmentResponse& other359) { + error_code = other359.error_code; + error_msg = other359.error_msg; + segment_id = other359.segment_id; + status = other359.status; + path = other359.path; + size = other359.size; + block_count = other359.block_count; + row_capacity = other359.row_capacity; + row_count = other359.row_count; + room = other359.room; + column_count = other359.column_count; + __isset = other359.__isset; return *this; } void ShowSegmentResponse::printTo(std::ostream& out) const { @@ -10695,19 +10787,19 @@ void swap(ShowBlocksRequest &a, ShowBlocksRequest &b) { swap(a.__isset, b.__isset); } -ShowBlocksRequest::ShowBlocksRequest(const ShowBlocksRequest& other358) { - session_id = other358.session_id; - db_name = other358.db_name; - table_name = other358.table_name; - segment_id = other358.segment_id; - __isset = other358.__isset; +ShowBlocksRequest::ShowBlocksRequest(const ShowBlocksRequest& other360) { + session_id = other360.session_id; + db_name = other360.db_name; + table_name = other360.table_name; + segment_id = other360.segment_id; + __isset = other360.__isset; } -ShowBlocksRequest& ShowBlocksRequest::operator=(const ShowBlocksRequest& other359) { - session_id = other359.session_id; - db_name = other359.db_name; - table_name = other359.table_name; - segment_id = other359.segment_id; - __isset = other359.__isset; +ShowBlocksRequest& ShowBlocksRequest::operator=(const ShowBlocksRequest& other361) { + session_id = other361.session_id; + db_name = other361.db_name; + table_name = other361.table_name; + segment_id = other361.segment_id; + __isset = other361.__isset; return *this; } void ShowBlocksRequest::printTo(std::ostream& out) const { @@ -10864,21 +10956,21 @@ void swap(ShowBlockRequest &a, ShowBlockRequest &b) { swap(a.__isset, b.__isset); } -ShowBlockRequest::ShowBlockRequest(const ShowBlockRequest& other360) { - session_id = other360.session_id; - db_name = other360.db_name; - table_name = other360.table_name; - segment_id = other360.segment_id; - block_id = other360.block_id; - __isset = other360.__isset; +ShowBlockRequest::ShowBlockRequest(const ShowBlockRequest& other362) { + session_id = other362.session_id; + db_name = other362.db_name; + table_name = other362.table_name; + segment_id = other362.segment_id; + block_id = other362.block_id; + __isset = other362.__isset; } -ShowBlockRequest& ShowBlockRequest::operator=(const ShowBlockRequest& other361) { - session_id = other361.session_id; - db_name = other361.db_name; - table_name = other361.table_name; - segment_id = other361.segment_id; - block_id = other361.block_id; - __isset = other361.__isset; +ShowBlockRequest& ShowBlockRequest::operator=(const ShowBlockRequest& other363) { + session_id = other363.session_id; + db_name = other363.db_name; + table_name = other363.table_name; + segment_id = other363.segment_id; + block_id = other363.block_id; + __isset = other363.__isset; return *this; } void ShowBlockRequest::printTo(std::ostream& out) const { @@ -11087,27 +11179,27 @@ void swap(ShowBlockResponse &a, ShowBlockResponse &b) { swap(a.__isset, b.__isset); } -ShowBlockResponse::ShowBlockResponse(const ShowBlockResponse& other362) { - error_code = other362.error_code; - error_msg = other362.error_msg; - block_id = other362.block_id; - path = other362.path; - size = other362.size; - row_capacity = other362.row_capacity; - row_count = other362.row_count; - column_count = other362.column_count; - __isset = other362.__isset; +ShowBlockResponse::ShowBlockResponse(const ShowBlockResponse& other364) { + error_code = other364.error_code; + error_msg = other364.error_msg; + block_id = other364.block_id; + path = other364.path; + size = other364.size; + row_capacity = other364.row_capacity; + row_count = other364.row_count; + column_count = other364.column_count; + __isset = other364.__isset; } -ShowBlockResponse& ShowBlockResponse::operator=(const ShowBlockResponse& other363) { - error_code = other363.error_code; - error_msg = other363.error_msg; - block_id = other363.block_id; - path = other363.path; - size = other363.size; - row_capacity = other363.row_capacity; - row_count = other363.row_count; - column_count = other363.column_count; - __isset = other363.__isset; +ShowBlockResponse& ShowBlockResponse::operator=(const ShowBlockResponse& other365) { + error_code = other365.error_code; + error_msg = other365.error_msg; + block_id = other365.block_id; + path = other365.path; + size = other365.size; + row_capacity = other365.row_capacity; + row_count = other365.row_count; + column_count = other365.column_count; + __isset = other365.__isset; return *this; } void ShowBlockResponse::printTo(std::ostream& out) const { @@ -11285,23 +11377,23 @@ void swap(ShowBlockColumnRequest &a, ShowBlockColumnRequest &b) { swap(a.__isset, b.__isset); } -ShowBlockColumnRequest::ShowBlockColumnRequest(const ShowBlockColumnRequest& other364) { - session_id = other364.session_id; - db_name = other364.db_name; - table_name = other364.table_name; - segment_id = other364.segment_id; - block_id = other364.block_id; - column_id = other364.column_id; - __isset = other364.__isset; +ShowBlockColumnRequest::ShowBlockColumnRequest(const ShowBlockColumnRequest& other366) { + session_id = other366.session_id; + db_name = other366.db_name; + table_name = other366.table_name; + segment_id = other366.segment_id; + block_id = other366.block_id; + column_id = other366.column_id; + __isset = other366.__isset; } -ShowBlockColumnRequest& ShowBlockColumnRequest::operator=(const ShowBlockColumnRequest& other365) { - session_id = other365.session_id; - db_name = other365.db_name; - table_name = other365.table_name; - segment_id = other365.segment_id; - block_id = other365.block_id; - column_id = other365.column_id; - __isset = other365.__isset; +ShowBlockColumnRequest& ShowBlockColumnRequest::operator=(const ShowBlockColumnRequest& other367) { + session_id = other367.session_id; + db_name = other367.db_name; + table_name = other367.table_name; + segment_id = other367.segment_id; + block_id = other367.block_id; + column_id = other367.column_id; + __isset = other367.__isset; return *this; } void ShowBlockColumnRequest::printTo(std::ostream& out) const { @@ -11511,27 +11603,27 @@ void swap(ShowBlockColumnResponse &a, ShowBlockColumnResponse &b) { swap(a.__isset, b.__isset); } -ShowBlockColumnResponse::ShowBlockColumnResponse(const ShowBlockColumnResponse& other366) { - error_code = other366.error_code; - error_msg = other366.error_msg; - column_name = other366.column_name; - column_id = other366.column_id; - data_type = other366.data_type; - path = other366.path; - extra_file_count = other366.extra_file_count; - extra_file_names = other366.extra_file_names; - __isset = other366.__isset; -} -ShowBlockColumnResponse& ShowBlockColumnResponse::operator=(const ShowBlockColumnResponse& other367) { - error_code = other367.error_code; - error_msg = other367.error_msg; - column_name = other367.column_name; - column_id = other367.column_id; - data_type = other367.data_type; - path = other367.path; - extra_file_count = other367.extra_file_count; - extra_file_names = other367.extra_file_names; - __isset = other367.__isset; +ShowBlockColumnResponse::ShowBlockColumnResponse(const ShowBlockColumnResponse& other368) { + error_code = other368.error_code; + error_msg = other368.error_msg; + column_name = other368.column_name; + column_id = other368.column_id; + data_type = other368.data_type; + path = other368.path; + extra_file_count = other368.extra_file_count; + extra_file_names = other368.extra_file_names; + __isset = other368.__isset; +} +ShowBlockColumnResponse& ShowBlockColumnResponse::operator=(const ShowBlockColumnResponse& other369) { + error_code = other369.error_code; + error_msg = other369.error_msg; + column_name = other369.column_name; + column_id = other369.column_id; + data_type = other369.data_type; + path = other369.path; + extra_file_count = other369.extra_file_count; + extra_file_names = other369.extra_file_names; + __isset = other369.__isset; return *this; } void ShowBlockColumnResponse::printTo(std::ostream& out) const { diff --git a/src/network/infinity_thrift/infinity_types.h b/src/network/infinity_thrift/infinity_types.h index 40e71acecf..b21245c177 100644 --- a/src/network/infinity_thrift/infinity_types.h +++ b/src/network/infinity_thrift/infinity_types.h @@ -259,6 +259,8 @@ class ColumnField; class ImportOption; +class ConnectRequest; + class CommonRequest; class CommonResponse; @@ -1862,6 +1864,49 @@ void swap(ImportOption &a, ImportOption &b); std::ostream& operator<<(std::ostream& out, const ImportOption& obj); +typedef struct _ConnectRequest__isset { + _ConnectRequest__isset() : client_version(false) {} + bool client_version :1; +} _ConnectRequest__isset; + +class ConnectRequest : public virtual ::apache::thrift::TBase { + public: + + ConnectRequest(const ConnectRequest&) noexcept; + ConnectRequest& operator=(const ConnectRequest&) noexcept; + ConnectRequest() noexcept + : client_version(0) { + } + + virtual ~ConnectRequest() noexcept; + int64_t client_version; + + _ConnectRequest__isset __isset; + + void __set_client_version(const int64_t val); + + bool operator == (const ConnectRequest & rhs) const + { + if (!(client_version == rhs.client_version)) + return false; + return true; + } + bool operator != (const ConnectRequest &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ConnectRequest & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot) override; + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const override; + + virtual void printTo(std::ostream& out) const; +}; + +void swap(ConnectRequest &a, ConnectRequest &b); + +std::ostream& operator<<(std::ostream& out, const ConnectRequest& obj); + typedef struct _CommonRequest__isset { _CommonRequest__isset() : session_id(false) {} bool session_id :1; diff --git a/src/network/infinity_thrift_service.cpp b/src/network/infinity_thrift_service.cpp index f937881f2e..ec9c25817f 100644 --- a/src/network/infinity_thrift_service.cpp +++ b/src/network/infinity_thrift_service.cpp @@ -61,7 +61,46 @@ import query_result; namespace infinity { -void InfinityThriftService::Connect(infinity_thrift_rpc::CommonResponse &response) { +ClientVersions::ClientVersions() { + client_version_map_[1] = String("0.2.0.dev2"); +} + +Pair ClientVersions::GetVersionByIndex(i64 version_index) { + auto iter = client_version_map_.find(version_index); + if(iter == client_version_map_.end()) { + return {nullptr, Status::UnsupportedVersionIndex(version_index)}; + } + return {iter->second.c_str(), Status::OK()}; +} + +std::mutex InfinityThriftService::infinity_session_map_mutex_; +HashMap> InfinityThriftService::infinity_session_map_; +ClientVersions InfinityThriftService::client_version_; + +void InfinityThriftService::Connect(infinity_thrift_rpc::CommonResponse &response, const infinity_thrift_rpc::ConnectRequest& request) { + i64 request_client_version = request.client_version; + if(request_client_version != current_version_index_) { + auto [request_version_ptr, status1] = client_version_.GetVersionByIndex(request_client_version); + if(!status1.ok()) { + response.__set_error_code((i64)(status1.code())); + response.__set_error_msg(status1.message()); + LOG_ERROR(status1.message()); + return ; + } + + auto [expected_version_ptr, status2] = client_version_.GetVersionByIndex(current_version_index_); + if(!status2.ok()) { + LOG_ERROR(status2.message()); + UnrecoverableError(status2.message()); + } + + Status status3 = Status::ClientVersionMismatch(expected_version_ptr, request_version_ptr); + response.__set_error_code((i64)(status3.code())); + response.__set_error_msg(status3.message()); + LOG_ERROR(status3.message()); + return ; + } + auto infinity = Infinity::RemoteConnect(); std::lock_guard lock(infinity_session_map_mutex_); infinity_session_map_.emplace(infinity->GetSessionId(), infinity); diff --git a/src/network/infinity_thrift_service.cppm b/src/network/infinity_thrift_service.cppm index acad5eef0b..cbfbeb7380 100644 --- a/src/network/infinity_thrift_service.cppm +++ b/src/network/infinity_thrift_service.cppm @@ -44,14 +44,28 @@ import query_result; namespace infinity { +struct ClientVersions { + ClientVersions(); + + HashMap client_version_map_; + + Pair GetVersionByIndex(i64); +}; + export class InfinityThriftService final : public infinity_thrift_rpc::InfinityServiceIf { private: static constexpr std::string_view ErrorMsgHeader = "[THRIFT ERROR]"; + static constexpr i64 current_version_index_{1}; + + static std::mutex infinity_session_map_mutex_; + static HashMap> infinity_session_map_; + + static ClientVersions client_version_; public: InfinityThriftService() = default; - void Connect(infinity_thrift_rpc::CommonResponse &response) final; + void Connect(infinity_thrift_rpc::CommonResponse &response, const infinity_thrift_rpc::ConnectRequest& request) final; void Disconnect(infinity_thrift_rpc::CommonResponse &response, const infinity_thrift_rpc::CommonRequest &request) final; @@ -112,8 +126,7 @@ public: void ShowIndex(infinity_thrift_rpc::ShowIndexResponse &response, const infinity_thrift_rpc::ShowIndexRequest &request) final; private: - std::mutex infinity_session_map_mutex_{}; - HashMap> infinity_session_map_{}; + // SizeT count_ = 0; // std::chrono::duration phase_1_duration_{}; diff --git a/src/network/infinity_thrift_types.cppm b/src/network/infinity_thrift_types.cppm index b4618632cd..2362d12c27 100644 --- a/src/network/infinity_thrift_types.cppm +++ b/src/network/infinity_thrift_types.cppm @@ -21,6 +21,7 @@ export module infinity_thrift_types; namespace infinity_thrift_rpc { export using infinity_thrift_rpc::InfinityServiceIf; +export using infinity_thrift_rpc::ConnectRequest; export using infinity_thrift_rpc::CommonResponse; export using infinity_thrift_rpc::CommonRequest; export using infinity_thrift_rpc::CreateDatabaseRequest; diff --git a/src/planner/logical_planner.cpp b/src/planner/logical_planner.cpp index 1b87c74ed9..4a3b07a203 100644 --- a/src/planner/logical_planner.cpp +++ b/src/planner/logical_planner.cpp @@ -589,7 +589,7 @@ Status LogicalPlanner::BuildCreateDatabase(const CreateStatement *statement, Sha case IdentifierValidationStatus::kExceedLimit: return Status::ExceedDBNameLength(create_schema_info->schema_name_.length()); case IdentifierValidationStatus::kInvalidName: { - return Status::InvalidDBName(create_schema_info->schema_name_); + return Status::InvalidIdentifierName(create_schema_info->schema_name_); } } @@ -789,7 +789,7 @@ Status LogicalPlanner::BuildDropSchema(const DropStatement *statement, SharedPtr case IdentifierValidationStatus::kExceedLimit: return Status::ExceedDBNameLength(drop_schema_info->schema_name_.length()); case IdentifierValidationStatus::kInvalidName: { - return Status::InvalidDBName(drop_schema_info->schema_name_); + return Status::InvalidIdentifierName(drop_schema_info->schema_name_); } } diff --git a/src/storage/txn/txn.cpp b/src/storage/txn/txn.cpp index 4882b4947c..1af283a098 100644 --- a/src/storage/txn/txn.cpp +++ b/src/storage/txn/txn.cpp @@ -143,7 +143,7 @@ void Txn::CheckTxn(const String &db_name) { } else if (!IsEqual(db_name_, db_name)) { UniquePtr err_msg = MakeUnique(fmt::format("Attempt to get table from another database {}", db_name)); LOG_ERROR(*err_msg); - RecoverableError(Status::InvalidDBName(db_name)); + RecoverableError(Status::InvalidIdentifierName(db_name)); } } diff --git a/thrift/infinity.thrift b/thrift/infinity.thrift index 2576858786..1d3618d467 100644 --- a/thrift/infinity.thrift +++ b/thrift/infinity.thrift @@ -238,6 +238,10 @@ struct ImportOption { 4: CopyFileType copy_file_type, } +struct ConnectRequest { +1: i64 client_version, +} + struct CommonRequest { 1: i64 session_id, } @@ -572,7 +576,7 @@ struct ShowBlockColumnResponse { // Service service InfinityService { -CommonResponse Connect(), +CommonResponse Connect(1:ConnectRequest request), CommonResponse Disconnect(1:CommonRequest request), CommonResponse CreateDatabase(1:CreateDatabaseRequest request),